configure.ac 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. dnl Ensure that Expat is configured with autoconf 2.58 or newer
  13. AC_PREREQ(2.58)
  14. dnl Get the version number of Expat, using m4's esyscmd() command to run
  15. dnl the command at m4-generation time. This allows us to create an m4
  16. dnl symbol holding the correct version number. AC_INIT() requires the
  17. dnl version number at m4-time, rather than when ./configure is run, so
  18. dnl all this must happen as part of m4, not as part of the shell code
  19. dnl contained in ./configure.
  20. dnl
  21. dnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate
  22. dnl test. I believe this test will work, but I don't have a place with non-
  23. dnl GNU M4 to test it right now.
  24. define([expat_version], ifdef([__gnu__],
  25. [esyscmd(conftools/get-version.sh lib/expat.h)],
  26. [2.2.x]))
  27. AC_INIT(expat, expat_version, expat-bugs@libexpat.org)
  28. undefine([expat_version])
  29. AC_CONFIG_SRCDIR(Makefile.in)
  30. AC_CONFIG_AUX_DIR(conftools)
  31. AC_CONFIG_MACRO_DIR([m4])
  32. dnl
  33. dnl Increment LIBREVISION if source code has changed at all
  34. dnl
  35. dnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0
  36. dnl
  37. dnl If the API changes compatibly (i.e. simply adding a new function
  38. dnl without changing or removing earlier interfaces), then increment LIBAGE.
  39. dnl
  40. dnl If the API changes incompatibly set LIBAGE back to 0
  41. dnl
  42. LIBCURRENT=7 # sync
  43. LIBREVISION=3 # with
  44. LIBAGE=6 # CMakeLists.txt!
  45. AC_CONFIG_HEADER(expat_config.h)
  46. sinclude(conftools/ac_c_bigendian_cross.m4)
  47. AC_LIBTOOL_WIN32_DLL
  48. AC_PROG_LIBTOOL
  49. AC_SUBST(LIBCURRENT)
  50. AC_SUBST(LIBREVISION)
  51. AC_SUBST(LIBAGE)
  52. dnl Checks for programs.
  53. AC_PROG_CC
  54. AC_PROG_CXX
  55. AC_PROG_INSTALL
  56. if test "$GCC" = yes ; then
  57. dnl
  58. dnl Be careful about adding the -fexceptions option; some versions of
  59. dnl GCC don't support it and it causes extra warnings that are only
  60. dnl distracting; avoid.
  61. dnl
  62. OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
  63. CFLAGS="$OLDCFLAGS -fexceptions"
  64. AC_MSG_CHECKING(whether $CC accepts -fexceptions)
  65. AC_TRY_LINK( , ,
  66. AC_MSG_RESULT(yes),
  67. AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
  68. if test "x$CXXFLAGS" = x ; then
  69. CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
  70. fi
  71. CFLAGS="${CFLAGS} -fno-strict-aliasing"
  72. CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"
  73. LDFLAGS="${LDFLAGS} -fno-strict-aliasing"
  74. fi
  75. dnl Checks for header files.
  76. AC_HEADER_STDC
  77. dnl Checks for typedefs, structures, and compiler characteristics.
  78. dnl Note: Avoid using AC_C_BIGENDIAN because it does not
  79. dnl work in a cross compile.
  80. AC_C_BIGENDIAN_CROSS
  81. AC_C_CONST
  82. AC_TYPE_SIZE_T
  83. AC_CHECK_FUNCS(memmove bcopy)
  84. AC_ARG_WITH([libbsd], [
  85. AS_HELP_STRING([--with-libbsd], [utilize libbsd (for arc4random_buf)])
  86. ], [], [with_libbsd=no])
  87. AS_IF([test "x${with_libbsd}" != xno], [
  88. AC_CHECK_LIB([bsd], [arc4random_buf], [], [
  89. AS_IF([test "x${with_libbsd}" = xyes], [
  90. AC_MSG_ERROR([Enforced use of libbsd cannot be satisfied.])
  91. ])
  92. ])
  93. ])
  94. AC_MSG_CHECKING([for arc4random_buf (BSD or libbsd)])
  95. AC_LINK_IFELSE([AC_LANG_SOURCE([
  96. #include <stdlib.h> /* for arc4random_buf on BSD, for NULL */
  97. #if defined(HAVE_LIBBSD)
  98. # include <bsd/stdlib.h>
  99. #endif
  100. int main() {
  101. arc4random_buf(NULL, 0U);
  102. return 0;
  103. }
  104. ])], [
  105. AC_DEFINE([HAVE_ARC4RANDOM_BUF], [1],
  106. [Define to 1 if you have the `arc4random_buf' function.])
  107. AC_MSG_RESULT([yes])
  108. ], [
  109. AC_MSG_RESULT([no])
  110. ])
  111. AC_MSG_CHECKING([for getrandom (Linux 3.17+, glibc 2.25+)])
  112. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  113. #include <stdlib.h> /* for NULL */
  114. #include <sys/random.h>
  115. int main() {
  116. return getrandom(NULL, 0U, 0U);
  117. }
  118. ])], [
  119. AC_DEFINE([HAVE_GETRANDOM], [1],
  120. [Define to 1 if you have the `getrandom' function.])
  121. AC_MSG_RESULT([yes])
  122. ], [
  123. AC_MSG_RESULT([no])
  124. AC_MSG_CHECKING([for syscall SYS_getrandom (Linux 3.17+)])
  125. AC_LINK_IFELSE([AC_LANG_SOURCE([
  126. #include <stdlib.h> /* for NULL */
  127. #include <unistd.h> /* for syscall */
  128. #include <sys/syscall.h> /* for SYS_getrandom */
  129. int main() {
  130. syscall(SYS_getrandom, NULL, 0, 0);
  131. return 0;
  132. }
  133. ])], [
  134. AC_DEFINE([HAVE_SYSCALL_GETRANDOM], [1],
  135. [Define to 1 if you have `syscall' and `SYS_getrandom'.])
  136. AC_MSG_RESULT([yes])
  137. ], [
  138. AC_MSG_RESULT([no])
  139. ])
  140. ])
  141. dnl Only needed for xmlwf:
  142. AC_CHECK_HEADERS(fcntl.h unistd.h)
  143. AC_TYPE_OFF_T
  144. AC_FUNC_MMAP
  145. if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then
  146. FILEMAP=unixfilemap
  147. else
  148. FILEMAP=readfilemap
  149. fi
  150. AC_SUBST(FILEMAP)
  151. dnl Needed for the test support code; this was found at
  152. dnl http://lists.gnu.org/archive/html/bug-autoconf/2002-07/msg00028.html
  153. # AC_CPP_FUNC
  154. # ------------------ #
  155. # Checks to see if ANSI C99 CPP variable __func__ works.
  156. # If not, perhaps __FUNCTION__ works instead.
  157. # If not, we'll just define __func__ to "".
  158. AC_DEFUN([AC_CPP_FUNC],
  159. [AC_REQUIRE([AC_PROG_CC_STDC])dnl
  160. AC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func,
  161. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
  162. [[const char *foo = __func__;]])],
  163. [ac_cv_cpp_func=yes],
  164. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
  165. [[const char *foo = __FUNCTION__;]])],
  166. [ac_cv_cpp_func=__FUNCTION__],
  167. [ac_cv_cpp_func=no])])])
  168. if test $ac_cv_cpp_func = __FUNCTION__; then
  169. AC_DEFINE(__func__,__FUNCTION__,
  170. [Define to __FUNCTION__ or "" if `__func__' does not conform to
  171. ANSI C.])
  172. elif test $ac_cv_cpp_func = no; then
  173. AC_DEFINE(__func__,"",
  174. [Define to __FUNCTION__ or "" if `__func__' does not conform to
  175. ANSI C.])
  176. fi
  177. ])# AC_CPP_FUNC
  178. AC_CPP_FUNC
  179. dnl Some basic configuration:
  180. AC_DEFINE([XML_NS], 1,
  181. [Define to make XML Namespaces functionality available.])
  182. AC_DEFINE([XML_DTD], 1,
  183. [Define to make parameter entity parsing functionality available.])
  184. AC_ARG_ENABLE([xml-context],
  185. AS_HELP_STRING([--enable-xml-context @<:@COUNT@:>@],
  186. [Retain context around the current parse point;
  187. default is enabled and a size of 1024 bytes])
  188. AS_HELP_STRING([--disable-xml-context],
  189. [Do not retain context around the current parse point]),
  190. [enable_xml_context=${enableval}])
  191. AS_IF([test "x${enable_xml_context}" != "xno"], [
  192. AS_IF([test "x${enable_xml_context}" == "xyes" \
  193. -o "x${enable_xml_context}" == "x"], [
  194. enable_xml_context=1024
  195. ])
  196. AC_DEFINE_UNQUOTED([XML_CONTEXT_BYTES], [${enable_xml_context}],
  197. [Define to specify how much context to retain around the current parse point.])
  198. ])
  199. AC_CONFIG_FILES([Makefile expat.pc])
  200. AC_CONFIG_FILES([run.sh], [chmod +x run.sh])
  201. AC_OUTPUT
  202. abs_srcdir="`cd $srcdir && pwd`"
  203. abs_builddir="`pwd`"
  204. if test "$abs_srcdir" != "$abs_builddir"; then
  205. make mkdir-init
  206. fi