Annotation of parser3/configure.ac, revision 1.97

1.48      moko        1: dnl Autoconf initialization
1.1       moko        2: AC_PREREQ(2.59)
1.69      moko        3: AC_INIT(parser, 3.5.2b)
1.1       moko        4: AC_CONFIG_SRCDIR(README)
1.68      moko        5: AC_CONFIG_MACRO_DIRS(src/lib/ltdl/m4)
1.1       moko        6: 
                      7: 
1.14      moko        8: dnl Automake Initialization
1.1       moko        9: AM_INIT_AUTOMAKE
                     10: 
                     11: 
                     12: dnl Expand srcdir
                     13: P3S=`cd $srcdir/src ; pwd`
                     14: AC_SUBST(P3S)
                     15: 
                     16: 
                     17: dnl Parser version update
                     18: AC_CANONICAL_HOST
                     19: AC_DEFINE_UNQUOTED(PARSER_VERSION,"$VERSION (compiled on $host)",parser version)
                     20: 
                     21: AC_SUBST(host_os)
                     22: case $host_os in
                     23:   *cygwin* ) AC_DEFINE(CYGWIN,,using cygwin building environment);;
                     24: esac
                     25: 
                     26: 
                     27: dnl Checks for programs
                     28: AC_PROG_INSTALL
                     29: AC_PROG_AWK
                     30: 
                     31: AC_PROG_YACC
                     32: if test "$YACC" != "bison -y"; then
                     33:        AC_MSG_WARN(to regenerate Parser grammar YOU WOULD NEED BISON)
                     34: else
                     35:        AC_MSG_CHECKING(bison version)
                     36:        oldIFS=$IFS; IFS=.
                     37:        set `bison -V | sed -e 's/^GNU Bison version //' -e 's/^bison (GNU Bison) //' -e 's/$/./'`
                     38:        IFS=$oldIFS
                     39:        if test "$1" = "1" -a "$2" -lt "25"; then
                     40:                AC_MSG_WARN(Bison 1.25 or newer needed to regenerate Parser compiler (found $1.$2).)
                     41:        fi
                     42:        AC_MSG_RESULT($1.$2 (ok))
                     43: fi
                     44: 
                     45: AC_PROG_CXX
                     46: AC_PROG_CC
                     47: 
                     48: dnl most tests should be compiled with C compiler [especially qsort test]
1.68      moko       49: AC_LANG([C])
1.1       moko       50: 
                     51: 
                     52: dnl Dll extension
                     53: AC_MSG_CHECKING(for dynamic-link library extension)
                     54: case "$host_os" in
                     55:   *cygwin* ) dll_extension=dll;;
                     56:   * ) dll_extension=so
                     57: esac
                     58: AC_MSG_RESULT($dll_extension)
                     59: AC_SUBST(dll_extension)
                     60: 
                     61: 
1.83      moko       62: dnl Checks for libraries
                     63: case "$host" in
                     64:   *-freebsd4*)
                     65:          AC_DEFINE(FREEBSD4,,FreeBSD4.X target platform)
                     66:   ;;
                     67:   *-freebsd1*)
                     68:          AC_DEFINE(FREEBSD1X,,FreeBSD1X.X target platform)
                     69:   ;;
                     70:   *-sunos5.6* | *-solaris2.6*)
                     71:          AC_CHECK_LIB(xnet, main)
                     72:   ;;
                     73:   *-sunos5* | *-solaris2*)
                     74:          AC_CHECK_LIB(socket, main)
                     75:          AC_CHECK_LIB(nsl, main)
                     76:   ;;
                     77:   *-nec-sysv4*)
                     78:          AC_CHECK_LIB(nsl, gethostbyname)
                     79:          AC_CHECK_LIB(socket, socket)
                     80:   ;;
                     81:   *-cygwin*)
                     82:          AC_DEFINE(WIN32,,Windows32 target platform)
                     83:   ;;
                     84: esac
                     85: 
                     86: AC_CHECK_LIB(m, sin)
                     87: AC_CHECK_LIB(crypt, crypt)
1.92      moko       88: AC_SEARCH_LIBS(timer_create, rt)
1.83      moko       89: 
                     90: 
1.1       moko       91: dnl Misc arguments
                     92: AC_ARG_WITH(build-warnings, [  --with-build-warnings   to enable build-time compiler warnings if gcc is used],
                     93:        AC_MSG_WARN(enabling compiler warnings)
1.64      moko       94:        CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2 -Wextra -Wall -Wno-parentheses"
1.1       moko       95: )
                     96: 
1.15      moko       97: AC_ARG_WITH(coverage, [  --with-coverage         to enable gcov code coverage support],
1.9       moko       98:        AC_MSG_WARN(enabling gcov support)
                     99:        CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
                    100:        CXXFLAGS=`echo "$XXCFLAGS" | $SED -e 's/-O[0-9]*//g'`
                    101:        CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
                    102:        CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage"
                    103:        LDFLAGS="$LDFLAGS -lgcov"
                    104: )
                    105: 
1.15      moko      106: AC_ARG_WITH(profiler, [  --with-profiler         to enable gprof code profiler support],
1.9       moko      107:        AC_MSG_WARN(enabling gprof support)
1.24      moko      108:        CFLAGS="$CFLAGS -O0 -pg -g"
                    109:        CXXFLAGS="$CXXFLAGS -O0 -pg -g"
1.9       moko      110: )
                    111: 
1.1       moko      112: AC_ARG_WITH(assertions, [  --with-assertions       to enable assertions],
                    113:        AC_MSG_WARN(enabling assertions)
                    114: ,
                    115:        AC_DEFINE(NDEBUG,,assertions disabled)
                    116: )
                    117: 
1.37      moko      118: AC_ARG_WITH(sjlj-exceptions, [  --with-sjlj-exceptions  to enable simple 'throw' from dynamic library],
1.1       moko      119:        AC_DEFINE(PA_WITH_SJLJ_EXCEPTIONS,,one can throw from dynamic library)
                    120: )
                    121: 
                    122: 
1.37      moko      123: AC_ARG_WITH(system-cfg, [  --with-system-cfg=FILE  to specify system-wide auto.p],
                    124:        AC_DEFINE_UNQUOTED(SYSTEM_CONFIG_FILE,"$withval",system-wide auto.p)
1.35      moko      125: )
                    126: 
                    127: 
1.1       moko      128: dnl Safe mode argument
                    129: AC_ARG_ENABLE(safe-mode, [  --disable-safe-mode          to enable reading and executing
                    130:                           files belonging to group+user other then effective],
                    131: [
                    132:        SAFE_MODE=$enableval
                    133: ]
                    134: )
                    135: 
                    136: if test "$SAFE_MODE" = "no"; then
                    137:        AC_MSG_WARN(enabling reading of files belonging to group+user other then effective)
                    138: else
                    139:        AC_DEFINE(PA_SAFE_MODE,,disabled reading of files belonging to group+user other then effective)
                    140: fi
                    141: 
                    142: 
                    143: dnl Disable execs argument
                    144: AC_ARG_ENABLE(execs, [  --disable-execs          to disable any execs
                    145:                           (file::exec, file::cgi, unix mail:send)],
                    146: [
                    147: if test "$enableval" = "no"; then
                    148:        AC_MSG_WARN(disabling file execs)
                    149:        AC_DEFINE(NO_PA_EXECS,,pa_exec disabled)
                    150: fi
                    151: ]
                    152: )
                    153: 
                    154: 
                    155: dnl String stream argument
1.28      moko      156: AC_ARG_ENABLE(stringstream, [  --disable-stringstream to disable stringstream usage.
                    157:                           when disabled table.save uses more memory, but more compilers are supported],
1.1       moko      158: [
                    159: if test "$enableval" = "no"; then
                    160:        AC_MSG_WARN(disabling stringstream usage)
                    161:        AC_DEFINE(NO_STRINGSTREAM,,stringstream disabled)
                    162: fi
                    163: ]
                    164: )
                    165: 
                    166: 
                    167: dnl GC argument
1.35      moko      168: AC_ARG_WITH(gc,[  --with-gc[=DIR]           DIR is the directory where
1.1       moko      169:                           Boehm garbage collecting library is installed],[
                    170: 
                    171:        GC=$withval
                    172:        GC_LIBS="$GC/libgc.la"
                    173: 
                    174:        if test -f $GC_LIBS; then
                    175:                GC_OK="yes"
                    176:        else
                    177:                GC_LIBS="-L$GC -lgc"
                    178:        fi
                    179: 
                    180:        if test "$GC" = "yes"; then
                    181:                GC=""
                    182:                GC_LIBS="-lgc"
                    183:                AC_MSG_WARN([--with-gc value was not specified, hoping linker would find it])
                    184:        fi
                    185: ],[
                    186:        GC_LIBS="-lgc"
                    187:        AC_MSG_WARN([--with-gc was not specified, hoping linker would find it])
                    188: ])
                    189: 
                    190: if test -z "$GC_OK"; then
                    191:        AC_MSG_CHECKING(for libgc)
                    192:        SAVE_LIBS=$LIBS
                    193:        LIBS="$LIBS $GC_LIBS"
1.68      moko      194:        PA_TRY_LINK([ extern int GC_dont_gc; ],[ GC_dont_gc=0; ],
1.1       moko      195:                AC_MSG_RESULT(yes)
                    196:        ,
                    197:                AC_MSG_RESULT(no)
                    198:                if test -z "$GC"; then
1.35      moko      199:                        AC_MSG_ERROR(please specify path to libgc: --with-gc=DIR)
1.1       moko      200:                else
                    201:                        AC_MSG_ERROR($GC does not seem to be valid libgc installation directory)
                    202:                fi
                    203:        )
                    204:        LIBS=$SAVE_LIBS
                    205: fi
                    206: 
                    207: AC_SUBST(GC_LIBS)
                    208: 
                    209: 
                    210: dnl PCRE argument
1.35      moko      211: AC_ARG_WITH(pcre,[  --with-pcre=DIR         DIR is the directory where
1.1       moko      212:                           PCRE library is installed],[
                    213:        PCRE=$withval
                    214: 
                    215:        if test "$PCRE" = "yes"; then
                    216:                PCRE=""
                    217:                AC_MSG_WARN([--with-pcre value was not specified, hoping linker would find it])
1.55      moko      218:        else
                    219:                PCRE_INCLUDES="-I$PCRE/include"
                    220: 
                    221:                if test -f $PCRE/include/pcre.h -a -f $PCRE/lib/libpcre.la; then
                    222:                        PCRE_OK="yes"
                    223:                        PCRE_LIBS="$PCRE/lib/libpcre.la"
                    224:                else
                    225:                        if test -f $PCRE/include/pcre2.h -a -f $PCRE/lib/libpcre2-8.la; then
                    226:                                PCRE_OK="yes"
                    227:                                PCRE_LIBS="$PCRE/lib/libpcre2-8.la"
                    228:                                AC_DEFINE(HAVE_PCRE2,,PCRE2 is available)
                    229:                        else
                    230:                                PCRE_LIBS="-L$PCRE/lib"
                    231:                        fi
                    232:                fi
1.1       moko      233:        fi
                    234: ],[
                    235:        AC_MSG_WARN([--with-pcre was not specified, hoping linker would find it])
                    236: ])
                    237: 
                    238: if test -z "$PCRE_OK"; then
1.55      moko      239:        AC_MSG_CHECKING(for pcre2)
                    240:        SAVE_LIBS=$LIBS
                    241:        LIBS="$LIBS $PCRE_LIBS $PCRE_INCLUDES -lpcre2-8"
1.68      moko      242:        PA_TRY_LINK([ #define PCRE2_CODE_UNIT_WIDTH 8
1.55      moko      243: #include <pcre2.h> ],[ void *v=pcre2_general_context_create(0,0,0); ],
                    244:                AC_MSG_RESULT(yes)
                    245:                PCRE_LIBS="$PCRE_LIBS -lpcre2-8"
                    246:                AC_DEFINE(HAVE_PCRE2,,PCRE2 is available)
                    247:                PCRE_OK="yes"
                    248:        ,
                    249:                AC_MSG_RESULT(no)
                    250:        )
                    251:        LIBS=$SAVE_LIBS
                    252: fi
                    253: 
                    254: if test -z "$PCRE_OK"; then
                    255:        AC_MSG_CHECKING(for pcre)
                    256:        PCRE_LIBS="$PCRE_LIBS -lpcre"
1.1       moko      257:        SAVE_LIBS=$LIBS
                    258:        LIBS="$LIBS $PCRE_LIBS $PCRE_INCLUDES"
1.68      moko      259:        PA_TRY_LINK([ #include <pcre.h> ],[ const char *v=pcre_version(); ],
1.1       moko      260:                AC_MSG_RESULT(yes)
                    261:        ,
                    262:                AC_MSG_RESULT(no)
                    263:                if test -z "$PCRE"; then
1.35      moko      264:                        AC_MSG_ERROR(please specify path to PCRE: --with-pcre=DIR)
1.1       moko      265:                else
                    266:                        AC_MSG_ERROR($PCRE does not seem to be valid PCRE installation directory)
                    267:                fi
                    268:        )
                    269:        LIBS=$SAVE_LIBS
                    270: fi
                    271: 
                    272: AC_SUBST(PCRE_INCLUDES)
                    273: AC_SUBST(PCRE_LIBS)
                    274: 
                    275: 
                    276: dnl XML/XSLT argument
1.35      moko      277: AC_ARG_WITH(xml,[  --with-xml=DIR          DIR is the directory where
1.1       moko      278:                           Gnome XML libraries are installed],[
                    279: 
                    280:        XML=$withval
                    281:        XML_LIBS="-lxml2 -lxslt -lexslt"
                    282: 
                    283:        if test -z "$XML" -o "$XML" = "yes"; then
                    284:                XML=""
                    285:                XML_INCLUDES="-I/usr/include/libxml2"
                    286:                AC_MSG_WARN([--with-xml value was not specified, hoping linker would find it])
                    287:        else
                    288:                XML_INCLUDES="-I$XML/include -I$XML/include/libxml2"
1.24      moko      289:                XML_LIBS="-L$XML/lib $XML_LIBS"
1.1       moko      290: 
                    291:                if test -f $XML/include/libxslt/xslt.h -a -f $XML/lib/libxml2.la \
                    292:                        -a -f $XML/lib/libxslt.la -a -f $XML/lib/libexslt.la; then
                    293:                        XML_LIBS="$XML/lib/libxml2.la $XML/lib/libxslt.la $XML/lib/libexslt.la"
                    294:                        XML_OK="yes"
                    295:                fi
                    296:        fi
                    297: 
                    298:        if test -z "$XML_OK"; then
                    299:                AC_MSG_CHECKING(for xml)
                    300:                SAVE_LIBS=$LIBS
                    301:                LIBS="$LIBS $XML_LIBS $XML_INCLUDES"
1.68      moko      302:                PA_TRY_LINK([ #include <libxslt/xslt.h> ],[ const char *v=xsltEngineVersion; ],
1.1       moko      303:                        AC_MSG_RESULT(yes)
                    304:                ,
                    305:                        AC_MSG_RESULT(no)
                    306:                        if test -z "$XML"; then
1.35      moko      307:                                AC_MSG_ERROR(please specify path to Gnome XML libraries: --with-xml=DIR)
1.1       moko      308:                        else
                    309:                                AC_MSG_ERROR($XML does not seem to be valid Gnome XML installation directory)
                    310:                        fi
                    311:                )
                    312:                LIBS=$SAVE_LIBS
                    313:        fi
                    314:        AC_DEFINE(XML,,xml-abled parser)
                    315: ])
                    316: 
                    317: AC_SUBST(XML_INCLUDES)
                    318: AC_SUBST(XML_LIBS)
                    319: 
                    320: 
                    321: dnl Mail receive argument
1.35      moko      322: AC_ARG_WITH(mailreceive,[  --with-mailreceive=DIR  is the directory where
1.1       moko      323:                           Gnome MIME library is installed],[
                    324:        MIME=$withval
                    325:        GLIB="glib-2.0"
                    326:        GMIME="gmime-2.4"
                    327: 
                    328:        if test -z "$MIME" -o "$MIME" = "yes"; then
                    329:                MIME=""
                    330:                MIME_INCLUDES=`pkg-config --cflags $GMIME 2>/dev/null`
                    331:                MIME_LIBS=`pkg-config --libs $GMIME 2>/dev/null`
1.26      moko      332:                if test -z "$MIME_LIBS"; then
                    333:                        GMIME="gmime-3.0"
                    334:                        MIME_INCLUDES=`pkg-config --cflags $GMIME 2>/dev/null`
                    335:                        MIME_LIBS=`pkg-config --libs $GMIME 2>/dev/null`
                    336:                fi
1.1       moko      337:                AC_MSG_WARN([--with-mailreceive value was not specified, hoping linker would find Gnome MIME library])
                    338:        else
                    339:                MIME_INCLUDES="-I$MIME/include/$GMIME"
                    340:                MIME_LIBS="-l$GMIME"
                    341:                if test -f $MIME/include/$GMIME/gmime/gmime.h -a -f $MIME/lib/lib$GMIME.la; then
                    342:                        MIME_LIBS="$MIME/lib/lib$GMIME.la"
                    343:                        if test -f $MIME/lib/lib$GLIB.la; then
                    344:                                MIME_INCLUDES="$MIME_INCLUDES -I$MIME/include/$GLIB -I$MIME/lib/$GLIB/include"
                    345:                        else
                    346:                                GLIB_INCLUDES=`pkg-config --cflags $GLIB 2>/dev/null`
                    347:                                MIME_INCLUDES="$MIME_INCLUDES $GLIB_INCLUDES"
                    348:                        fi
                    349:                        MIME_OK="yes"
                    350:                fi
                    351:        fi
                    352: 
                    353:        if test -z "$MIME_OK"; then
                    354:                AC_MSG_CHECKING(for mime)
                    355:                SAVE_LIBS=$LIBS
                    356:                LIBS="$LIBS $MIME_LIBS $MIME_INCLUDES"
1.68      moko      357:                PA_TRY_LINK([ #include <gmime/gmime.h> ],[ guint v=gmime_major_version; ],
1.1       moko      358:                        AC_MSG_RESULT(yes)
                    359:                ,
                    360:                        AC_MSG_RESULT(no)
                    361:                        if test -z "$MIME"; then
1.35      moko      362:                                AC_MSG_ERROR(please specify path to Gnome MIME library: --with-mailreceive=DIR)
1.1       moko      363:                        else
                    364:                                AC_MSG_ERROR($MIME does not seem to be valid Gnome MIME installation directory)
                    365:                        fi
                    366:                )
                    367:                LIBS=$SAVE_LIBS
                    368:        fi
                    369:        AC_DEFINE(WITH_MAILRECEIVE,,has \$mail:received)
                    370: ])
                    371: 
                    372: AC_SUBST(MIME_INCLUDES)
                    373: AC_SUBST(MIME_LIBS)
                    374: 
                    375: 
1.71      moko      376: dnl RabbitMQ library argument
                    377: AC_ARG_WITH(amqp,[  --with-amqp=DIR         DIR is the directory where
                    378:                           RabbitMQ C library (librabbitmq) is installed],[
                    379:     AMQP=$withval
                    380: 
                    381:     if test -z "$AMQP" -o "$AMQP" = "yes"; then
                    382:         AMQP_INCLUDES=""
                    383:         AMQP_LIBS="-lrabbitmq"
                    384:         AC_MSG_WARN([--with-amqp value was not specified, hoping linker would find it])
1.87      moko      385: 
                    386:         dnl SSL with the system librabbitmq only: it brings OpenSSL as its dependency
                    387:         AC_CHECK_HEADER([amqp_ssl_socket.h],[AC_DEFINE([WITH_AMQP_SSL],,[librabbitmq with SSL support])])
1.71      moko      388:     else
                    389:         AMQP_INCLUDES="-I$AMQP/include"
1.89      moko      390:         if test -f $AMQP/lib/librabbitmq.a; then
                    391:             AMQP_LIBS="$AMQP/lib/librabbitmq.a"
1.71      moko      392:         else
                    393:             AMQP_LIBS="-L$AMQP/lib -lrabbitmq"
                    394:         fi
                    395:     fi
                    396: 
                    397:     AC_MSG_CHECKING(for librabbitmq)
                    398:     SAVE_LIBS=$LIBS
1.83      moko      399:     LIBS="$AMQP_LIBS $AMQP_INCLUDES $LIBS"
1.71      moko      400:     PA_TRY_LINK([ #include <amqp.h> ],[ amqp_connection_state_t c = 0; ],
                    401:         AC_MSG_RESULT(yes)
                    402:     ,
                    403:         AC_MSG_RESULT(no)
                    404:         if test -z "$AMQP"; then
                    405:             AC_MSG_ERROR(please specify path to librabbitmq: --with-amqp=DIR)
                    406:         else
                    407:             AC_MSG_ERROR($AMQP does not seem to be valid librabbitmq installation directory)
                    408:         fi
                    409:     )
                    410:     LIBS=$SAVE_LIBS
                    411:     AC_DEFINE(WITH_AMQP,,has amqp)
                    412: ])
                    413: 
                    414: AC_SUBST(AMQP_INCLUDES)
                    415: AC_SUBST(AMQP_LIBS)
                    416: 
1.77      moko      417: 
                    418: dnl Redis library argument
                    419: AC_ARG_WITH(redis,[  --with-redis=DIR        DIR is the directory where
                    420:                           Redis C library (hiredis) is installed],[
                    421:     REDIS=$withval
                    422: 
                    423:     if test -z "$REDIS" -o "$REDIS" = "yes"; then
                    424:         REDIS_INCLUDES=""
                    425:         REDIS_LIBS="-lhiredis"
                    426:         AC_MSG_WARN([--with-redis value was not specified, hoping linker would find it])
1.85      moko      427: 
1.87      moko      428:         dnl SSL with the system hiredis_ssl only: it brings OpenSSL as its dependency
1.85      moko      429:         AC_CHECK_HEADER([hiredis/hiredis_ssl.h],[
                    430:             AC_DEFINE(WITH_REDIS_SSL,,hiredis with SSL support)
                    431:             REDIS_LIBS="-lhiredis_ssl $REDIS_LIBS"
                    432:         ],,[#include <hiredis/hiredis.h>])
1.77      moko      433:     else
                    434:         REDIS_INCLUDES="-I$REDIS/include"
1.81      moko      435:         if test -f $REDIS/lib/libhiredis.a; then
                    436:             REDIS_LIBS="$REDIS/lib/libhiredis.a"
1.77      moko      437:         else
                    438:             REDIS_LIBS="-L$REDIS/lib -lhiredis"
                    439:         fi
                    440:     fi
                    441: 
                    442:     AC_MSG_CHECKING(for hiredis)
                    443:     SAVE_LIBS=$LIBS
1.83      moko      444:     LIBS="$REDIS_LIBS $REDIS_INCLUDES $LIBS"
1.77      moko      445:     PA_TRY_LINK([ #include <hiredis/hiredis.h> ],[ redisContext *c = redisConnect("", 0); ],
                    446:         AC_MSG_RESULT(yes)
                    447:     ,
                    448:         AC_MSG_RESULT(no)
                    449:         if test -z "$REDIS"; then
                    450:             AC_MSG_ERROR(please specify path to hiredis: --with-redis=DIR)
                    451:         else
                    452:             AC_MSG_ERROR($REDIS does not seem to be valid hiredis installation directory)
                    453:         fi
                    454:     )
                    455:     LIBS=$SAVE_LIBS
                    456:     AC_DEFINE(WITH_REDIS,,has redis)
                    457: ])
                    458: 
                    459: AC_SUBST(REDIS_INCLUDES)
                    460: AC_SUBST(REDIS_LIBS)
                    461: 
1.1       moko      462: dnl Sendmail argument
                    463: AC_ARG_WITH(sendmail,[  \"--with-sendmail=COMMAND\" forces this command to send mail.
                    464:                           example: \"--with-sendmail=/usr/sbin/sendmail -t\"
                    465:                           (makes parser ignore user-defined sendmail commands)],
                    466:        AC_DEFINE_UNQUOTED(PA_FORCED_SENDMAIL,"$withval",parser uses this command instead of user-defined sendmail commands)
                    467: )
                    468: 
                    469: 
                    470: dnl Apache module argument
                    471: AC_ARG_WITH(apache,[  --with-apache=FILE      FILE is the full path for APXS
                    472:                           builds apache DSO module using apxs],[
                    473:        APXS=$withval
                    474: 
                    475:        if test -z "$APXS" -o "$APXS" = "yes"; then
                    476:                APXS=`which apxs 2>/dev/null`
                    477:                if test -z "$APXS"; then
                    478:                        APXS=`which apxs2 2>/dev/null`
                    479:                fi
                    480:        fi
                    481: 
                    482:        APACHE=`$APXS -q TARGET 2>/dev/null`
                    483: 
                    484:        if test -z "$APACHE"; then
                    485:                AC_MSG_ERROR($APXS does not seem to be valid apache apxs utility path)
                    486:        fi
                    487: 
                    488:        APACHE_MAIN_INC=`$APXS -q INCLUDEDIR`
                    489:        APACHE_EXTRA_INC=`$APXS -q EXTRA_INCLUDES 2>/dev/null`
                    490:        APACHE_INC="-I$APACHE_MAIN_INC $APACHE_EXTRA_INC"
                    491:        APACHE_CFLAGS=`$APXS -q CFLAGS`
                    492: ])
                    493: AC_SUBST(APACHE)
                    494: AC_SUBST(APACHE_INC)
                    495: AC_SUBST(APACHE_CFLAGS)
                    496: AM_CONDITIONAL(COMPILE_APACHE_MODULE, test -n "$APACHE")
                    497: 
                    498: 
                    499: dnl Enable building of the convenience library
                    500: LT_CONFIG_LTDL_DIR(src/lib/ltdl)
                    501: LT_INIT(dlopen win32-dll no-pic)
                    502: LTDL_INIT
                    503: 
                    504: 
                    505: dnl Checks for typedefs, structures, and compiler characteristics
                    506: AC_C_BIGENDIAN(
                    507:        AC_DEFINE(PA_BIG_ENDIAN,,compile for sparc processor)
                    508: ,
                    509:        AC_DEFINE(PA_LITTLE_ENDIAN,,compile for intel processor or compatible)
                    510: ,
                    511:        AC_MSG_ERROR(word endianness not determined for some obscure reason)
                    512: )
                    513: 
                    514: AC_TYPE_SIZE_T
                    515: AC_TYPE_SSIZE_T
                    516: AC_TYPE_UINT8_T
                    517: AC_TYPE_UINT16_T
                    518: AC_TYPE_UINT32_T
                    519: AC_TYPE_UINT64_T
1.73      moko      520: AC_TYPE_INT64_T
1.1       moko      521: 
                    522: AC_STRUCT_DIRENT_D_TYPE
                    523: 
                    524: AC_SYS_LARGEFILE
                    525: 
                    526: dnl Checks for C header files
                    527: 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)
1.68      moko      528: AC_CHECK_HEADERS(time.h sys/time.h assert.h limits.h ctype.h math.h process.h stdarg.h setjmp.h signal.h pthread.h)
1.1       moko      529: 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)
                    530: AC_CHECK_HEADERS(sys/socket.h netinet/in.h arpa/inet.h netdb.h)
                    531: 
                    532: 
                    533: dnl Checks for functions
1.59      moko      534: AC_CHECK_FUNCS(flock fcntl lockf ftruncate fchmod)
1.66      moko      535: AC_CHECK_FUNCS(getrusage gettimeofday crypt sigsetjmp siglongjmp unsetenv syslog)
1.1       moko      536: 
                    537: 
                    538: dnl on some linux[seen on 2.4] it's a macro
                    539: PA_CHECK_SIGSETJMP
                    540: 
                    541: 
                    542: dnl see comment above
                    543: AC_LANG_PUSH(C++)
1.19      moko      544: PA_CHECK_MATH_FUNCS_ONE_ARG(trunc round sign isfinite)
1.1       moko      545: AC_LANG_POP
                    546: 
                    547: 
                    548: dnl We require qsort(3)
                    549: AC_CHECK_FUNCS(qsort, , AC_MSG_ERROR([No qsort library function.]))
                    550: 
                    551: 
                    552: dnl For build-in date implementation we need to know local offset from GMT
                    553: 
                    554: AC_LANG_PUSH(C++)
                    555: AC_MSG_CHECKING(for timezone variable)
1.68      moko      556: PA_TRY_COMPILE([#include <time.h>], [int test=timezone;], AC_DEFINE(HAVE_TIMEZONE) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1.1       moko      557: AC_LANG_POP
                    558: 
                    559: AC_MSG_CHECKING(for tm_gmtoff in struct tm)
1.68      moko      560: PA_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))
1.1       moko      561: 
                    562: AC_MSG_CHECKING(for tm_tzadj in struct tm)
1.68      moko      563: PA_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))
1.1       moko      564: 
1.41      moko      565: AC_MSG_CHECKING(for gettid)
1.68      moko      566: PA_TRY_COMPILE([
1.41      moko      567: #include <sys/types.h>
1.91      moko      568: #include <unistd.h>
1.41      moko      569: #include <sys/syscall.h>
                    570: ], [uint tid=syscall(__NR_gettid);], AC_DEFINE(HAVE_GETTID) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
                    571: 
1.96      moko      572: AC_MSG_CHECKING(for thr_self)
                    573: PA_TRY_LINK([
                    574: #include <sys/types.h>
                    575: #include <sys/thr.h>
                    576: ], [long tid; thr_self(&tid);], AC_DEFINE(HAVE_THR_SELF) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1.94      moko      577: 
1.45      moko      578: AC_MSG_CHECKING(for TLS)
1.68      moko      579: PA_TRY_COMPILE([__thread int i=0;], [], AC_DEFINE(HAVE_TLS) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
1.45      moko      580: 
1.1       moko      581: AC_MSG_CHECKING(for 0..9999 year date range support)
1.68      moko      582: AC_RUN_IFELSE([AC_LANG_SOURCE([
1.1       moko      583: #include <string.h>
                    584: #include <time.h>
                    585: 
                    586: int main() {
                    587:        struct tm tmL,tmH;
                    588:        memset(&tmL, 0, sizeof(tmL));
                    589:        memset(&tmH, 0, sizeof(tmH));
                    590:        tmL.tm_year=-1900;
                    591:        tmL.tm_mon=-1;
                    592:        tmH.tm_year=9999-1900;
                    593:        tmH.tm_mon=12-1;
                    594:        tmH.tm_mday=31;
                    595:        return mktime(&tmL)==-1 || mktime(&tmH)==-1;
                    596: }
1.68      moko      597: ])], AC_DEFINE(PA_DATE64) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), AC_MSG_RESULT(no))
1.1       moko      598: 
                    599: dnl Output header and makefiles
                    600: AH_TEMPLATE([HAVE_TIMEZONE],[Define if you have timezone external variable in <time.h>])
                    601: AH_TEMPLATE([HAVE_TM_GMTOFF],[Define if you have tm_gmtoff member of tm structure in <time.h>])
                    602: AH_TEMPLATE([HAVE_TM_TZADJ],[Define if you have tm_tzadj member of tm structure in <time.h>])
1.41      moko      603: AH_TEMPLATE([HAVE_GETTID],[Define if you have gettid()])
1.96      moko      604: AH_TEMPLATE([HAVE_THR_SELF],[Define if you have thr_self() (FreeBSD)])
1.45      moko      605: AH_TEMPLATE([HAVE_TLS],[Define if you have Thread-Local Storage])
1.1       moko      606: AH_TEMPLATE([PA_DATE64],[Define if you have 0..9999 year date range support])
                    607: 
1.68      moko      608: AC_CONFIG_HEADERS(src/include/pa_config_auto.h)
1.1       moko      609: 
1.68      moko      610: AC_CONFIG_FILES([
                    611:        Makefile
                    612:        src/Makefile
                    613:        src/types/Makefile
                    614:        src/classes/Makefile
                    615:        src/include/Makefile
                    616:        src/main/Makefile
                    617:        src/sql/Makefile
                    618:        src/lib/Makefile
                    619:        src/lib/gd/Makefile
                    620:        src/lib/smtp/Makefile
                    621:        src/lib/gc/Makefile
1.1       moko      622:        src/lib/gc/include/Makefile
1.68      moko      623:        src/lib/pcre/Makefile
1.1       moko      624:        src/lib/cord/Makefile
                    625:        src/lib/cord/include/Makefile
                    626:        src/lib/cord/include/private/Makefile
                    627:        src/lib/md5/Makefile
                    628:        src/lib/sdbm/Makefile
                    629:        src/lib/sdbm/pa-include/Makefile
                    630:        src/lib/json/Makefile
                    631:        src/lib/curl/Makefile
                    632:        src/lib/punycode/Makefile
                    633:        src/lib/memcached/Makefile
                    634:        src/targets/Makefile
                    635:        src/targets/cgi/Makefile
                    636:        src/targets/apache/Makefile
                    637:        src/targets/isapi/Makefile
                    638:        etc/Makefile
                    639:        etc/parser3.charsets/Makefile
1.68      moko      640:        etc/auto.p])
                    641: AC_OUTPUT

E-mail: