1302260Sdelphijdnl   configuration script for expat
2302260Sdelphijdnl   Process this file with autoconf to produce a configure script.
3302260Sdelphijdnl
4302260Sdelphijdnl   Copyright 2000 Clark Cooper
5302260Sdelphijdnl
6302260Sdelphijdnl   This file is part of EXPAT.
7302260Sdelphijdnl
8302260Sdelphijdnl   EXPAT is free software; you can redistribute it and/or modify it
9302260Sdelphijdnl   under the terms of the License (based on the MIT/X license) contained
10302260Sdelphijdnl   in the file COPYING that comes with this distribution.
11302260Sdelphijdnl
12302260Sdelphij
13302260Sdelphijdnl Ensure that Expat is configured with autoconf 2.58 or newer
14302260SdelphijAC_PREREQ(2.58)
15302260Sdelphij
16302260Sdelphijdnl Get the version number of Expat, using m4's esyscmd() command to run
17302260Sdelphijdnl the command at m4-generation time. This allows us to create an m4
18302260Sdelphijdnl symbol holding the correct version number. AC_INIT() requires the
19302260Sdelphijdnl version number at m4-time, rather than when ./configure is run, so
20302260Sdelphijdnl all this must happen as part of m4, not as part of the shell code
21302260Sdelphijdnl contained in ./configure.
22302260Sdelphijdnl
23302260Sdelphijdnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate
24302260Sdelphijdnl test. I believe this test will work, but I don't have a place with non-
25302260Sdelphijdnl GNU M4 to test it right now.
26302260Sdelphijdefine([expat_version], ifdef([__gnu__],
27302260Sdelphij                              [esyscmd(conftools/get-version.sh lib/expat.h)],
28302260Sdelphij                              [2.2.x]))
29302260SdelphijAC_INIT(expat, expat_version, expat-bugs@libexpat.org)
30302260Sdelphijundefine([expat_version])
31302260Sdelphij
32302260SdelphijAC_CONFIG_SRCDIR(Makefile.in)
33302260SdelphijAC_CONFIG_AUX_DIR(conftools)
34302260SdelphijAC_CONFIG_MACRO_DIR([m4])
35302260Sdelphij
36302260Sdelphij
37302260Sdelphijdnl
38302260Sdelphijdnl Increment LIBREVISION if source code has changed at all
39302260Sdelphijdnl
40302260Sdelphijdnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0
41302260Sdelphijdnl
42302260Sdelphijdnl If the API changes compatibly (i.e. simply adding a new function
43302260Sdelphijdnl without changing or removing earlier interfaces), then increment LIBAGE.
44302260Sdelphijdnl 
45302260Sdelphijdnl If the API changes incompatibly set LIBAGE back to 0
46302260Sdelphijdnl
47302260Sdelphij
48302260SdelphijLIBCURRENT=7   # sync
49302260SdelphijLIBREVISION=2  # with
50302260SdelphijLIBAGE=6       # CMakeLists.txt!
51302260Sdelphij
52302260SdelphijAC_CONFIG_HEADER(expat_config.h)
53302260Sdelphij
54302260Sdelphijsinclude(conftools/ac_c_bigendian_cross.m4)
55302260Sdelphij
56302260SdelphijAC_LIBTOOL_WIN32_DLL
57302260SdelphijAC_PROG_LIBTOOL
58302260Sdelphij
59302260SdelphijAC_SUBST(LIBCURRENT)
60302260SdelphijAC_SUBST(LIBREVISION)
61302260SdelphijAC_SUBST(LIBAGE)
62302260Sdelphij
63302260Sdelphijdnl Checks for programs.
64302260SdelphijAC_PROG_CC
65302260SdelphijAC_PROG_CXX
66302260SdelphijAC_PROG_INSTALL
67302260Sdelphij
68302260Sdelphijif test "$GCC" = yes ; then
69302260Sdelphij    dnl
70302260Sdelphij    dnl Be careful about adding the -fexceptions option; some versions of
71302260Sdelphij    dnl GCC don't support it and it causes extra warnings that are only
72302260Sdelphij    dnl distracting; avoid.
73302260Sdelphij    dnl
74302260Sdelphij    OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
75302260Sdelphij    CFLAGS="$OLDCFLAGS -fexceptions"
76302260Sdelphij    AC_MSG_CHECKING(whether $CC accepts -fexceptions)
77302260Sdelphij    AC_TRY_LINK( , ,
78302260Sdelphij                   AC_MSG_RESULT(yes),
79302260Sdelphij                   AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
80302260Sdelphij    if test "x$CXXFLAGS" = x ; then
81302260Sdelphij    CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
82302260Sdelphij    fi
83302260Sdelphijfi
84302260Sdelphij
85302260Sdelphijdnl Checks for header files.
86302260SdelphijAC_HEADER_STDC
87302260Sdelphij
88302260Sdelphijdnl Checks for typedefs, structures, and compiler characteristics.
89302260Sdelphij
90302260Sdelphijdnl Note: Avoid using AC_C_BIGENDIAN because it does not
91302260Sdelphijdnl work in a cross compile.
92302260SdelphijAC_C_BIGENDIAN_CROSS
93302260Sdelphij
94302260SdelphijAC_C_CONST
95302260SdelphijAC_TYPE_SIZE_T
96302260SdelphijAC_CHECK_FUNCS(memmove bcopy)
97302260Sdelphij
98302260Sdelphijdnl Only needed for xmlwf:
99302260SdelphijAC_CHECK_HEADERS(fcntl.h unistd.h)
100302260SdelphijAC_TYPE_OFF_T
101302260SdelphijAC_FUNC_MMAP
102302260Sdelphij
103302260Sdelphijif test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then
104302260Sdelphij    FILEMAP=unixfilemap
105302260Sdelphijelse
106302260Sdelphij    FILEMAP=readfilemap
107302260Sdelphijfi
108302260SdelphijAC_SUBST(FILEMAP)
109302260Sdelphij
110302260Sdelphijdnl Needed for the test support code; this was found at
111302260Sdelphijdnl http://lists.gnu.org/archive/html/bug-autoconf/2002-07/msg00028.html
112302260Sdelphij
113302260Sdelphij# AC_CPP_FUNC
114302260Sdelphij# ------------------ #
115302260Sdelphij# Checks to see if ANSI C99 CPP variable __func__ works.
116302260Sdelphij# If not, perhaps __FUNCTION__ works instead. 
117302260Sdelphij# If not, we'll just define __func__ to "". 
118302260SdelphijAC_DEFUN([AC_CPP_FUNC],
119302260Sdelphij[AC_REQUIRE([AC_PROG_CC_STDC])dnl
120302260SdelphijAC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func,
121302260Sdelphij[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
122302260Sdelphij[[char *foo = __func__;]])],
123302260Sdelphij  [ac_cv_cpp_func=yes], 
124302260Sdelphij  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
125302260Sdelphij[[char *foo = __FUNCTION__;]])],
126302260Sdelphij  [ac_cv_cpp_func=__FUNCTION__], 
127302260Sdelphij  [ac_cv_cpp_func=no])])])
128302260Sdelphijif test $ac_cv_cpp_func = __FUNCTION__; then
129302260Sdelphij  AC_DEFINE(__func__,__FUNCTION__,
130302260Sdelphij            [Define to __FUNCTION__ or "" if `__func__' does not conform to 
131302260SdelphijANSI C.])
132302260Sdelphijelif test $ac_cv_cpp_func = no; then
133302260Sdelphij  AC_DEFINE(__func__,"",
134302260Sdelphij            [Define to __FUNCTION__ or "" if `__func__' does not conform to 
135302260SdelphijANSI C.])
136302260Sdelphijfi
137302260Sdelphij])# AC_CPP_FUNC
138302260Sdelphij
139302260SdelphijAC_CPP_FUNC
140302260Sdelphij
141302260Sdelphij
142302260Sdelphijdnl Some basic configuration:
143302260SdelphijAC_DEFINE([XML_NS], 1,
144302260Sdelphij          [Define to make XML Namespaces functionality available.])
145302260SdelphijAC_DEFINE([XML_DTD], 1,
146302260Sdelphij          [Define to make parameter entity parsing functionality available.])
147302260SdelphijAC_DEFINE([XML_CONTEXT_BYTES], 1024,
148302260Sdelphij          [Define to specify how much context to retain around the current parse point.])
149302260Sdelphij
150302260SdelphijAC_CONFIG_FILES([Makefile expat.pc])
151302260SdelphijAC_OUTPUT
152302260Sdelphij
153302260Sdelphijabs_srcdir="`cd $srcdir && pwd`"
154302260Sdelphijabs_builddir="`pwd`"
155302260Sdelphijif test "$abs_srcdir" != "$abs_builddir"; then
156302260Sdelphij  make mkdir-init
157302260Sdelphijfi
158