Annotation of parser3/configure.ac, revision 1.3

1.1       moko        1: dnl Autoconf initialisation
                      2: AC_PREREQ(2.59)
1.3     ! moko        3: AC_INIT(parser, 3.4.4rc)
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)
                     64:        CXXFLAGS="$CXXFLAGS -W -Wall -Wstrict-prototypes -Wmissing-prototypes"
                     65: )
                     66: 
                     67: AC_ARG_WITH(assertions, [  --with-assertions       to enable assertions],
                     68:        AC_MSG_WARN(enabling assertions)
                     69: ,
                     70:        AC_DEFINE(NDEBUG,,assertions disabled)
                     71: )
                     72: 
                     73: AC_ARG_WITH(sjlj-exceptions,[  --with-sjlj-exceptions  enable simple 'throw' from dynamic library],
                     74:        AC_DEFINE(PA_WITH_SJLJ_EXCEPTIONS,,one can throw from dynamic library)
                     75: )
                     76: 
                     77: 
                     78: dnl Safe mode argument
                     79: AC_ARG_ENABLE(safe-mode, [  --disable-safe-mode          to enable reading and executing
                     80:                           files belonging to group+user other then effective],
                     81: [
                     82:        SAFE_MODE=$enableval
                     83: ]
                     84: )
                     85: 
                     86: if test "$SAFE_MODE" = "no"; then
                     87:        AC_MSG_WARN(enabling reading of files belonging to group+user other then effective)
                     88: else
                     89:        AC_DEFINE(PA_SAFE_MODE,,disabled reading of files belonging to group+user other then effective)
                     90: fi
                     91: 
                     92: 
                     93: dnl Disable execs argument
                     94: AC_ARG_ENABLE(execs, [  --disable-execs          to disable any execs
                     95:                           (file::exec, file::cgi, unix mail:send)],
                     96: [
                     97: if test "$enableval" = "no"; then
                     98:        AC_MSG_WARN(disabling file execs)
                     99:        AC_DEFINE(NO_PA_EXECS,,pa_exec disabled)
                    100: fi
                    101: ]
                    102: )
                    103: 
                    104: 
                    105: dnl String stream argument
                    106: AC_ARG_ENABLE(stringstream, [  --disable-stringstream  to disable stringstream usage.
                    107:                           when disabled table.save use more memory but it's safer on freebsd 4.x],
                    108: [
                    109: if test "$enableval" = "no"; then
                    110:        AC_MSG_WARN(disabling stringstream usage)
                    111:        AC_DEFINE(NO_STRINGSTREAM,,stringstream disabled)
                    112: fi
                    113: ]
                    114: )
                    115: 
                    116: 
                    117: dnl GC argument
                    118: AC_ARG_WITH(gc,[  --with-gc[=D]             D is the directory where
                    119:                           Boehm garbage collecting library is installed],[
                    120: 
                    121:        GC=$withval
                    122:        GC_LIBS="$GC/libgc.la"
                    123: 
                    124:        if test -f $GC_LIBS; then
                    125:                GC_OK="yes"
                    126:        else
                    127:                GC_LIBS="-L$GC -lgc"
                    128:        fi
                    129: 
                    130:        if test "$GC" = "yes"; then
                    131:                GC=""
                    132:                GC_LIBS="-lgc"
                    133:                AC_MSG_WARN([--with-gc value was not specified, hoping linker would find it])
                    134:        fi
                    135: ],[
                    136:        GC_LIBS="-lgc"
                    137:        AC_MSG_WARN([--with-gc was not specified, hoping linker would find it])
                    138: ])
                    139: 
                    140: if test -z "$GC_OK"; then
                    141:        AC_MSG_CHECKING(for libgc)
                    142:        SAVE_LIBS=$LIBS
                    143:        LIBS="$LIBS $GC_LIBS"
                    144:        AC_TRY_LINK([ extern int GC_dont_gc; ],[ GC_dont_gc=0; ],
                    145:                AC_MSG_RESULT(yes)
                    146:        ,
                    147:                AC_MSG_RESULT(no)
                    148:                if test -z "$GC"; then
                    149:                        AC_MSG_ERROR(please specify path to libgc: --with-gc=D)
                    150:                else
                    151:                        AC_MSG_ERROR($GC does not seem to be valid libgc installation directory)
                    152:                fi
                    153:        )
                    154:        LIBS=$SAVE_LIBS
                    155: fi
                    156: 
                    157: AC_SUBST(GC_LIBS)
                    158: 
                    159: 
                    160: dnl PCRE argument
                    161: AC_ARG_WITH(pcre,[  --with-pcre=D           D is the directory where
                    162:                           PCRE library is installed],[
                    163:        PCRE=$withval
                    164:        PCRE_INCLUDES="-I$PCRE/include"
                    165:        PCRE_LIBS="$PCRE/lib/libpcre.la"
                    166: 
                    167:        if test -f $PCRE/include/pcre.h -a -f $PCRE_LIBS; then
                    168:                PCRE_OK="yes"
                    169:        else
                    170:                PCRE_LIBS="-L$PCRE -lpcre"
                    171:        fi
                    172: 
                    173:        if test "$PCRE" = "yes"; then
                    174:                PCRE=""
                    175:                PCRE_LIBS="-lpcre"
                    176:                PCRE_INCLUDES=""
                    177:                AC_MSG_WARN([--with-pcre value was not specified, hoping linker would find it])
                    178:        fi
                    179: ],[
                    180:        PCRE_LIBS="-lpcre"
                    181:        PCRE_INCLUDES=""
                    182:        AC_MSG_WARN([--with-pcre was not specified, hoping linker would find it])
                    183: ])
                    184: 
                    185: if test -z "$PCRE_OK"; then
                    186:        AC_MSG_CHECKING(for prce)
                    187:        SAVE_LIBS=$LIBS
                    188:        LIBS="$LIBS $PCRE_LIBS $PCRE_INCLUDES"
                    189:        AC_TRY_LINK([ #include <pcre.h> ],[ const char *v=pcre_version(); ],
                    190:                AC_MSG_RESULT(yes)
                    191:        ,
                    192:                AC_MSG_RESULT(no)
                    193:                if test -z "$PCRE"; then
                    194:                        AC_MSG_ERROR(please specify path to PCRE: --with-pcre=D)
                    195:                else
                    196:                        AC_MSG_ERROR($PCRE does not seem to be valid PCRE installation directory)
                    197:                fi
                    198:        )
                    199:        LIBS=$SAVE_LIBS
                    200: fi
                    201: 
                    202: AC_SUBST(PCRE_INCLUDES)
                    203: AC_SUBST(PCRE_LIBS)
                    204: 
                    205: 
                    206: dnl XML/XSLT argument
                    207: AC_ARG_WITH(xml,[  --with-xml=D            D is the directory where
                    208:                           Gnome XML libraries are installed],[
                    209: 
                    210:        XML=$withval
                    211:        XML_LIBS="-lxml2 -lxslt -lexslt"
                    212: 
                    213:        if test -z "$XML" -o "$XML" = "yes"; then
                    214:                XML=""
                    215:                XML_INCLUDES="-I/usr/include/libxml2"
                    216:                AC_MSG_WARN([--with-xml value was not specified, hoping linker would find it])
                    217:        else
                    218:                XML_INCLUDES="-I$XML/include -I$XML/include/libxml2"
                    219: 
                    220:                if test -f $XML/include/libxslt/xslt.h -a -f $XML/lib/libxml2.la \
                    221:                        -a -f $XML/lib/libxslt.la -a -f $XML/lib/libexslt.la; then
                    222:                        XML_LIBS="$XML/lib/libxml2.la $XML/lib/libxslt.la $XML/lib/libexslt.la"
                    223:                        XML_OK="yes"
                    224:                fi
                    225:        fi
                    226: 
                    227:        if test -z "$XML_OK"; then
                    228:                AC_MSG_CHECKING(for xml)
                    229:                SAVE_LIBS=$LIBS
                    230:                LIBS="$LIBS $XML_LIBS $XML_INCLUDES"
                    231:                AC_TRY_LINK([ #include <libxslt/xslt.h> ],[ const char *v=xsltEngineVersion; ],
                    232:                        AC_MSG_RESULT(yes)
                    233:                ,
                    234:                        AC_MSG_RESULT(no)
                    235:                        if test -z "$XML"; then
                    236:                                AC_MSG_ERROR(please specify path to Gnome XML libraries: --with-xml=D)
                    237:                        else
                    238:                                AC_MSG_ERROR($XML does not seem to be valid Gnome XML installation directory)
                    239:                        fi
                    240:                )
                    241:                LIBS=$SAVE_LIBS
                    242:        fi
                    243:        AC_DEFINE(XML,,xml-abled parser)
                    244: ])
                    245: 
                    246: AC_SUBST(XML_INCLUDES)
                    247: AC_SUBST(XML_LIBS)
                    248: 
                    249: 
                    250: dnl Mail receive argument
                    251: AC_ARG_WITH(mailreceive,[  --with-mailreceive=D is the directory where
                    252:                           Gnome MIME library is installed],[
                    253:        MIME=$withval
                    254:        GLIB="glib-2.0"
                    255:        GMIME="gmime-2.4"
                    256: 
                    257:        if test -z "$MIME" -o "$MIME" = "yes"; then
                    258:                MIME=""
                    259:                MIME_INCLUDES=`pkg-config --cflags $GMIME 2>/dev/null`
                    260:                MIME_LIBS=`pkg-config --libs $GMIME 2>/dev/null`
                    261:                AC_MSG_WARN([--with-mailreceive value was not specified, hoping linker would find Gnome MIME library])
                    262:        else
                    263:                MIME_INCLUDES="-I$MIME/include/$GMIME"
                    264:                MIME_LIBS="-l$GMIME"
                    265:                if test -f $MIME/include/$GMIME/gmime/gmime.h -a -f $MIME/lib/lib$GMIME.la; then
                    266:                        MIME_LIBS="$MIME/lib/lib$GMIME.la"
                    267:                        if test -f $MIME/lib/lib$GLIB.la; then
                    268:                                MIME_INCLUDES="$MIME_INCLUDES -I$MIME/include/$GLIB -I$MIME/lib/$GLIB/include"
                    269:                        else
                    270:                                GLIB_INCLUDES=`pkg-config --cflags $GLIB 2>/dev/null`
                    271:                                MIME_INCLUDES="$MIME_INCLUDES $GLIB_INCLUDES"
                    272:                        fi
                    273:                        MIME_OK="yes"
                    274:                fi
                    275:        fi
                    276: 
                    277:        if test -z "$MIME_OK"; then
                    278:                AC_MSG_CHECKING(for mime)
                    279:                SAVE_LIBS=$LIBS
                    280:                LIBS="$LIBS $MIME_LIBS $MIME_INCLUDES"
                    281:                AC_TRY_LINK([ #include <gmime/gmime.h> ],[ guint v=gmime_major_version; ],
                    282:                        AC_MSG_RESULT(yes)
                    283:                ,
                    284:                        AC_MSG_RESULT(no)
                    285:                        if test -z "$MIME"; then
                    286:                                AC_MSG_ERROR(please specify path to Gnome MIME library: --with-mailreceive=D)
                    287:                        else
                    288:                                AC_MSG_ERROR($MIME does not seem to be valid Gnome MIME installation directory)
                    289:                        fi
                    290:                )
                    291:                LIBS=$SAVE_LIBS
                    292:        fi
                    293:        AC_DEFINE(WITH_MAILRECEIVE,,has \$mail:received)
                    294: ])
                    295: 
                    296: AC_SUBST(MIME_INCLUDES)
                    297: AC_SUBST(MIME_LIBS)
                    298: 
                    299: 
                    300: dnl Sendmail argument
                    301: AC_ARG_WITH(sendmail,[  \"--with-sendmail=COMMAND\" forces this command to send mail.
                    302:                           example: \"--with-sendmail=/usr/sbin/sendmail -t\"
                    303:                           (makes parser ignore user-defined sendmail commands)],
                    304:        AC_DEFINE_UNQUOTED(PA_FORCED_SENDMAIL,"$withval",parser uses this command instead of user-defined sendmail commands)
                    305: )
                    306: 
                    307: 
                    308: dnl Apache module argument
                    309: AC_ARG_WITH(apache,[  --with-apache=FILE      FILE is the full path for APXS
                    310:                           builds apache DSO module using apxs],[
                    311:        APXS=$withval
                    312: 
                    313:        if test -z "$APXS" -o "$APXS" = "yes"; then
                    314:                APXS=`which apxs 2>/dev/null`
                    315:                if test -z "$APXS"; then
                    316:                        APXS=`which apxs2 2>/dev/null`
                    317:                fi
                    318:        fi
                    319: 
                    320:        APACHE=`$APXS -q TARGET 2>/dev/null`
                    321: 
                    322:        if test -z "$APACHE"; then
                    323:                AC_MSG_ERROR($APXS does not seem to be valid apache apxs utility path)
                    324:        fi
                    325: 
                    326:        APACHE_MAIN_INC=`$APXS -q INCLUDEDIR`
                    327:        APACHE_EXTRA_INC=`$APXS -q EXTRA_INCLUDES 2>/dev/null`
                    328:        APACHE_INC="-I$APACHE_MAIN_INC $APACHE_EXTRA_INC"
                    329:        APACHE_CFLAGS=`$APXS -q CFLAGS`
                    330: ])
                    331: AC_SUBST(APACHE)
                    332: AC_SUBST(APACHE_INC)
                    333: AC_SUBST(APACHE_CFLAGS)
                    334: AM_CONDITIONAL(COMPILE_APACHE_MODULE, test -n "$APACHE")
                    335: 
                    336: 
                    337: dnl Enable building of the convenience library
                    338: LT_CONFIG_LTDL_DIR(src/lib/ltdl)
                    339: LT_INIT(dlopen win32-dll no-pic)
                    340: LTDL_INIT
                    341: 
                    342: 
                    343: dnl Checks for typedefs, structures, and compiler characteristics
                    344: AC_C_BIGENDIAN(
                    345:        AC_DEFINE(PA_BIG_ENDIAN,,compile for sparc processor)
                    346: ,
                    347:        AC_DEFINE(PA_LITTLE_ENDIAN,,compile for intel processor or compatible)
                    348: ,
                    349:        AC_MSG_ERROR(word endianness not determined for some obscure reason)
                    350: )
                    351: 
                    352: AC_TYPE_SIZE_T
                    353: AC_TYPE_SSIZE_T
                    354: AC_TYPE_UINT8_T
                    355: AC_TYPE_UINT16_T
                    356: AC_TYPE_UINT32_T
                    357: AC_TYPE_UINT64_T
                    358: 
                    359: AC_STRUCT_DIRENT_D_TYPE
                    360: 
                    361: AC_SYS_LARGEFILE
                    362: 
                    363: dnl Checks for C header files
                    364: AC_HEADER_STDC
                    365: AC_HEADER_TIME
                    366: 
                    367: 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)
                    368: AC_CHECK_HEADERS(assert.h limits.h ctype.h math.h process.h stdarg.h setjmp.h signal.h)
                    369: 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)
                    370: AC_CHECK_HEADERS(sys/socket.h netinet/in.h arpa/inet.h netdb.h)
                    371: 
                    372: 
                    373: dnl Checks for libraries
                    374: case "$host" in
                    375:   *-freebsd4*)
                    376:          AC_DEFINE(FREEBSD4,,FreeBSD4X target platform)
                    377:   ;;
                    378:   *-sunos5.6* | *-solaris2.6*)
                    379:          AC_CHECK_LIB(xnet, main)
                    380:   ;;
                    381:   *-sunos5* | *-solaris2*)
                    382:          AC_CHECK_LIB(socket, main)
                    383:          AC_CHECK_LIB(nsl, main)
                    384:   ;;
                    385:   *-nec-sysv4*)
                    386:          AC_CHECK_LIB(nsl, gethostbyname)
                    387:          AC_CHECK_LIB(socket, socket)
                    388:   ;;
                    389:   *-cygwin*)
                    390:          AC_DEFINE(WIN32,,Windows32 target platform)
                    391:   ;;
                    392: esac
                    393: 
                    394: AC_CHECK_LIB(m, sin)
                    395: AC_CHECK_LIB(crypt, crypt)
                    396: 
                    397: 
                    398: dnl Checks for functions
                    399: AC_CHECK_FUNCS(flock _locking fcntl lockf ftruncate fchmod)
                    400: AC_CHECK_FUNCS(getrusage gettimeofday crypt sigsetjmp siglongjmp unsetenv)
                    401: 
                    402: 
                    403: dnl on some linux[seen on 2.4] it's a macro
                    404: PA_CHECK_SIGSETJMP
                    405: 
                    406: 
                    407: dnl see comment above
                    408: AC_LANG_PUSH(C++)
                    409: PA_CHECK_MATH_FUNCS_ONE_ARG(trunc round sign)
                    410: AC_LANG_POP
                    411: 
                    412: 
                    413: dnl We require qsort(3)
                    414: AC_CHECK_FUNCS(qsort, , AC_MSG_ERROR([No qsort library function.]))
                    415: 
                    416: 
                    417: dnl For build-in date implementation we need to know local offset from GMT
                    418: 
                    419: AC_LANG_PUSH(C++)
                    420: AC_MSG_CHECKING(for timezone variable)
                    421: AC_TRY_COMPILE([#include <time.h>], [int test=timezone;], AC_DEFINE(HAVE_TIMEZONE) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
                    422: AC_LANG_POP
                    423: 
                    424: AC_MSG_CHECKING(for tm_gmtoff in struct tm)
                    425: 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))
                    426: 
                    427: AC_MSG_CHECKING(for tm_tzadj in struct tm)
                    428: 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))
                    429: 
                    430: AC_MSG_CHECKING(for 0..9999 year date range support)
                    431: AC_TRY_RUN([
                    432: #include <string.h>
                    433: #include <time.h>
                    434: 
                    435: int main() {
                    436:        struct tm tmL,tmH;
                    437:        memset(&tmL, 0, sizeof(tmL));
                    438:        memset(&tmH, 0, sizeof(tmH));
                    439:        tmL.tm_year=-1900;
                    440:        tmL.tm_mon=-1;
                    441:        tmH.tm_year=9999-1900;
                    442:        tmH.tm_mon=12-1;
                    443:        tmH.tm_mday=31;
                    444:        return mktime(&tmL)==-1 || mktime(&tmH)==-1;
                    445: }
                    446: ], AC_DEFINE(PA_DATE64) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), AC_MSG_RESULT(no))
                    447: 
                    448: dnl Output header and makefiles
                    449: AH_TEMPLATE([HAVE_TIMEZONE],[Define if you have timezone external variable in <time.h>])
                    450: AH_TEMPLATE([HAVE_TM_GMTOFF],[Define if you have tm_gmtoff member of tm structure in <time.h>])
                    451: AH_TEMPLATE([HAVE_TM_TZADJ],[Define if you have tm_tzadj member of tm structure in <time.h>])
                    452: AH_TEMPLATE([PA_DATE64],[Define if you have 0..9999 year date range support])
                    453: 
                    454: AM_CONFIG_HEADER(src/include/pa_config_auto.h)
                    455: 
                    456: AC_OUTPUT(
                    457:        Makefile 
                    458:        src/Makefile 
                    459:        src/types/Makefile 
                    460:        src/classes/Makefile 
                    461:        src/include/Makefile 
                    462:        src/main/Makefile 
                    463:        src/sql/Makefile 
                    464:        src/lib/Makefile 
                    465:        src/lib/gd/Makefile 
                    466:        src/lib/smtp/Makefile 
                    467:        src/lib/gc/Makefile 
                    468:        src/lib/gc/include/Makefile
                    469:        src/lib/pcre/Makefile 
                    470:        src/lib/cord/Makefile
                    471:        src/lib/cord/include/Makefile
                    472:        src/lib/cord/include/private/Makefile
                    473:        src/lib/md5/Makefile
                    474:        src/lib/sdbm/Makefile
                    475:        src/lib/sdbm/pa-include/Makefile
                    476:        src/lib/json/Makefile
                    477:        src/lib/curl/Makefile
                    478:        src/lib/punycode/Makefile
                    479:        src/lib/memcached/Makefile
                    480:        src/targets/Makefile
                    481:        src/targets/cgi/Makefile
                    482:        src/targets/apache/Makefile
                    483:        src/targets/isapi/Makefile
                    484:        etc/Makefile
                    485:        etc/parser3.charsets/Makefile
                    486:        bin/Makefile
                    487:        bin/auto.p.dist)

E-mail: