Annotation of parser3/configure.ac, revision 1.12
1.1 moko 1: dnl Autoconf initialisation
2: AC_PREREQ(2.59)
1.12 ! moko 3: AC_INIT(parser, 3.4.5rc)
1.1 moko 4: AC_CONFIG_SRCDIR(README)
5:
6:
7: dnl Automake Initialisation
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.9 moko 67: AC_ARG_WITH(coverage, [ --with-coverage to enable gcov code coverage support],
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:
76: AC_ARG_WITH(profiler, [ --with-profiler to enable gprof code profiler support],
77: AC_MSG_WARN(enabling gprof support)
78: CFLAGS="$CFLAGS -pg"
79: CXXFLAGS="$CXXFLAGS -pg"
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
121: AC_ARG_ENABLE(stringstream, [ --disable-stringstream to disable stringstream usage.
122: when disabled table.save use more memory but it's safer on freebsd 4.x],
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
185: PCRE_LIBS="-L$PCRE -lpcre"
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"
234:
235: if test -f $XML/include/libxslt/xslt.h -a -f $XML/lib/libxml2.la \
236: -a -f $XML/lib/libxslt.la -a -f $XML/lib/libexslt.la; then
237: XML_LIBS="$XML/lib/libxml2.la $XML/lib/libxslt.la $XML/lib/libexslt.la"
238: XML_OK="yes"
239: fi
240: fi
241:
242: if test -z "$XML_OK"; then
243: AC_MSG_CHECKING(for xml)
244: SAVE_LIBS=$LIBS
245: LIBS="$LIBS $XML_LIBS $XML_INCLUDES"
246: AC_TRY_LINK([ #include <libxslt/xslt.h> ],[ const char *v=xsltEngineVersion; ],
247: AC_MSG_RESULT(yes)
248: ,
249: AC_MSG_RESULT(no)
250: if test -z "$XML"; then
251: AC_MSG_ERROR(please specify path to Gnome XML libraries: --with-xml=D)
252: else
253: AC_MSG_ERROR($XML does not seem to be valid Gnome XML installation directory)
254: fi
255: )
256: LIBS=$SAVE_LIBS
257: fi
258: AC_DEFINE(XML,,xml-abled parser)
259: ])
260:
261: AC_SUBST(XML_INCLUDES)
262: AC_SUBST(XML_LIBS)
263:
264:
265: dnl Mail receive argument
266: AC_ARG_WITH(mailreceive,[ --with-mailreceive=D is the directory where
267: Gnome MIME library is installed],[
268: MIME=$withval
269: GLIB="glib-2.0"
270: GMIME="gmime-2.4"
271:
272: if test -z "$MIME" -o "$MIME" = "yes"; then
273: MIME=""
274: MIME_INCLUDES=`pkg-config --cflags $GMIME 2>/dev/null`
275: MIME_LIBS=`pkg-config --libs $GMIME 2>/dev/null`
276: AC_MSG_WARN([--with-mailreceive value was not specified, hoping linker would find Gnome MIME library])
277: else
278: MIME_INCLUDES="-I$MIME/include/$GMIME"
279: MIME_LIBS="-l$GMIME"
280: if test -f $MIME/include/$GMIME/gmime/gmime.h -a -f $MIME/lib/lib$GMIME.la; then
281: MIME_LIBS="$MIME/lib/lib$GMIME.la"
282: if test -f $MIME/lib/lib$GLIB.la; then
283: MIME_INCLUDES="$MIME_INCLUDES -I$MIME/include/$GLIB -I$MIME/lib/$GLIB/include"
284: else
285: GLIB_INCLUDES=`pkg-config --cflags $GLIB 2>/dev/null`
286: MIME_INCLUDES="$MIME_INCLUDES $GLIB_INCLUDES"
287: fi
288: MIME_OK="yes"
289: fi
290: fi
291:
292: if test -z "$MIME_OK"; then
293: AC_MSG_CHECKING(for mime)
294: SAVE_LIBS=$LIBS
295: LIBS="$LIBS $MIME_LIBS $MIME_INCLUDES"
296: AC_TRY_LINK([ #include <gmime/gmime.h> ],[ guint v=gmime_major_version; ],
297: AC_MSG_RESULT(yes)
298: ,
299: AC_MSG_RESULT(no)
300: if test -z "$MIME"; then
301: AC_MSG_ERROR(please specify path to Gnome MIME library: --with-mailreceive=D)
302: else
303: AC_MSG_ERROR($MIME does not seem to be valid Gnome MIME installation directory)
304: fi
305: )
306: LIBS=$SAVE_LIBS
307: fi
308: AC_DEFINE(WITH_MAILRECEIVE,,has \$mail:received)
309: ])
310:
311: AC_SUBST(MIME_INCLUDES)
312: AC_SUBST(MIME_LIBS)
313:
314:
315: dnl Sendmail argument
316: AC_ARG_WITH(sendmail,[ \"--with-sendmail=COMMAND\" forces this command to send mail.
317: example: \"--with-sendmail=/usr/sbin/sendmail -t\"
318: (makes parser ignore user-defined sendmail commands)],
319: AC_DEFINE_UNQUOTED(PA_FORCED_SENDMAIL,"$withval",parser uses this command instead of user-defined sendmail commands)
320: )
321:
322:
323: dnl Apache module argument
324: AC_ARG_WITH(apache,[ --with-apache=FILE FILE is the full path for APXS
325: builds apache DSO module using apxs],[
326: APXS=$withval
327:
328: if test -z "$APXS" -o "$APXS" = "yes"; then
329: APXS=`which apxs 2>/dev/null`
330: if test -z "$APXS"; then
331: APXS=`which apxs2 2>/dev/null`
332: fi
333: fi
334:
335: APACHE=`$APXS -q TARGET 2>/dev/null`
336:
337: if test -z "$APACHE"; then
338: AC_MSG_ERROR($APXS does not seem to be valid apache apxs utility path)
339: fi
340:
341: APACHE_MAIN_INC=`$APXS -q INCLUDEDIR`
342: APACHE_EXTRA_INC=`$APXS -q EXTRA_INCLUDES 2>/dev/null`
343: APACHE_INC="-I$APACHE_MAIN_INC $APACHE_EXTRA_INC"
344: APACHE_CFLAGS=`$APXS -q CFLAGS`
345: ])
346: AC_SUBST(APACHE)
347: AC_SUBST(APACHE_INC)
348: AC_SUBST(APACHE_CFLAGS)
349: AM_CONDITIONAL(COMPILE_APACHE_MODULE, test -n "$APACHE")
350:
351:
352: dnl Enable building of the convenience library
353: LT_CONFIG_LTDL_DIR(src/lib/ltdl)
354: LT_INIT(dlopen win32-dll no-pic)
355: LTDL_INIT
356:
357:
358: dnl Checks for typedefs, structures, and compiler characteristics
359: AC_C_BIGENDIAN(
360: AC_DEFINE(PA_BIG_ENDIAN,,compile for sparc processor)
361: ,
362: AC_DEFINE(PA_LITTLE_ENDIAN,,compile for intel processor or compatible)
363: ,
364: AC_MSG_ERROR(word endianness not determined for some obscure reason)
365: )
366:
367: AC_TYPE_SIZE_T
368: AC_TYPE_SSIZE_T
369: AC_TYPE_UINT8_T
370: AC_TYPE_UINT16_T
371: AC_TYPE_UINT32_T
372: AC_TYPE_UINT64_T
373:
374: AC_STRUCT_DIRENT_D_TYPE
375:
376: AC_SYS_LARGEFILE
377:
378: dnl Checks for C header files
379: AC_HEADER_STDC
380: AC_HEADER_TIME
381:
382: 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)
383: AC_CHECK_HEADERS(assert.h limits.h ctype.h math.h process.h stdarg.h setjmp.h signal.h)
384: 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)
385: AC_CHECK_HEADERS(sys/socket.h netinet/in.h arpa/inet.h netdb.h)
386:
387:
388: dnl Checks for libraries
389: case "$host" in
390: *-freebsd4*)
391: AC_DEFINE(FREEBSD4,,FreeBSD4X target platform)
392: ;;
393: *-sunos5.6* | *-solaris2.6*)
394: AC_CHECK_LIB(xnet, main)
395: ;;
396: *-sunos5* | *-solaris2*)
397: AC_CHECK_LIB(socket, main)
398: AC_CHECK_LIB(nsl, main)
399: ;;
400: *-nec-sysv4*)
401: AC_CHECK_LIB(nsl, gethostbyname)
402: AC_CHECK_LIB(socket, socket)
403: ;;
404: *-cygwin*)
405: AC_DEFINE(WIN32,,Windows32 target platform)
406: ;;
407: esac
408:
409: AC_CHECK_LIB(m, sin)
410: AC_CHECK_LIB(crypt, crypt)
411:
412:
413: dnl Checks for functions
414: AC_CHECK_FUNCS(flock _locking fcntl lockf ftruncate fchmod)
415: AC_CHECK_FUNCS(getrusage gettimeofday crypt sigsetjmp siglongjmp unsetenv)
416:
417:
418: dnl on some linux[seen on 2.4] it's a macro
419: PA_CHECK_SIGSETJMP
420:
421:
422: dnl see comment above
423: AC_LANG_PUSH(C++)
424: PA_CHECK_MATH_FUNCS_ONE_ARG(trunc round sign)
425: AC_LANG_POP
426:
427:
428: dnl We require qsort(3)
429: AC_CHECK_FUNCS(qsort, , AC_MSG_ERROR([No qsort library function.]))
430:
431:
432: dnl For build-in date implementation we need to know local offset from GMT
433:
434: AC_LANG_PUSH(C++)
435: AC_MSG_CHECKING(for timezone variable)
436: AC_TRY_COMPILE([#include <time.h>], [int test=timezone;], AC_DEFINE(HAVE_TIMEZONE) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
437: AC_LANG_POP
438:
439: AC_MSG_CHECKING(for tm_gmtoff in struct tm)
440: 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))
441:
442: AC_MSG_CHECKING(for tm_tzadj in struct tm)
443: 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))
444:
445: AC_MSG_CHECKING(for 0..9999 year date range support)
446: AC_TRY_RUN([
447: #include <string.h>
448: #include <time.h>
449:
450: int main() {
451: struct tm tmL,tmH;
452: memset(&tmL, 0, sizeof(tmL));
453: memset(&tmH, 0, sizeof(tmH));
454: tmL.tm_year=-1900;
455: tmL.tm_mon=-1;
456: tmH.tm_year=9999-1900;
457: tmH.tm_mon=12-1;
458: tmH.tm_mday=31;
459: return mktime(&tmL)==-1 || mktime(&tmH)==-1;
460: }
461: ], AC_DEFINE(PA_DATE64) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), AC_MSG_RESULT(no))
462:
463: dnl Output header and makefiles
464: AH_TEMPLATE([HAVE_TIMEZONE],[Define if you have timezone external variable in <time.h>])
465: AH_TEMPLATE([HAVE_TM_GMTOFF],[Define if you have tm_gmtoff member of tm structure in <time.h>])
466: AH_TEMPLATE([HAVE_TM_TZADJ],[Define if you have tm_tzadj member of tm structure in <time.h>])
467: AH_TEMPLATE([PA_DATE64],[Define if you have 0..9999 year date range support])
468:
469: AM_CONFIG_HEADER(src/include/pa_config_auto.h)
470:
471: AC_OUTPUT(
472: Makefile
473: src/Makefile
474: src/types/Makefile
475: src/classes/Makefile
476: src/include/Makefile
477: src/main/Makefile
478: src/sql/Makefile
479: src/lib/Makefile
480: src/lib/gd/Makefile
481: src/lib/smtp/Makefile
482: src/lib/gc/Makefile
483: src/lib/gc/include/Makefile
484: src/lib/pcre/Makefile
485: src/lib/cord/Makefile
486: src/lib/cord/include/Makefile
487: src/lib/cord/include/private/Makefile
488: src/lib/md5/Makefile
489: src/lib/sdbm/Makefile
490: src/lib/sdbm/pa-include/Makefile
491: src/lib/json/Makefile
492: src/lib/curl/Makefile
493: src/lib/punycode/Makefile
494: src/lib/memcached/Makefile
495: src/targets/Makefile
496: src/targets/cgi/Makefile
497: src/targets/apache/Makefile
498: src/targets/isapi/Makefile
499: etc/Makefile
500: etc/parser3.charsets/Makefile
501: bin/Makefile
502: bin/auto.p.dist)
E-mail: