1104349Sphkdnl   configuration script for expat
2104349Sphkdnl   Process this file with autoconf to produce a configure script.
3104349Sphkdnl
4104349Sphkdnl   Copyright 2000 Clark Cooper
5104349Sphkdnl
6104349Sphkdnl   This file is part of EXPAT.
7104349Sphkdnl
8104349Sphkdnl   EXPAT is free software; you can redistribute it and/or modify it
9104349Sphkdnl   under the terms of the License (based on the MIT/X license) contained
10104349Sphkdnl   in the file COPYING that comes with this distribution.
11104349Sphkdnl
12104349Sphk
13247513Sdelphijdnl Ensure that Expat is configured with autoconf 2.58 or newer
14247513SdelphijAC_PREREQ(2.58)
15104349Sphk
16104349Sphkdnl Get the version number of Expat, using m4's esyscmd() command to run
17104349Sphkdnl the command at m4-generation time. This allows us to create an m4
18104349Sphkdnl symbol holding the correct version number. AC_INIT() requires the
19104349Sphkdnl version number at m4-time, rather than when ./configure is run, so
20104349Sphkdnl all this must happen as part of m4, not as part of the shell code
21104349Sphkdnl contained in ./configure.
22104349Sphkdnl
23104349Sphkdnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate
24104349Sphkdnl test. I believe this test will work, but I don't have a place with non-
25104349Sphkdnl GNU M4 to test it right now.
26104349Sphkdefine([expat_version], ifdef([__gnu__],
27104349Sphk                              [esyscmd(conftools/get-version.sh lib/expat.h)],
28247513Sdelphij                              [2.1.x]))
29178848ScokaneAC_INIT(expat, expat_version, expat-bugs@libexpat.org)
30104349Sphkundefine([expat_version])
31104349Sphk
32104349SphkAC_CONFIG_SRCDIR(Makefile.in)
33104349SphkAC_CONFIG_AUX_DIR(conftools)
34247513SdelphijAC_CONFIG_MACRO_DIR([m4])
35104349Sphk
36104349Sphk
37104349Sphkdnl
38104349Sphkdnl Increment LIBREVISION if source code has changed at all
39104349Sphkdnl
40104349Sphkdnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0
41104349Sphkdnl
42104349Sphkdnl If the API changes compatibly (i.e. simply adding a new function
43104349Sphkdnl without changing or removing earlier interfaces), then increment LIBAGE.
44104349Sphkdnl 
45104349Sphkdnl If the API changes incompatibly set LIBAGE back to 0
46104349Sphkdnl
47104349Sphk
48247513SdelphijLIBCURRENT=7
49247513SdelphijLIBREVISION=0
50247513SdelphijLIBAGE=6
51104349Sphk
52104349SphkAC_CONFIG_HEADER(expat_config.h)
53104349Sphk
54104349Sphksinclude(conftools/ac_c_bigendian_cross.m4)
55104349Sphk
56104349SphkAC_LIBTOOL_WIN32_DLL
57104349SphkAC_PROG_LIBTOOL
58104349Sphk
59104349SphkAC_SUBST(LIBCURRENT)
60104349SphkAC_SUBST(LIBREVISION)
61104349SphkAC_SUBST(LIBAGE)
62104349Sphk
63104349Sphkdnl Checks for programs.
64104349SphkAC_PROG_CC
65247513SdelphijAC_PROG_CXX
66104349SphkAC_PROG_INSTALL
67104349Sphk
68104349Sphkif test "$GCC" = yes ; then
69104349Sphk    dnl
70104349Sphk    dnl Be careful about adding the -fexceptions option; some versions of
71104349Sphk    dnl GCC don't support it and it causes extra warnings that are only
72104349Sphk    dnl distracting; avoid.
73104349Sphk    dnl
74104349Sphk    OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
75104349Sphk    CFLAGS="$OLDCFLAGS -fexceptions"
76178848Scokane    AC_MSG_CHECKING(whether $CC accepts -fexceptions)
77178848Scokane    AC_TRY_LINK( , ,
78104349Sphk                   AC_MSG_RESULT(yes),
79104349Sphk                   AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
80178848Scokane    CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
81104349Sphkfi
82104349Sphk
83104349Sphkdnl Checks for header files.
84104349SphkAC_HEADER_STDC
85104349Sphk
86104349Sphkdnl Checks for typedefs, structures, and compiler characteristics.
87104349Sphk
88104349Sphkdnl Note: Avoid using AC_C_BIGENDIAN because it does not
89104349Sphkdnl work in a cross compile.
90104349SphkAC_C_BIGENDIAN_CROSS
91104349Sphk
92104349SphkAC_C_CONST
93104349SphkAC_TYPE_SIZE_T
94178848ScokaneAC_CHECK_FUNCS(memmove bcopy)
95104349Sphk
96178848Scokanednl Only needed for xmlwf:
97178848ScokaneAC_CHECK_HEADERS(fcntl.h unistd.h)
98178848ScokaneAC_TYPE_OFF_T
99104349SphkAC_FUNC_MMAP
100104349Sphk
101104349Sphkif test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then
102104349Sphk    FILEMAP=unixfilemap
103104349Sphkelse
104104349Sphk    FILEMAP=readfilemap
105104349Sphkfi
106104349SphkAC_SUBST(FILEMAP)
107104349Sphk
108178848Scokanednl Needed for the test support code; this was found at
109178848Scokanednl http://lists.gnu.org/archive/html/bug-autoconf/2002-07/msg00028.html
110104349Sphk
111178848Scokane# AC_CPP_FUNC
112178848Scokane# ------------------ #
113178848Scokane# Checks to see if ANSI C99 CPP variable __func__ works.
114178848Scokane# If not, perhaps __FUNCTION__ works instead. 
115178848Scokane# If not, we'll just define __func__ to "". 
116178848ScokaneAC_DEFUN([AC_CPP_FUNC],
117178848Scokane[AC_REQUIRE([AC_PROG_CC_STDC])dnl
118178848ScokaneAC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func,
119178848Scokane[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
120178848Scokane[[char *foo = __func__;]])],
121178848Scokane  [ac_cv_cpp_func=yes], 
122178848Scokane  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
123178848Scokane[[char *foo = __FUNCTION__;]])],
124178848Scokane  [ac_cv_cpp_func=__FUNCTION__], 
125178848Scokane  [ac_cv_cpp_func=no])])])
126178848Scokaneif test $ac_cv_cpp_func = __FUNCTION__; then
127178848Scokane  AC_DEFINE(__func__,__FUNCTION__,
128178848Scokane            [Define to __FUNCTION__ or "" if `__func__' does not conform to 
129178848ScokaneANSI C.])
130178848Scokaneelif test $ac_cv_cpp_func = no; then
131178848Scokane  AC_DEFINE(__func__,"",
132178848Scokane            [Define to __FUNCTION__ or "" if `__func__' does not conform to 
133178848ScokaneANSI C.])
134178848Scokanefi
135178848Scokane])# AC_CPP_FUNC
136178848Scokane
137178848ScokaneAC_CPP_FUNC
138178848Scokane
139178848Scokane
140178848Scokanednl Some basic configuration:
141104349SphkAC_DEFINE([XML_NS], 1,
142104349Sphk          [Define to make XML Namespaces functionality available.])
143104349SphkAC_DEFINE([XML_DTD], 1,
144104349Sphk          [Define to make parameter entity parsing functionality available.])
145104349SphkAC_DEFINE([XML_CONTEXT_BYTES], 1024,
146104349Sphk          [Define to specify how much context to retain around the current parse point.])
147104349Sphk
148247513SdelphijAC_CONFIG_FILES([Makefile expat.pc])
149104349SphkAC_OUTPUT
150104349Sphk
151104349Sphkabs_srcdir="`cd $srcdir && pwd`"
152104349Sphkabs_builddir="`pwd`"
153104349Sphkif test "$abs_srcdir" != "$abs_builddir"; then
154104349Sphk  make mkdir-init
155104349Sphkfi
156