Home | History | Annotate | Download | only in expat
      1 dnl   configuration script for expat
      2 dnl   Process this file with autoconf to produce a configure script.
      3 dnl
      4 dnl   Copyright 2000 Clark Cooper
      5 dnl
      6 dnl   This file is part of EXPAT.
      7 dnl
      8 dnl   EXPAT is free software; you can redistribute it and/or modify it
      9 dnl   under the terms of the License (based on the MIT/X license) contained
     10 dnl   in the file COPYING that comes with this distribution.
     11 dnl
     12 
     13 dnl Ensure that Expat is configured with autoconf 2.52 or newer
     14 AC_PREREQ(2.52)
     15 
     16 dnl Get the version number of Expat, using m4's esyscmd() command to run
     17 dnl the command at m4-generation time. This allows us to create an m4
     18 dnl symbol holding the correct version number. AC_INIT() requires the
     19 dnl version number at m4-time, rather than when ./configure is run, so
     20 dnl all this must happen as part of m4, not as part of the shell code
     21 dnl contained in ./configure.
     22 dnl
     23 dnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate
     24 dnl test. I believe this test will work, but I don't have a place with non-
     25 dnl GNU M4 to test it right now.
     26 define([expat_version], ifdef([__gnu__],
     27                               [esyscmd(conftools/get-version.sh lib/expat.h)],
     28                               [2.0.x]))
     29 AC_INIT(expat, expat_version, expat-bugs (a] libexpat.org)
     30 undefine([expat_version])
     31 
     32 AC_CONFIG_SRCDIR(Makefile.in)
     33 AC_CONFIG_AUX_DIR(conftools)
     34 
     35 
     36 dnl
     37 dnl Increment LIBREVISION if source code has changed at all
     38 dnl
     39 dnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0
     40 dnl
     41 dnl If the API changes compatibly (i.e. simply adding a new function
     42 dnl without changing or removing earlier interfaces), then increment LIBAGE.
     43 dnl 
     44 dnl If the API changes incompatibly set LIBAGE back to 0
     45 dnl
     46 
     47 LIBCURRENT=6
     48 LIBREVISION=2
     49 LIBAGE=5
     50 
     51 AC_CONFIG_HEADER(expat_config.h)
     52 
     53 sinclude(conftools/libtool.m4)
     54 sinclude(conftools/ac_c_bigendian_cross.m4)
     55 
     56 AC_LIBTOOL_WIN32_DLL
     57 AC_PROG_LIBTOOL
     58 
     59 AC_SUBST(LIBCURRENT)
     60 AC_SUBST(LIBREVISION)
     61 AC_SUBST(LIBAGE)
     62 
     63 dnl Checks for programs.
     64 AC_PROG_CC
     65 AC_PROG_INSTALL
     66 
     67 if test "$GCC" = yes ; then
     68     dnl
     69     dnl Be careful about adding the -fexceptions option; some versions of
     70     dnl GCC don't support it and it causes extra warnings that are only
     71     dnl distracting; avoid.
     72     dnl
     73     OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
     74     CFLAGS="$OLDCFLAGS -fexceptions"
     75     AC_MSG_CHECKING(whether $CC accepts -fexceptions)
     76     AC_TRY_LINK( , ,
     77                    AC_MSG_RESULT(yes),
     78                    AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
     79     CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
     80 fi
     81 
     82 dnl Checks for header files.
     83 AC_HEADER_STDC
     84 
     85 dnl Checks for typedefs, structures, and compiler characteristics.
     86 
     87 dnl Note: Avoid using AC_C_BIGENDIAN because it does not
     88 dnl work in a cross compile.
     89 AC_C_BIGENDIAN_CROSS
     90 
     91 AC_C_CONST
     92 AC_TYPE_SIZE_T
     93 AC_CHECK_FUNCS(memmove bcopy)
     94 
     95 dnl Only needed for xmlwf:
     96 AC_CHECK_HEADERS(fcntl.h unistd.h)
     97 AC_TYPE_OFF_T
     98 AC_FUNC_MMAP
     99 
    100 if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then
    101     FILEMAP=unixfilemap
    102 else
    103     FILEMAP=readfilemap
    104 fi
    105 AC_SUBST(FILEMAP)
    106 
    107 dnl Needed for the test support code; this was found at
    108 dnl http://lists.gnu.org/archive/html/bug-autoconf/2002-07/msg00028.html
    109 
    110 # AC_CPP_FUNC
    111 # ------------------ #
    112 # Checks to see if ANSI C99 CPP variable __func__ works.
    113 # If not, perhaps __FUNCTION__ works instead. 
    114 # If not, we'll just define __func__ to "". 
    115 AC_DEFUN([AC_CPP_FUNC],
    116 [AC_REQUIRE([AC_PROG_CC_STDC])dnl
    117 AC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func,
    118 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
    119 [[char *foo = __func__;]])],
    120   [ac_cv_cpp_func=yes], 
    121   [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
    122 [[char *foo = __FUNCTION__;]])],
    123   [ac_cv_cpp_func=__FUNCTION__], 
    124   [ac_cv_cpp_func=no])])])
    125 if test $ac_cv_cpp_func = __FUNCTION__; then
    126   AC_DEFINE(__func__,__FUNCTION__,
    127             [Define to __FUNCTION__ or "" if `__func__' does not conform to 
    128 ANSI C.])
    129 elif test $ac_cv_cpp_func = no; then
    130   AC_DEFINE(__func__,"",
    131             [Define to __FUNCTION__ or "" if `__func__' does not conform to 
    132 ANSI C.])
    133 fi
    134 ])# AC_CPP_FUNC
    135 
    136 AC_CPP_FUNC
    137 
    138 
    139 dnl Some basic configuration:
    140 AC_DEFINE([XML_NS], 1,
    141           [Define to make XML Namespaces functionality available.])
    142 AC_DEFINE([XML_DTD], 1,
    143           [Define to make parameter entity parsing functionality available.])
    144 AC_DEFINE([XML_CONTEXT_BYTES], 1024,
    145           [Define to specify how much context to retain around the current parse point.])
    146 
    147 AC_CONFIG_FILES(Makefile)
    148 AC_OUTPUT
    149 
    150 abs_srcdir="`cd $srcdir && pwd`"
    151 abs_builddir="`pwd`"
    152 if test "$abs_srcdir" != "$abs_builddir"; then
    153   make mkdir-init
    154 fi
    155