1 dnl configuration script for expat
2 dnl Process this file with autoconf to produce a configure script.
4 dnl Copyright 2000 Clark Cooper
6 dnl This file is part of EXPAT.
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.
13 dnl Ensure that Expat is configured with autoconf 2.58 or newer
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.
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)],
29 AC_INIT(expat, expat_version, expat-bugs@libexpat.org)
30 undefine([expat_version])
32 AC_CONFIG_SRCDIR(Makefile.in)
33 AC_CONFIG_AUX_DIR(conftools)
35 AC_CONFIG_MACRO_DIR([m4])
39 dnl Increment LIBREVISION if source code has changed at all
41 dnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0
43 dnl If the API changes compatibly (i.e. simply adding a new function
44 dnl without changing or removing earlier interfaces), then increment LIBAGE.
46 dnl If the API changes incompatibly set LIBAGE back to 0
51 LIBAGE=6 # CMakeLists.txt!
53 CPPFLAGS="${CPPFLAGS} -DHAVE_EXPAT_CONFIG_H"
54 AC_CONFIG_HEADER(expat_config.h)
56 sinclude(conftools/ac_c_bigendian_cross.m4)
65 dnl Checks for programs.
70 if test "$GCC" = yes ; then
72 dnl Be careful about adding the -fexceptions option; some versions of
73 dnl GCC don't support it and it causes extra warnings that are only
74 dnl distracting; avoid.
76 OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
77 CFLAGS="$OLDCFLAGS -fexceptions"
78 AC_MSG_CHECKING(whether $CC accepts -fexceptions)
81 AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
82 if test "x$CXXFLAGS" = x ; then
83 CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
86 CFLAGS="${CFLAGS} -fno-strict-aliasing"
87 CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"
88 LDFLAGS="${LDFLAGS} -fno-strict-aliasing"
91 dnl Checks for header files.
94 dnl Checks for typedefs, structures, and compiler characteristics.
96 dnl Note: Avoid using AC_C_BIGENDIAN because it does not
97 dnl work in a cross compile.
102 AC_CHECK_FUNCS(memmove bcopy)
105 AC_ARG_WITH([xmlwf], [
106 AS_HELP_STRING([--without-xmlwf], [do not build xmlwf])], [], [with_xmlwf=yes])
107 AM_CONDITIONAL([WITH_XMLWF], [test x${with_xmlwf} = xyes])
109 AM_CONDITIONAL([MINGW], [echo -- "${host}" | ${FGREP} mingw >/dev/null])
110 AM_CONDITIONAL([UNICODE], [echo -- "${CPPFLAGS}${CFLAGS}" | ${FGREP} XML_UNICODE >/dev/null])
113 AC_ARG_WITH([libbsd], [
114 AS_HELP_STRING([--with-libbsd], [utilize libbsd (for arc4random_buf)])
115 ], [], [with_libbsd=no])
116 AS_IF([test "x${with_libbsd}" != xno], [
117 AC_CHECK_LIB([bsd], [arc4random_buf], [], [
118 AS_IF([test "x${with_libbsd}" = xyes], [
119 AC_MSG_ERROR([Enforced use of libbsd cannot be satisfied.])
123 AC_MSG_CHECKING([for arc4random_buf (BSD or libbsd)])
124 AC_LINK_IFELSE([AC_LANG_SOURCE([
125 #include <stdlib.h> /* for arc4random_buf on BSD, for NULL */
126 #if defined(HAVE_LIBBSD)
127 # include <bsd/stdlib.h>
130 arc4random_buf(NULL, 0U);
134 AC_DEFINE([HAVE_ARC4RANDOM_BUF], [1],
135 [Define to 1 if you have the `arc4random_buf' function.])
140 AC_MSG_CHECKING([for arc4random (BSD, macOS or libbsd)])
141 AC_LINK_IFELSE([AC_LANG_SOURCE([
142 #if defined(HAVE_LIBBSD)
143 # include <bsd/stdlib.h>
152 AC_DEFINE([HAVE_ARC4RANDOM], [1],
153 [Define to 1 if you have the `arc4random' function.])
161 AC_MSG_CHECKING([for getrandom (Linux 3.17+, glibc 2.25+)])
162 AC_LINK_IFELSE([AC_LANG_SOURCE([
163 #include <stdlib.h> /* for NULL */
164 #include <sys/random.h>
166 return getrandom(NULL, 0U, 0U);
169 AC_DEFINE([HAVE_GETRANDOM], [1],
170 [Define to 1 if you have the `getrandom' function.])
175 AC_MSG_CHECKING([for syscall SYS_getrandom (Linux 3.17+)])
176 AC_LINK_IFELSE([AC_LANG_SOURCE([
177 #include <stdlib.h> /* for NULL */
178 #include <unistd.h> /* for syscall */
179 #include <sys/syscall.h> /* for SYS_getrandom */
181 syscall(SYS_getrandom, NULL, 0, 0);
185 AC_DEFINE([HAVE_SYSCALL_GETRANDOM], [1],
186 [Define to 1 if you have `syscall' and `SYS_getrandom'.])
194 dnl Only needed for xmlwf:
195 AC_CHECK_HEADERS(fcntl.h unistd.h)
199 if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then
207 dnl Some basic configuration:
208 AC_DEFINE([XML_NS], 1,
209 [Define to make XML Namespaces functionality available.])
210 AC_DEFINE([XML_DTD], 1,
211 [Define to make parameter entity parsing functionality available.])
212 AC_DEFINE([XML_DEV_URANDOM], 1,
213 [Define to include code reading entropy from `/dev/urandom'.])
215 AC_ARG_ENABLE([xml-context],
216 AS_HELP_STRING([--enable-xml-context @<:@COUNT@:>@],
217 [Retain context around the current parse point;
218 default is enabled and a size of 1024 bytes])
219 AS_HELP_STRING([--disable-xml-context],
220 [Do not retain context around the current parse point]),
221 [enable_xml_context=${enableval}])
222 AS_IF([test "x${enable_xml_context}" != "xno"], [
223 AS_IF([test "x${enable_xml_context}" = "xyes" \
224 -o "x${enable_xml_context}" = "x"], [
225 enable_xml_context=1024
227 AC_DEFINE_UNQUOTED([XML_CONTEXT_BYTES], [${enable_xml_context}],
228 [Define to specify how much context to retain around the current parse point.])
231 AC_ARG_WITH([docbook], [AS_HELP_STRING([--with-docbook],
232 [enforce XML to man page compilation @<:@default=check@:>@])
233 AS_HELP_STRING([--without-docbook],
234 [skip XML to man page compilation @<:@default=check@:>@])],
236 [with_docbook=check])
238 AC_ARG_VAR([DOCBOOK_TO_MAN], [docbook2x-man command])
239 AS_IF([test "x$with_docbook" != xno],
240 [AC_CHECK_PROGS([DOCBOOK_TO_MAN], [docbook2x-man db2x_docbook2man docbook2man docbook-to-man])])
241 AS_IF([test "x${DOCBOOK_TO_MAN}" = x -a "x$with_docbook" = xyes],
242 [AC_MSG_ERROR([Required program 'docbook2x-man' not found.])])
243 AS_IF([test "x${DOCBOOK_TO_MAN}" != x -a "x$with_docbook" != xno],
244 [AS_IF([${DOCBOOK_TO_MAN} --help | grep -i -q -F sgmlbase],
245 [AC_MSG_ERROR([Your local ${DOCBOOK_TO_MAN} was found to work with SGML rather
246 than XML. Please install docbook2X and use variable DOCBOOK_TO_MAN to point
247 configure to command docbook2x-man of docbook2X.
248 Or use DOCBOOK_TO_MAN="xmlto man --skip-validation" if you have xmlto around.
249 You can also configure using --without-docbook if you can do without a man
250 page for xmlwf.])])])
252 AM_CONDITIONAL(WITH_DOCBOOK, [test "x${DOCBOOK_TO_MAN}" != x])
254 AC_CONFIG_FILES([Makefile expat.pc])
260 tests/benchmark/Makefile
263 AC_CONFIG_FILES([run.sh], [chmod +x run.sh])