configure.ac 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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, [email protected])
  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=4 # 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_C99
  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_LINK_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 Some basic configuration:
  152. AC_DEFINE([XML_NS], 1,
  153. [Define to make XML Namespaces functionality available.])
  154. AC_DEFINE([XML_DTD], 1,
  155. [Define to make parameter entity parsing functionality available.])
  156. AC_ARG_ENABLE([xml-context],
  157. AS_HELP_STRING([--enable-xml-context @<:@COUNT@:>@],
  158. [Retain context around the current parse point;
  159. default is enabled and a size of 1024 bytes])
  160. AS_HELP_STRING([--disable-xml-context],
  161. [Do not retain context around the current parse point]),
  162. [enable_xml_context=${enableval}])
  163. AS_IF([test "x${enable_xml_context}" != "xno"], [
  164. AS_IF([test "x${enable_xml_context}" = "xyes" \
  165. -o "x${enable_xml_context}" = "x"], [
  166. enable_xml_context=1024
  167. ])
  168. AC_DEFINE_UNQUOTED([XML_CONTEXT_BYTES], [${enable_xml_context}],
  169. [Define to specify how much context to retain around the current parse point.])
  170. ])
  171. AC_CONFIG_FILES([Makefile expat.pc])
  172. AC_CONFIG_FILES([run.sh], [chmod +x run.sh])
  173. AC_OUTPUT
  174. abs_srcdir="`cd $srcdir && pwd`"
  175. abs_builddir="`pwd`"
  176. if test "$abs_srcdir" != "$abs_builddir"; then
  177. make mkdir-init
  178. fi