forked from MapServer/tinyows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
193 lines (144 loc) · 5.8 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
AC_INIT()
AC_CHECK_FUNCS()
dnl ---------------------------------------------------------------------
dnl Look for libxml2
dnl ---------------------------------------------------------------------
AC_ARG_WITH(xml2-config,
[ --with-xml2-config=PATH Specify path to xml2-config.],,)
if test "$with_xml2_config" = "no" ; then
AC_MSG_ERROR([LibXML2 support is a need to TinyOWS !])
fi
if test "`basename xx/$with_xml2_config`" = "xml2-config" ; then
LIBXML2_CONFIG="$with_xml2_config"
if ! test -f "$LIBXML2_CONFIG" -a -x "$LIBXML2_CONFIG" ; then
AC_MSG_ERROR(['$LIBXML2_CONFIG' is not an executable. Make sure you use --with-xml2-config=/path/to/xml2-config])
fi
else
AC_PATH_PROG(LIBXML2_CONFIG, xml2-config, no)
fi
if test "$LIBXML2_CONFIG" = "no" ; then
AC_MSG_ERROR([couldn't find xml2-config, try using --with-xml2-config=PATH])
fi
XML2_VER=`$LIBXML2_CONFIG --version`
AC_MSG_RESULT([checking for libxml2 version... $XML2_VER])
xml2_vers=`$LIBXML2_CONFIG --version | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$xml2_vers" -lt 2009000 ; then
AC_MSG_ERROR([You need at least libxml 2.9.0])
fi
XML2_INC=`$LIBXML2_CONFIG --cflags`
XML2_LIB=`$LIBXML2_CONFIG --libs`
AC_SUBST(XML2_INC)
AC_SUBST(XML2_LIB)
dnl ---------------------------------------------------------------------
dnl Debug
dnl ---------------------------------------------------------------------
AC_ARG_ENABLE(debug,
[ --enable-debug enable debug mode], TINYOWS_DEBUG=1, TINYOWS_DEBUG=0)
AC_SUBST(TINYOWS_DEBUG)
dnl ---------------------------------------------------------------------------
dnl Git
dnl ---------------------------------------------------------------------------
AC_CHECK_PROG(git, git, yes)
if test "$git" = "yes" -a -d ".git"; then
GIT_FLAGS='"-D TINYOWS_GIT_COMMIT=\"$(shell git log --abbrev-commit -n 1 HEAD | grep commit)\""'
AC_SUBST(GIT_FLAGS)
fi
dnl ---------------------------------------------------------------------------
dnl PostgreSQL / PostGIS support
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(pg_config,[ --with-pg_config[[=ARG]] Include PostGIS Support (ARG=yes/path to pg_config)],,)
if test "$with_pg_config" = "no" ; then
AC_MSG_ERROR([PostGIS support is a need to TinyOWS !])
elif test "$with_pg_config" = "yes" -o "$with_pg_config" = "" ; then
AC_PATH_PROG(PG_CONFIG, pg_config, no)
else
AC_MSG_RESULT(yes)
PG_CONFIG=$with_pg_config
fi
if ! test -f "$PG_CONFIG" -a -x "$PG_CONFIG" ; then
AC_MSG_ERROR(['$PG_CONFIG' is not an executable. Make sure you use --with-pg_config=/path/to/pg_config])
fi
PG_VER=`$PG_CONFIG --version`
AC_MSG_RESULT([checking for PostgreSQL version... $PG_VER])
pg_vers=`$PG_CONFIG --version | sed 's/PostgreSQL //' | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
if test "$pg_vers" -lt 8001000 ; then
AC_MSG_ERROR([You need at least PostgreSQL 8.1.0])
fi
POSTGIS_LIB="-L`$PG_CONFIG --libdir` -lpq"
POSTGIS_INC="-I`$PG_CONFIG --includedir`"
POSTGIS_SHARE=`$PG_CONFIG --sharedir`
POSTGIS_BIN=`$PG_CONFIG --bindir`
AC_SUBST(POSTGIS_INC)
AC_SUBST(POSTGIS_LIB)
AC_SUBST(POSTGIS_SHARE)
AC_SUBST(POSTGIS_BIN)
dnl ---------------------------------------------------------------------------
dnl Shp2PgSQL
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(shp2pgsql,[ --with-shp2pgsql[[=ARG]] shp2pgsql directory Support (ARG=path to shp2pgsql)],,)
if test "$with_shp2gpsql" = "no" ; then
AC_MSG_ERROR([shp2pgsql is a need to TinyOWS !])
elif test "$with_shp2pgsql" = "yes" -o "$with_shp2pgsql" = "" ; then
AC_PATH_PROG(SHP2PGSQL, shp2pgsql, no)
else
AC_MSG_RESULT(yes)
SHP2PGSQL=$with_shp2pgsql
fi
if ! test -f "$SHP2PGSQL" -a -x "$SHP2PGSQL" ; then
AC_MSG_ERROR(['$SHP2PGSQL' is not an executable. Make sure you use --with-shp2pgsql=/path/to/shp2pgsql])
fi
AC_SUBST(SHP2PGSQL)
dnl ---------------------------------------------------------------------------
dnl Flex check
dnl ---------------------------------------------------------------------------
AC_PROG_LEX
if test "$LEX" != flex; then
AC_MSG_ERROR("TinyOWS: Need flex to compile")
fi
dnl ---------------------------------------------------------------------------
dnl FastCGI
dnl ---------------------------------------------------------------------------
USE_FCGI=0
AC_ARG_WITH(fastcgi,
[ --with-fastcgi[[=ARG]] Include FastCGI support: recommanded (ARG=no/path to fastcgi dir)],
[FCGI_PATH="$withval"], [FCGI_PATH=""])
if test "x$FCGI_PATH" != "x"; then
AC_MSG_RESULT([checking user-specified fast-cgi location: $FCGI_PATH])
FCGI_INC="-I$FCGI_PATH/include"
FCGI_LIB="-L$FCGI_PATH/lib"
fi
if test "x$FCGI_PATH" != "xno"; then
AC_CHECK_LIB(fcgi, FCGI_Accept, [
AC_CHECK_HEADERS([fcgi_config.h fcgi_stdio.h],[
USE_FCGI=1
])
])
dnl Some platforms use fastcgi subdir in include
if test "$USE_FCGI" = "0" ; then
echo "checking now FCGI in alternate fastcgi include dir"
AC_CHECK_LIB(fcgi, FCGI_Accept, [
AC_CHECK_HEADERS([fastcgi/fcgi_config.h fastcgi/fcgi_stdio.h],[
USE_FCGI=1
])
])
if test "x$FCGI_PATH" != "x"; then
FCGI_INC="-I$FCGI_PATH/include/fastcgi"
else
FCGI_INC="-I/usr/include/fastcgi"
fi
fi
fi
if test "$USE_FCGI" = "0" ; then
AC_MSG_WARN([\n\nNo FastCGI support. Performances will be strongly reduced !\n])
else
FCGI_LIB="$FCGI_LIB -lfcgi"
fi
AC_SUBST(FCGI_INC)
AC_SUBST(FCGI_LIB)
AC_SUBST(USE_FCGI)
AC_OUTPUT(Makefile src/ows_define.h demo/tinyows.xml demo/install.sh test/wfs_100/config_wfs_100.xml test/wfs_110/config_wfs_110.xml test/wfs_100/install_wfs_100.sh test/wfs_110/install_wfs_110.sh)
rm -rf autom4te.cache
rm -f config.log config.status
echo "------------------------"
echo "NOTA: This TinyOWS version will need at least PostGIS 1.5.x"
echo "------------------------"