Annotation of parser3/configure.ac, revision 1.31
1.1 moko 1: dnl Autoconf initialisation
2: AC_PREREQ(2.59)
1.17 moko 3: AC_INIT(parser, 3.4.6b)
1.1 moko 4: AC_CONFIG_SRCDIR(README)
5:
6:
1.14 moko 7: dnl Automake Initialization
1.1 moko 8: AM_INIT_AUTOMAKE
9:
10:
11: dnl Expand srcdir
12: P3S=`cd $srcdir/src ; pwd`
13: AC_SUBST(P3S)
14:
15:
16: dnl Parser version update
17: AC_CANONICAL_HOST
18: AC_DEFINE_UNQUOTED(PARSER_VERSION,"$VERSION (compiled on $host)",parser version)
19:
20: AC_SUBST(host_os)
21: case $host_os in
22: *cygwin* ) AC_DEFINE(CYGWIN,,using cygwin building environment);;
23: esac
24:
25:
26: dnl Checks for programs
27: AC_PROG_INSTALL
28: AC_PROG_AWK
29:
30: AC_PROG_YACC
31: if test "$YACC" != "bison -y"; then
32: AC_MSG_WARN(to regenerate Parser grammar YOU WOULD NEED BISON)
33: else
34: AC_MSG_CHECKING(bison version)
35: oldIFS=$IFS; IFS=.
36: set `bison -V | sed -e 's/^GNU Bison version //' -e 's/^bison (GNU Bison) //' -e 's/$/./'`
37: IFS=$oldIFS
38: if test "$1" = "1" -a "$2" -lt "25"; then
39: AC_MSG_WARN(Bison 1.25 or newer needed to regenerate Parser compiler (found $1.$2).)
40: fi
41: AC_MSG_RESULT($1.$2 (ok))
42: fi
43:
44: AC_PROG_CXX
45: AC_PROG_CC
46:
47: dnl most tests should be compiled with C compiler [especially qsort test]
48: AC_LANG_C
49:
50:
51: dnl Dll extension
52: AC_MSG_CHECKING(for dynamic-link library extension)
53: case "$host_os" in
54: *cygwin* ) dll_extension=dll;;
55: * ) dll_extension=so
56: esac
57: AC_MSG_RESULT($dll_extension)
58: AC_SUBST(dll_extension)
59:
60:
61: dnl Misc arguments
62: AC_ARG_WITH(build-warnings, [ --with-build-warnings to enable build-time compiler warnings if gcc is used],
63: AC_MSG_WARN(enabling compiler warnings)
1.10 moko 64: CXXFLAGS="$CXXFLAGS -Wextra -Wall -Wno-parentheses"
1.1 moko 65: )
66:
1.15 moko 67: AC_ARG_WITH(coverage, [ --with-coverage to enable gcov code coverage support],
1.9 moko 68: AC_MSG_WARN(enabling gcov support)
69: CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
70: CXXFLAGS=`echo "$XXCFLAGS" | $SED -e 's/-O[0-9]*//g'`
71: CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
72: CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
73: LDFLAGS="$LDFLAGS -lgcov"
74: )
75:
1.15 moko 76: AC_ARG_WITH(profiler, [ --with-profiler to enable gprof code profiler support],
1.9 moko 77: AC_MSG_WARN(enabling gprof support)
1.24 moko 78: CFLAGS="$CFLAGS -O0 -pg -g"
79: CXXFLAGS="$CXXFLAGS -O0 -pg -g"
1.9 moko 80: )
81:
1.1 moko 82: AC_ARG_WITH(assertions, [ --with-assertions to enable assertions],
83: AC_MSG_WARN(enabling assertions)
84: ,
85: AC_DEFINE(NDEBUG,,assertions disabled)
86: )
87:
88: AC_ARG_WITH(sjlj-exceptions,[ --with-sjlj-exceptions enable simple 'throw' from dynamic library],
89: AC_DEFINE(PA_WITH_SJLJ_EXCEPTIONS,,one can throw from dynamic library)
90: )
91:
92:
93: dnl Safe mode argument
94: AC_ARG_ENABLE(safe-mode, [ --disable-safe-mode to enable reading and executing
95: files belonging to group+user other then effective],
96: [
97: SAFE_MODE=$enableval
98: ]
99: )
100:
101: if test "$SAFE_MODE" = "no"; then
102: AC_MSG_WARN(enabling reading of files belonging to group+user other then effective)
103: else
104: AC_DEFINE(PA_SAFE_MODE,,disabled reading of files belonging to group+user other then effective)
105: fi
106:
107:
108: dnl Disable execs argument
109: AC_ARG_ENABLE(execs, [ --disable-execs to disable any execs
110: (file::exec, file::cgi, unix mail:send)],
111: [
112: if test "$enableval" = "no"; then
113: AC_MSG_WARN(disabling file execs)
114: AC_DEFINE(NO_PA_EXECS,,pa_exec disabled)
115: fi
116: ]
117: )
118:
119:
120: dnl String stream argument
1.28 moko 121: AC_ARG_ENABLE(stringstream, [ --disable-stringstream to disable stringstream usage.
122: when disabled table.save uses more memory, but more compilers are supported],
1.1 moko 123: [
124: if test "$enableval" = "no"; then
125: AC_MSG_WARN(disabling stringstream usage)
126: AC_DEFINE(NO_STRINGSTREAM,,stringstream disabled)
127: fi
128: ]
129: )
130:
131:
132: dnl GC argument
133: AC_ARG_WITH(gc,[ --with-gc[=D] D is the directory where
134: Boehm garbage collecting library is installed],[
135:
136: GC=$withval
137: GC_LIBS="$GC/libgc.la"
138:
139: if test -f $GC_LIBS; then
140: GC_OK="yes"
141: else
142: GC_LIBS="-L$GC -lgc"
143: fi
144:
145: if test "$GC" = "yes"; then
146: GC=""
147: GC_LIBS="-lgc"
148: AC_MSG_WARN([--with-gc value was not specified, hoping linker would find it])
149: fi
150: ],[
151: GC_LIBS="-lgc"
152: AC_MSG_WARN([--with-gc was not specified, hoping linker would find it])
153: ])
154:
155: if test -z "$GC_OK"; then
156: AC_MSG_CHECKING(for libgc)
157: SAVE_LIBS=$LIBS
158: LIBS="$LIBS $GC_LIBS"
159: AC_TRY_LINK([ extern int GC_dont_gc; ],[ GC_dont_gc=0; ],
160: AC_MSG_RESULT(yes)
161: ,
162: AC_MSG_RESULT(no)
163: if test -z "$GC"; then
164: AC_MSG_ERROR(please specify path to libgc: --with-gc=D)
165: else
166: AC_MSG_ERROR($GC does not seem to be valid libgc installation directory)
167: fi
168: )
169: LIBS=$SAVE_LIBS
170: fi
171:
172: AC_SUBST(GC_LIBS)
173:
174:
175: dnl PCRE argument
176: AC_ARG_WITH(pcre,[ --with-pcre=D D is the directory where
177: PCRE library is installed],[
178: PCRE=$withval
179: PCRE_INCLUDES="-I$PCRE/include"
180: PCRE_LIBS="$PCRE/lib/libpcre.la"
181:
182: if test -f $PCRE/include/pcre.h -a -f $PCRE_LIBS; then
183: PCRE_OK="yes"
184: else
1.22 moko 185: PCRE_LIBS="-L$PCRE/lib -lpcre"
1.1 moko 186: fi
187:
188: if test "$PCRE" = "yes"; then
189: PCRE=""
190: PCRE_LIBS="-lpcre"
191: PCRE_INCLUDES=""
192: AC_MSG_WARN([--with-pcre value was not specified, hoping linker would find it])
193: fi
194: ],[
195: PCRE_LIBS="-lpcre"
196: PCRE_INCLUDES=""
197: AC_MSG_WARN([--with-pcre was not specified, hoping linker would find it])
198: ])
199:
200: if test -z "$PCRE_OK"; then
201: AC_MSG_CHECKING(for prce)
202: SAVE_LIBS=$LIBS
203: LIBS="$LIBS $PCRE_LIBS $PCRE_INCLUDES"
204: AC_TRY_LINK([ #include <pcre.h> ],[ const char *v=pcre_version(); ],
205: AC_MSG_RESULT(yes)
206: ,
207: AC_MSG_RESULT(no)
208: if test -z "$PCRE"; then
209: AC_MSG_ERROR(please specify path to PCRE: --with-pcre=D)
210: else
211: AC_MSG_ERROR($PCRE does not seem to be valid PCRE installation directory)
212: fi
213: )
214: LIBS=$SAVE_LIBS
215: fi
216:
217: AC_SUBST(PCRE_INCLUDES)
218: AC_SUBST(PCRE_LIBS)
219:
220:
221: dnl XML/XSLT argument
222: AC_ARG_WITH(xml,[ --with-xml=D D is the directory where
223: Gnome XML libraries are installed],[
224:
225: XML=$withval
226: XML_LIBS="-lxml2 -lxslt -lexslt"
227:
228: if test -z "$XML" -o "$XML" = "yes"; then
229: XML=""
230: XML_INCLUDES="-I/usr/include/libxml2"
231: AC_MSG_WARN([--with-xml value was not specified, hoping linker would find it])
232: else
233: XML_INCLUDES="-I$XML/include -I$XML/include/libxml2"
1.24 moko 234: XML_LIBS="-L$XML/lib $XML_LIBS"
1.1 moko 235:
236: if test -f $XML/include/libxslt/xslt.h -a -f $XML/lib/libxml2.la \
237: -a -f $XML/lib/libxslt.la -a -f $XML/lib/libexslt.la; then
238: XML_LIBS="$XML/lib/libxml2.la $XML/lib/libxslt.la $XML/lib/libexslt.la"
239: XML_OK="yes"
240: fi
241: fi
242:
243: if test -z "$XML_OK"; then
244: AC_MSG_CHECKING(for xml)
245: SAVE_LIBS=$LIBS
246: LIBS="$LIBS $XML_LIBS $XML_INCLUDES"
247: AC_TRY_LINK([ #include <libxslt/xslt.h> ],[ const char *v=xsltEngineVersion; ],
248: AC_MSG_RESULT(yes)
249: ,
250: AC_MSG_RESULT(no)
251: if test -z "$XML"; then
252: AC_MSG_ERROR(please specify path to Gnome XML libraries: --with-xml=D)
253: else
254: AC_MSG_ERROR($XML does not seem to be valid Gnome XML installation directory)
255: fi
256: )
257: LIBS=$SAVE_LIBS
258: fi
259: AC_DEFINE(XML,,xml-abled parser)
260: ])
261:
262: AC_SUBST(XML_INCLUDES)
263: AC_SUBST(XML_LIBS)
264:
265:
266: dnl Mail receive argument
267: AC_ARG_WITH(mailreceive,[ --with-mailreceive=D is the directory where
268: Gnome MIME library is installed],[
269: MIME=$withval
270: GLIB="glib-2.0"
271: GMIME="gmime-2.4"
272:
273: if test -z "$MIME" -o "$MIME" = "yes"; then
274: MIME=""
275: MIME_INCLUDES=`pkg-config --cflags $GMIME 2>/dev/null`
276: MIME_LIBS=`pkg-config --libs $GMIME 2>/dev/null`
1.26 moko 277: if test -z "$MIME_LIBS"; then
278: GMIME="gmime-3.0"
279: MIME_INCLUDES=`pkg-config --cflags $GMIME 2>/dev/null`
280: MIME_LIBS=`pkg-config --libs $GMIME 2>/dev/null`
281: fi
1.1 moko 282: AC_MSG_WARN([--with-mailreceive value was not specified, hoping linker would find Gnome MIME library])
283: else
284: MIME_INCLUDES="-I$MIME/include/$GMIME"
285: MIME_LIBS="-l$GMIME"
286: if test -f $MIME/include/$GMIME/gmime/gmime.h -a -f $MIME/lib/lib$GMIME.la; then
287: MIME_LIBS="$MIME/lib/lib$GMIME.la"
288: if test -f $MIME/lib/lib$GLIB.la; then
289: MIME_INCLUDES="$MIME_INCLUDES -I$MIME/include/$GLIB -I$MIME/lib/$GLIB/include"
290: else
291: GLIB_INCLUDES=`pkg-config --cflags $GLIB 2>/dev/null`
292: MIME_INCLUDES="$MIME_INCLUDES $GLIB_INCLUDES"
293: fi
294: MIME_OK="yes"
295: fi
296: fi
297:
298: if test -z "$MIME_OK"; then
299: AC_MSG_CHECKING(for mime)
300: SAVE_LIBS=$LIBS
301: LIBS="$LIBS $MIME_LIBS $MIME_INCLUDES"
302: AC_TRY_LINK([ #include <gmime/gmime.h> ],[ guint v=gmime_major_version; ],
303: AC_MSG_RESULT(yes)
304: ,
305: AC_MSG_RESULT(no)
306: if test -z "$MIME"; then
307: AC_MSG_ERROR(please specify path to Gnome MIME library: --with-mailreceive=D)
308: else
309: AC_MSG_ERROR($MIME does not seem to be valid Gnome MIME installation directory)
310: fi
311: )
312: LIBS=$SAVE_LIBS
313: fi
314: AC_DEFINE(WITH_MAILRECEIVE,,has \$mail:received)
315: ])
316:
317: AC_SUBST(MIME_INCLUDES)
318: AC_SUBST(MIME_LIBS)
319:
320:
321: dnl Sendmail argument
322: AC_ARG_WITH(sendmail,[ \"--with-sendmail=COMMAND\" forces this command to send mail.
323: example: \"--with-sendmail=/usr/sbin/sendmail -t\"
324: (makes parser ignore user-defined sendmail commands)],
325: AC_DEFINE_UNQUOTED(PA_FORCED_SENDMAIL,"$withval",parser uses this command instead of user-defined sendmail commands)
326: )
327:
328:
329: dnl Apache module argument
330: AC_ARG_WITH(apache,[ --with-apache=FILE FILE is the full path for APXS
331: builds apache DSO module using apxs],[
332: APXS=$withval
333:
334: if test -z "$APXS" -o "$APXS" = "yes"; then
335: APXS=`which apxs 2>/dev/null`
336: if test -z "$APXS"; then
337: APXS=`which apxs2 2>/dev/null`
338: fi
339: fi
340:
341: APACHE=`$APXS -q TARGET 2>/dev/null`
342:
343: if test -z "$APACHE"; then
344: AC_MSG_ERROR($APXS does not seem to be valid apache apxs utility path)
345: fi
346:
347: APACHE_MAIN_INC=`$APXS -q INCLUDEDIR`
348: APACHE_EXTRA_INC=`$APXS -q EXTRA_INCLUDES 2>/dev/null`
349: APACHE_INC="-I$APACHE_MAIN_INC $APACHE_EXTRA_INC"
350: APACHE_CFLAGS=`$APXS -q CFLAGS`
351: ])
352: AC_SUBST(APACHE)
353: AC_SUBST(APACHE_INC)
354: AC_SUBST(APACHE_CFLAGS)
355: AM_CONDITIONAL(COMPILE_APACHE_MODULE, test -n "$APACHE")
356:
357:
358: dnl Enable building of the convenience library
359: LT_CONFIG_LTDL_DIR(src/lib/ltdl)
360: LT_INIT(dlopen win32-dll no-pic)
361: LTDL_INIT
362:
363:
364: dnl Checks for typedefs, structures, and compiler characteristics
365: AC_C_BIGENDIAN(
366: AC_DEFINE(PA_BIG_ENDIAN,,compile for sparc processor)
367: ,
368: AC_DEFINE(PA_LITTLE_ENDIAN,,compile for intel processor or compatible)
369: ,
370: AC_MSG_ERROR(word endianness not determined for some obscure reason)
371: )
372:
373: AC_TYPE_SIZE_T
374: AC_TYPE_SSIZE_T
375: AC_TYPE_UINT8_T
376: AC_TYPE_UINT16_T
377: AC_TYPE_UINT32_T
378: AC_TYPE_UINT64_T
379:
380: AC_STRUCT_DIRENT_D_TYPE
381:
382: AC_SYS_LARGEFILE
383:
384: dnl Checks for C header files
385: AC_HEADER_STDC
386: AC_HEADER_TIME
387:
388: AC_CHECK_HEADERS(stdio.h sys/types.h sys/stat.h stdlib.h stddef.h memory.h string.h strings.h inttypes.h stdint.h unistd.h)
389: AC_CHECK_HEADERS(assert.h limits.h ctype.h math.h process.h stdarg.h setjmp.h signal.h)
390: AC_CHECK_HEADERS(errno.h dirent.h fcntl.h io.h sys/file.h sys/locking.h sys/select.h sys/resource.h sys/wait.h)
391: AC_CHECK_HEADERS(sys/socket.h netinet/in.h arpa/inet.h netdb.h)
392:
393:
394: dnl Checks for libraries
395: case "$host" in
396: *-freebsd4*)
1.28 moko 397: AC_DEFINE(FREEBSD4,,FreeBSD4.X target platform)
398: ;;
399: *-freebsd1*)
400: AC_DEFINE(FREEBSD1X,,FreeBSD1X.X target platform)
1.1 moko 401: ;;
402: *-sunos5.6* | *-solaris2.6*)
403: AC_CHECK_LIB(xnet, main)
404: ;;
405: *-sunos5* | *-solaris2*)
406: AC_CHECK_LIB(socket, main)
407: AC_CHECK_LIB(nsl, main)
408: ;;
409: *-nec-sysv4*)
410: AC_CHECK_LIB(nsl, gethostbyname)
411: AC_CHECK_LIB(socket, socket)
412: ;;
413: *-cygwin*)
414: AC_DEFINE(WIN32,,Windows32 target platform)
415: ;;
416: esac
417:
418: AC_CHECK_LIB(m, sin)
419: AC_CHECK_LIB(crypt, crypt)
420:
421:
422: dnl Checks for functions
423: AC_CHECK_FUNCS(flock _locking fcntl lockf ftruncate fchmod)
424: AC_CHECK_FUNCS(getrusage gettimeofday crypt sigsetjmp siglongjmp unsetenv)
425:
426:
427: dnl on some linux[seen on 2.4] it's a macro
428: PA_CHECK_SIGSETJMP
429:
430:
431: dnl see comment above
432: AC_LANG_PUSH(C++)
1.19 moko 433: PA_CHECK_MATH_FUNCS_ONE_ARG(trunc round sign isfinite)
1.1 moko 434: AC_LANG_POP
435:
436:
437: dnl We require qsort(3)
438: AC_CHECK_FUNCS(qsort, , AC_MSG_ERROR([No qsort library function.]))
439:
440:
441: dnl For build-in date implementation we need to know local offset from GMT
442:
443: AC_LANG_PUSH(C++)
444: AC_MSG_CHECKING(for timezone variable)
445: AC_TRY_COMPILE([#include <time.h>], [int test=timezone;], AC_DEFINE(HAVE_TIMEZONE) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
446: AC_LANG_POP
447:
448: AC_MSG_CHECKING(for tm_gmtoff in struct tm)
449: AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff=0;], AC_DEFINE(HAVE_TM_GMTOFF) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
450:
451: AC_MSG_CHECKING(for tm_tzadj in struct tm)
452: AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj=0;], AC_DEFINE(HAVE_TM_TZADJ) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
453:
454: AC_MSG_CHECKING(for 0..9999 year date range support)
455: AC_TRY_RUN([
456: #include <string.h>
457: #include <time.h>
458:
459: int main() {
460: struct tm tmL,tmH;
461: memset(&tmL, 0, sizeof(tmL));
462: memset(&tmH, 0, sizeof(tmH));
463: tmL.tm_year=-1900;
464: tmL.tm_mon=-1;
465: tmH.tm_year=9999-1900;
466: tmH.tm_mon=12-1;
467: tmH.tm_mday=31;
468: return mktime(&tmL)==-1 || mktime(&tmH)==-1;
469: }
470: ], AC_DEFINE(PA_DATE64) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), AC_MSG_RESULT(no))
471:
472: dnl Output header and makefiles
473: AH_TEMPLATE([HAVE_TIMEZONE],[Define if you have timezone external variable in <time.h>])
474: AH_TEMPLATE([HAVE_TM_GMTOFF],[Define if you have tm_gmtoff member of tm structure in <time.h>])
475: AH_TEMPLATE([HAVE_TM_TZADJ],[Define if you have tm_tzadj member of tm structure in <time.h>])
476: AH_TEMPLATE([PA_DATE64],[Define if you have 0..9999 year date range support])
477:
478: AM_CONFIG_HEADER(src/include/pa_config_auto.h)
479:
480: AC_OUTPUT(
481: Makefile
482: src/Makefile
483: src/types/Makefile
484: src/classes/Makefile
485: src/include/Makefile
486: src/main/Makefile
487: src/sql/Makefile
488: src/lib/Makefile
489: src/lib/gd/Makefile
490: src/lib/smtp/Makefile
491: src/lib/gc/Makefile
492: src/lib/gc/include/Makefile
493: src/lib/pcre/Makefile
494: src/lib/cord/Makefile
495: src/lib/cord/include/Makefile
496: src/lib/cord/include/private/Makefile
497: src/lib/md5/Makefile
498: src/lib/sdbm/Makefile
499: src/lib/sdbm/pa-include/Makefile
500: src/lib/json/Makefile
501: src/lib/curl/Makefile
502: src/lib/punycode/Makefile
503: src/lib/memcached/Makefile
1.30 moko 504: src/lib/httpd/Makefile
1.1 moko 505: src/targets/Makefile
506: src/targets/cgi/Makefile
507: src/targets/apache/Makefile
508: src/targets/isapi/Makefile
509: etc/Makefile
510: etc/parser3.charsets/Makefile
511: bin/Makefile
512: bin/auto.p.dist)
E-mail: