Annotation of parser3/configure.in, revision 1.13

1.1       paf         1: dnl Process this file with autoconf to produce a configure script.
                      2: AC_INIT(README)
                      3: AM_INIT_AUTOMAKE(parser, 3.0b, nodefine)
                      4: 
1.8       paf         5: dnl expand srcdir
                      6: P3S=`cd $srcdir ; pwd`
1.1       paf         7: AC_SUBST(P3S)
                      8: 
                      9: PARSER_VERSION=$VERSION
1.8       paf        10: echo "/* automatically generated by configure */" > $srcdir/src/include/pa_version.h.new
                     11: echo "/* edit configure.in to change version number */" >> $srcdir/src/include/pa_version.h.new
                     12: echo "#define PARSER_VERSION \"$PARSER_VERSION\"" >> $srcdir/src/include/pa_version.h.new
                     13: cmp $srcdir/src/include/pa_version.h.new $srcdir/src/include/pa_version.h >/dev/null 2>&1
1.1       paf        14: if test $? -ne 0 ; then
1.8       paf        15:     rm -f $srcdir/src/include/pa_version.h && mv $srcdir/src/include/pa_version.h.new $srcdir/src/include/pa_version.h && \
                     16:     echo Updated $srcdir/src/include/pa_version.h
1.1       paf        17: else
1.8       paf        18:        rm -f $srcdir/src/include/pa_version.h.new
1.1       paf        19: fi
                     20: 
                     21: AC_PROG_INSTALL
                     22: AC_PROG_CC
                     23: AC_LANG_C AC_C_INLINE
                     24: AC_PROG_CXX
                     25: AC_LANG_CPLUSPLUS
                     26: 
                     27: 
                     28: dnl Arguments
                     29: 
                     30: AC_ARG_ENABLE(string-origins, [  --disable-string-origins to switch off string origin tracking],
                     31: [
                     32: if test "$enableval" = "no"; then
                     33:        AC_DEFINE(NO_STRING_ORIGIN,,no string origin tracking)
                     34: fi
                     35: ]
                     36: )
                     37: 
1.9       paf        38: AC_ARG_WITH(apache13,[  --with-apache13=D       D is the Apache13 source distribution directory
1.1       paf        39:                           builds library for apache_module using that dir
                     40:                           (do not add /src)],
                     41:        APACHE13=$withval
                     42:     if test \! -f "$APACHE13/src/include/httpd.h"; then
                     43:        AC_MSG_ERROR($APACHE13 does not seem to be valid Apache13 source distribution directory)
                     44:     fi
                     45: )
                     46: AC_SUBST(APACHE13)
                     47: AM_CONDITIONAL(COMPILE_APACHE13_MODULE, test -n "$APACHE13")
                     48: 
                     49: 
1.9       paf        50: AC_ARG_WITH(pathlink,[  --with-pathlink=LKEY    put dynamic libraries paths to binary
1.1       paf        51:                           using linker key (-R, -rpath-link)],
                     52:        LD_PATHLINK=$withval
                     53: )
                     54: 
1.9       paf        55: AC_ARG_WITH(glib-config,[  --with-glib-config=FILE FILE is glib library
                     56:                           configuration file (search for glib*-config)],
                     57:        GLIB_CONFIG=$withval
                     58: )
                     59: 
1.12      paf        60: AC_ARG_WITH(shared-xml,[  --with-shared-xml=D     D is the directory where
                     61:                           Gnome XML libraries are installed (shared libs)],[
1.1       paf        62:     GNOME_XML=$withval
1.13    ! paf        63:     XMLBIN="$GNOME_XML/bin"
        !            64:     XMLINC="$GNOME_XML/include"
        !            65:     XMLLIB="$GNOME_XML/lib"
1.1       paf        66: 
1.13    ! paf        67:     if test \! -d $XMLBIN -o \! -d $XMLINC -o \! -d $XMLLIB; then
1.1       paf        68:        AC_MSG_ERROR($GNOME_XML does not seem to be valid Gnome installation directory)
                     69:     fi
                     70: 
                     71:     AC_DEFINE(XML,,xml-abled parser)
                     72:     
1.13    ! paf        73:     LIBXML2_SO_NAME=`cd $XMLLIB ; ls libxml2.?? libxml2.??? 2>/dev/null | grep -v \.la$ | sed 's/lib//' | sed 's/\..*//'`
        !            74:     LIBGDOME_SO_NAME=`cd $XMLLIB ; ls libgdome.?? libgdome.??? 2>/dev/null | grep -v \.la$ | sed 's/lib//' | sed 's/\..*//'`
        !            75:     LIBXSLT_SO_NAME=`cd $XMLLIB ; ls libxslt.?? libxslt.??? 2>/dev/null | grep -v \.la$ | sed 's/lib//' | sed 's/\..*//'`
        !            76:     LIBEXSLT_SO_NAME=`cd $XMLLIB ; ls libexslt.?? libexslt.??? 2>/dev/null | grep -v \.la$ | sed 's/lib//' | sed 's/\..*//'`
1.9       paf        77: 
                     78:     if test -z "$GLIB_CONFIG"; then
1.13    ! paf        79:            GLIB_CONFIG=$XMLBIN/glib-config
1.9       paf        80:            if test \! -x $GLIB_CONFIG; then
                     81:                GLIB_CONFIG=glib-config
                     82:            fi
1.1       paf        83:     fi
                     84:     GLIB_CFLAGS=`$GLIB_CONFIG --cflags`
                     85:     GLIB_LIBS=`$GLIB_CONFIG --libs`
                     86: 
1.13    ! paf        87:     XML_INCLUDES="$GLIB_CFLAGS -I$XMLINC -I$XMLINC/libgdome -I$XMLINC/libxml2"
        !            88:     XML_LIBS="$GLIB_LIBS -L$XMLLIB -l$LIBXML2_SO_NAME -l$LIBGDOME_SO_NAME -l$LIBXSLT_SO_NAME -l$LIBEXSLT_SO_NAME"
1.1       paf        89:     if test \! -z "$LD_PATHLINK"; then
1.13    ! paf        90:        XML_LIBS="$XML_LIBS -Wl,$LD_PATHLINK -Wl,$XMLLIB"
1.1       paf        91:     fi
                     92: ])
1.12      paf        93: 
                     94: AC_ARG_WITH(static-xml,[  --with-static-xml=D     D is the directory where
                     95:                           Gnome XML libraries are installed (static libs)],[
                     96:     GNOME_XML=$withval
1.13    ! paf        97:     XMLBIN="$GNOME_XML/bin"
        !            98:     XMLINC="$GNOME_XML/include"
        !            99:     XMLLIB="$GNOME_XML/lib"
1.12      paf       100: 
1.13    ! paf       101:     if test \! -d $XMLBIN -o \! -d $XMLINC -o \! -d $XMLLIB; then
1.12      paf       102:        AC_MSG_ERROR($GNOME_XML does not seem to be valid Gnome installation directory)
                    103:     fi
                    104: 
                    105:     AC_DEFINE(XML,,xml-abled parser)
                    106: 
                    107:     if test -z "$GLIB_CONFIG"; then
1.13    ! paf       108:            GLIB_CONFIG=$XMLBIN/glib-config
1.12      paf       109:            if test \! -x $GLIB_CONFIG; then
                    110:                GLIB_CONFIG=glib-config
                    111:            fi
                    112:     fi
                    113:     GLIB_CFLAGS=`$GLIB_CONFIG --cflags`
1.13    ! paf       114: 
1.12      paf       115: dnl  '-L/usr/local/lib -lglib' -> /usr/local/lib
1.13    ! paf       116: changequote(, )dnl
        !           117:     GLIB_DIR=`$GLIB_CONFIG --libs | sed 's/.*-L\([^ ]*\).*/\1/'`
        !           118:     GLIB_NAME=`$GLIB_CONFIG --libs | sed 's/.*-l\([^ ]*\).*/\1/'`
        !           119: changequote([, ])dnl
        !           120:     XML_INCLUDES="$GLIB_CFLAGS -I$XMLINC -I$XMLINC/libgdome -I$XMLINC/libxml2"
        !           121:     XML_LIBS="$XMLLIB/libgdome.a $XMLLIB/libxslt.a $XMLLIB/libexslt.a $XMLLIB/libxml2.a $GLIB_DIR/lib$GLIB_NAME.a"
1.12      paf       122: ])
1.1       paf       123: AC_SUBST(XML_INCLUDES)
                    124: AC_SUBST(XML_LIBS)
                    125: 
                    126: dnl AC_CANONICAL_SYSTEM
                    127: AC_CANONICAL_HOST
                    128: AC_SUBST(host_os)
                    129: 
                    130: dnl Checks for programs.
                    131: AC_PROG_INSTALL
                    132: AC_PROG_MAKE_SET
                    133: AC_PROG_RANLIB
                    134: AC_PROG_AWK
                    135: 
                    136: AC_PROG_YACC
                    137: if test "$YACC" != "bison -y"; then
                    138:     AC_MSG_WARN(to regenerate Parser grammar YOU WOULD NEED BISON)
                    139: else
                    140:     AC_MSG_CHECKING(bison version)
                    141:     oldIFS=$IFS; IFS=.
                    142:     set `bison -V | sed -e 's/^GNU Bison version //'`
                    143:     IFS=$oldIFS
                    144:     if test "$1" = "1" -a "$2" -lt "25"; then
                    145:         AC_MSG_WARN(Bison 1.25 or newer needed to regenerate Parser compiler (found $1.$2).)
                    146:     fi
                    147:     AC_MSG_RESULT($1.$2 (ok))
                    148: fi
                    149: 
                    150: dnl Enable building of the convenience library
                    151: dnl and set LIBLTDL accordingly
                    152: AC_LIBLTDL_CONVENIENCE(src/libltdl)
                    153: dnl Substitute INCLTDL and LIBLTDL in the Makefiles
                    154: AC_SUBST(INCLTDL)
                    155: AC_SUBST(LIBLTDL)
                    156: 
                    157: dnl Configure libltdl
                    158: AC_CONFIG_SUBDIRS(src/libltdl)
1.10      paf       159: dnl moved from src/libltdl/configure.in
                    160: LIBADD_DL=
                    161: AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL, 1) LIBADD_DL="-ldl"],
                    162: [AC_CHECK_FUNC(dlopen, [AC_DEFINE(HAVE_LIBDL, 1)])])
                    163: AC_CHECK_FUNC(shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1)],
                    164: [AC_CHECK_LIB(dld, shl_load, [AC_DEFINE(HAVE_SHL_LOAD, 1) LIBADD_DL="$LIBADD_DL -ldld"])])
                    165: AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD, 1)dnl
                    166: test "x$ac_cv_lib_dld_shl_load" = yes || LIBADD_DL="$LIBADD_DL -ldld"])
                    167: AC_SUBST(LIBADD_DL)
                    168: 
                    169: if test "x$ac_cv_func_dlopen" = xyes || test "x$ac_cv_lib_dl_dlopen" = xyes; then
                    170:  LIBS_SAVE="$LIBS"
                    171:  LIBS="$LIBS $LIBADD_DL"
                    172:  AC_CHECK_FUNCS(dlerror)
                    173:  LIBS="$LIBS_SAVE"
                    174: fi
1.1       paf       175: 
                    176: dnl Checks for typedefs, structures, and compiler characteristics.
                    177: 
                    178: AC_TYPE_SIZE_T
                    179: 
                    180: dnl Checks for header files.
                    181: 
1.10      paf       182: AC_HEADER_TIME
                    183: 
1.1       paf       184: AC_CHECK_HEADERS(
                    185: unistd.h \
                    186: process.h \
                    187: stddef.h \
                    188: stdarg.h \
                    189: fcntl.h \
                    190: sys/stat.h \
                    191: io.h \
                    192: stdio.h \
                    193: errno.h \
                    194: ctype.h \
                    195: math.h \
1.3       paf       196: time.h sys/time.h \
1.1       paf       197: stdlib.h \
                    198: string.h \
                    199: direct.h \
                    200: setjmp.h \
                    201: memory.h \
                    202: new \
                    203: sys/file.h \
                    204: sys/locking.h \
1.3       paf       205: sys/types.h \
1.5       paf       206: sys/select.h \
                    207: sys/resource.h
1.1       paf       208: )
                    209: 
                    210: dnl Checks for libraries.
                    211: 
                    212: dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
                    213: case "$host" in
                    214:   *-sunos5.6* | *-solaris2.6*)
                    215:       AC_CHECK_LIB(xnet, main)
                    216:   ;;
                    217:   *-sunos5* | *-solaris2*)
                    218:       AC_CHECK_LIB(socket, main)
                    219:       AC_CHECK_LIB(nsl, main)
                    220:   ;;
                    221:   *-nec-sysv4*)
                    222:       AC_CHECK_LIB(nsl, gethostbyname)
                    223:       AC_CHECK_LIB(socket, socket)
                    224:   ;;
                    225:   *-cygwin*)
                    226:       AC_DEFINE(WIN32,,Windows32 target platform)
                    227:       AC_CHECK_LIB(wsock32, socket)
                    228:   ;;
                    229: esac
                    230: 
                    231: AC_CHECK_LIB(m, sin)
                    232: 
                    233: dnl Checks for functions.
                    234: 
                    235: AC_CHECK_FUNCS(
                    236: trunc \
                    237: round \
                    238: sign \
                    239: flock \
                    240: _locking \
1.7       paf       241: fcntl \
1.4       paf       242: lockf \
                    243: getrusage
1.1       paf       244: )
1.3       paf       245: 
                    246: dnl We require qsort(3) and select(2).
                    247: 
                    248: AC_CHECK_FUNCS(qsort, , AC_MSG_ERROR([No qsort library function.]))
                    249: AC_CHECK_FUNCS(select, , AC_MSG_ERROR([No select library function.]))
1.1       paf       250: 
                    251: AC_MSG_CHECKING(whether compiler supports pragma pack)
                    252: AC_TRY_COMPILE(
                    253: ,
                    254: #pragma pack(1)
                    255: struct must_be_1_byte {
                    256:        char c;
                    257: };
                    258: #pragma pack()
                    259: if(sizeof(must_be_1_byte)!=1)
                    260:        return 1;
                    261: ,[
                    262:     AC_MSG_RESULT(yes)
                    263:        AC_DEFINE(HAVE_PRAGMA_PACK,,compiler supports pragma pack)
                    264: ],             
                    265:     AC_MSG_RESULT(no)
                    266: )
                    267: 
                    268: AC_MSG_CHECKING(for set_new_handler)
                    269: AC_TRY_COMPILE(
                    270: #ifdef HAVE_NEW
                    271: #include <new>
                    272: #endif
                    273: void failed_new() {}
                    274: ,
                    275: std::set_new_handler(failed_new);
                    276: ,[
                    277:     AC_MSG_RESULT(yes)
                    278:        AC_DEFINE(HAVE_SET_NEW_HANDLER,,library has set_new_handler func)
                    279: ],             
                    280:     AC_MSG_RESULT(no)
                    281: )
                    282: 
                    283: 
                    284: dnl AC_ARG_ENABLE(db, [  --enable-db             to enable 'hashfile' parser class],
                    285: dnl [
                    286: dnl if test "$enableval" != "no"; then
                    287: dnl AC_CHECK_HEADERS(db.h)
                    288: dnl AC_CHECK_LIB(db, __db_open)
                    289: dnl fi
                    290: dnl ]
                    291: dnl )
                    292: 
                    293: dnl Apache libs
1.10      paf       294: APACHE_LIBS="$LIBS $LIBADD_DL"
1.9       paf       295: dnl append stdc++ to libs list commented
                    296: dnl 1. because binary seem to work without it
                    297: dnl purpose of this: remove strange name dependance
                    298: dnl for linker creates reference not for libstc++.xx but
                    299: dnl for something specific to local system,
                    300: dnl thus reducing binary compatibility
                    301: dnl 2. for same reason linker of targets/cgi/parser3 changed to
                    302: dnl "C" compiler from "C++" compiler
                    303: dnl AC_CHECK_LIB(stdc++, __builtin_new,
                    304: dnl    APACHE_LIBS="$APACHE_LIBS -lstdc++"
                    305: dnl )
1.1       paf       306: AC_SUBST(APACHE_LIBS)
                    307: 
                    308: 
                    309: dnl install directories
                    310: 
                    311: # expand apostrophed
1.6       paf       312: e_prefix=$prefix
                    313: test "x$e_prefix" = xNONE && e_prefix=$ac_default_prefix
                    314: 
1.1       paf       315: e_sysconfdir=$sysconfdir
1.6       paf       316: test "$e_sysconfdir" = "\${prefix}/etc" && e_sysconfdir="${e_prefix}/etc"
1.1       paf       317: 
                    318: dnl this is used in targets/cgi/parser3.C to load root config
                    319: 
1.2       paf       320: rootconfigdir=$e_sysconfdir
                    321: AC_SUBST(rootconfigdir)
1.1       paf       322: 
                    323: dnl these are used to fill in etc/parser3.conf
                    324: 
                    325: charsetsdir=$e_sysconfdir/parser3.charsets
                    326: AC_SUBST(charsetsdir)
                    327: 
                    328: # expand apostrophed
                    329: e_libdir=$libdir
                    330: if test "$e_libdir" = "\${exec_prefix}/lib"; then
                    331: 
                    332:     # Let make expand exec_prefix.
                    333:     e_exec_prefix=$exec_prefix
1.12      paf       334:     test "x$e_exec_prefix" = xNONE && e_exec_prefix=$e_prefix
1.1       paf       335: 
                    336:     # expand apostrophed
                    337:     test "$e_libdir" = "\${exec_prefix}/lib" && e_libdir="${e_exec_prefix}/lib"
                    338: fi
                    339: 
                    340: sqldriversdir=$e_libdir
                    341: AC_SUBST(sqldriversdir)
                    342: 
                    343: 
                    344: dnl Output makefiles
                    345: 
                    346: AM_CONFIG_HEADER(src/include/pa_config_auto.h)
1.8       paf       347: AC_OUTPUT(Makefile src/Makefile src/libltdl/Makefile src/types/Makefile src/classes/Makefile src/classes/gd/Makefile src/classes/smtp/Makefile src/include/Makefile src/main/Makefile src/sql/Makefile src/patches/Makefile src/pcre/Makefile src/targets/Makefile src/targets/cgi/pa_config_paths.h src/targets/cgi/Makefile src/targets/apache13/Makefile src/targets/apache13/p3runConfigure src/targets/isapi/Makefile etc/parser3.charsets/Makefile etc/parser3.conf etc/Makefile)

E-mail: