configure.in revision 178848
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
13104349Sphkdnl Ensure that Expat is configured with autoconf 2.52 or newer
14104349SphkAC_PREREQ(2.52)
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)],
28178848Scokane                              [2.0.x]))
29178848ScokaneAC_INIT(expat, expat_version, expat-bugs@libexpat.org)
30104349Sphkundefine([expat_version])
31104349Sphk
32104349SphkAC_CONFIG_SRCDIR(Makefile.in)
33104349SphkAC_CONFIG_AUX_DIR(conftools)
34104349Sphk
35104349Sphk
36104349Sphkdnl
37104349Sphkdnl Increment LIBREVISION if source code has changed at all
38104349Sphkdnl
39104349Sphkdnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0
40104349Sphkdnl
41104349Sphkdnl If the API changes compatibly (i.e. simply adding a new function
42104349Sphkdnl without changing or removing earlier interfaces), then increment LIBAGE.
43104349Sphkdnl 
44104349Sphkdnl If the API changes incompatibly set LIBAGE back to 0
45104349Sphkdnl
46104349Sphk
47178848ScokaneLIBCURRENT=6
48178848ScokaneLIBREVISION=2
49178848ScokaneLIBAGE=5
50104349Sphk
51104349SphkAC_CONFIG_HEADER(expat_config.h)
52104349Sphk
53104349Sphksinclude(conftools/libtool.m4)
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
65104349SphkAC_PROG_INSTALL
66104349Sphk
67104349Sphkif test "$GCC" = yes ; then
68104349Sphk    dnl
69104349Sphk    dnl Be careful about adding the -fexceptions option; some versions of
70104349Sphk    dnl GCC don't support it and it causes extra warnings that are only
71104349Sphk    dnl distracting; avoid.
72104349Sphk    dnl
73104349Sphk    OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
74104349Sphk    CFLAGS="$OLDCFLAGS -fexceptions"
75178848Scokane    AC_MSG_CHECKING(whether $CC accepts -fexceptions)
76178848Scokane    AC_TRY_LINK( , ,
77104349Sphk                   AC_MSG_RESULT(yes),
78104349Sphk                   AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
79178848Scokane    CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
80104349Sphkfi
81104349Sphk
82104349Sphkdnl Checks for header files.
83104349SphkAC_HEADER_STDC
84104349Sphk
85104349Sphkdnl Checks for typedefs, structures, and compiler characteristics.
86104349Sphk
87104349Sphkdnl Note: Avoid using AC_C_BIGENDIAN because it does not
88104349Sphkdnl work in a cross compile.
89104349SphkAC_C_BIGENDIAN_CROSS
90104349Sphk
91104349SphkAC_C_CONST
92104349SphkAC_TYPE_SIZE_T
93178848ScokaneAC_CHECK_FUNCS(memmove bcopy)
94104349Sphk
95178848Scokanednl Only needed for xmlwf:
96178848ScokaneAC_CHECK_HEADERS(fcntl.h unistd.h)
97178848ScokaneAC_TYPE_OFF_T
98104349SphkAC_FUNC_MMAP
99104349Sphk
100104349Sphkif test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then
101104349Sphk    FILEMAP=unixfilemap
102104349Sphkelse
103104349Sphk    FILEMAP=readfilemap
104104349Sphkfi
105104349SphkAC_SUBST(FILEMAP)
106104349Sphk
107178848Scokanednl Needed for the test support code; this was found at
108178848Scokanednl http://lists.gnu.org/archive/html/bug-autoconf/2002-07/msg00028.html
109104349Sphk
110178848Scokane# AC_CPP_FUNC
111178848Scokane# ------------------ #
112178848Scokane# Checks to see if ANSI C99 CPP variable __func__ works.
113178848Scokane# If not, perhaps __FUNCTION__ works instead. 
114178848Scokane# If not, we'll just define __func__ to "". 
115178848ScokaneAC_DEFUN([AC_CPP_FUNC],
116178848Scokane[AC_REQUIRE([AC_PROG_CC_STDC])dnl
117178848ScokaneAC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func,
118178848Scokane[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
119178848Scokane[[char *foo = __func__;]])],
120178848Scokane  [ac_cv_cpp_func=yes], 
121178848Scokane  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
122178848Scokane[[char *foo = __FUNCTION__;]])],
123178848Scokane  [ac_cv_cpp_func=__FUNCTION__], 
124178848Scokane  [ac_cv_cpp_func=no])])])
125178848Scokaneif test $ac_cv_cpp_func = __FUNCTION__; then
126178848Scokane  AC_DEFINE(__func__,__FUNCTION__,
127178848Scokane            [Define to __FUNCTION__ or "" if `__func__' does not conform to 
128178848ScokaneANSI C.])
129178848Scokaneelif test $ac_cv_cpp_func = no; then
130178848Scokane  AC_DEFINE(__func__,"",
131178848Scokane            [Define to __FUNCTION__ or "" if `__func__' does not conform to 
132178848ScokaneANSI C.])
133178848Scokanefi
134178848Scokane])# AC_CPP_FUNC
135178848Scokane
136178848ScokaneAC_CPP_FUNC
137178848Scokane
138178848Scokane
139178848Scokanednl Some basic configuration:
140104349SphkAC_DEFINE([XML_NS], 1,
141104349Sphk          [Define to make XML Namespaces functionality available.])
142104349SphkAC_DEFINE([XML_DTD], 1,
143104349Sphk          [Define to make parameter entity parsing functionality available.])
144104349SphkAC_DEFINE([XML_CONTEXT_BYTES], 1024,
145104349Sphk          [Define to specify how much context to retain around the current parse point.])
146104349Sphk
147104349SphkAC_CONFIG_FILES(Makefile)
148104349SphkAC_OUTPUT
149104349Sphk
150104349Sphkabs_srcdir="`cd $srcdir && pwd`"
151104349Sphkabs_builddir="`pwd`"
152104349Sphkif test "$abs_srcdir" != "$abs_builddir"; then
153104349Sphk  make mkdir-init
154104349Sphkfi
155