Annotation of parser3/configure.ac, revision 1.89

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

E-mail: