configure.ac 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. dnl configuration script for expat
  2. dnl Process this file with autoconf to produce a configure script.
  3. dnl __ __ _
  4. dnl ___\ \/ /_ __ __ _| |_
  5. dnl / _ \\ /| '_ \ / _` | __|
  6. dnl | __// \| |_) | (_| | |_
  7. dnl \___/_/\_\ .__/ \__,_|\__|
  8. dnl |_| XML parser
  9. dnl
  10. dnl Copyright (c) 2000 Clark Cooper <[email protected]>
  11. dnl Copyright (c) 2000-2005 Fred L. Drake, Jr. <[email protected]>
  12. dnl Copyright (c) 2001-2003 Greg Stein <[email protected]>
  13. dnl Copyright (c) 2006-2012 Karl Waclawek <[email protected]>
  14. dnl Copyright (c) 2016-2025 Sebastian Pipping <[email protected]>
  15. dnl Copyright (c) 2017 S. P. Zeidler <[email protected]>
  16. dnl Copyright (c) 2017 Stephen Groat <[email protected]>
  17. dnl Copyright (c) 2017-2020 Joe Orton <[email protected]>
  18. dnl Copyright (c) 2018 Yury Gribov <[email protected]>
  19. dnl Copyright (c) 2018 Benjamin Peterson <[email protected]>
  20. dnl Copyright (c) 2018 Marco Maggi <[email protected]>
  21. dnl Copyright (c) 2018 KangLin <[email protected]>
  22. dnl Copyright (c) 2019 Mohammed Khajapasha <[email protected]>
  23. dnl Copyright (c) 2019 Kishore Kunche <[email protected]>
  24. dnl Copyright (c) 2020 Jeffrey Walton <[email protected]>
  25. dnl Copyright (c) 2024 Ferenc Géczi <[email protected]>
  26. dnl Copyright (c) 2024 Dag-Erling Smørgrav <[email protected]>
  27. dnl Copyright (c) 2025 Matthew Fernandez <[email protected]>
  28. dnl Licensed under the MIT license:
  29. dnl
  30. dnl Permission is hereby granted, free of charge, to any person obtaining
  31. dnl a copy of this software and associated documentation files (the
  32. dnl "Software"), to deal in the Software without restriction, including
  33. dnl without limitation the rights to use, copy, modify, merge, publish,
  34. dnl distribute, sublicense, and/or sell copies of the Software, and to permit
  35. dnl persons to whom the Software is furnished to do so, subject to the
  36. dnl following conditions:
  37. dnl
  38. dnl The above copyright notice and this permission notice shall be included
  39. dnl in all copies or substantial portions of the Software.
  40. dnl
  41. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  42. dnl EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  43. dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  44. dnl NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  45. dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  46. dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  47. dnl USE OR OTHER DEALINGS IN THE SOFTWARE.
  48. dnl Ensure that Expat is configured with autoconf 2.69 or newer.
  49. AC_PREREQ([2.69])
  50. dnl Get the version number of Expat, using m4's esyscmd() command to run
  51. dnl the command at m4-generation time. This allows us to create an m4
  52. dnl symbol holding the correct version number. AC_INIT requires the
  53. dnl version number at m4-time, rather than when ./configure is run, so
  54. dnl all this must happen as part of m4, not as part of the shell code
  55. dnl contained in ./configure.
  56. dnl
  57. dnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate
  58. dnl test. I believe this test will work, but I don't have a place with non-
  59. dnl GNU M4 to test it right now.
  60. m4_define([expat_version],
  61. m4_ifdef([__gnu__],
  62. [esyscmd(conftools/get-version.sh lib/expat.h)],
  63. [2.2.x]))
  64. AC_INIT([expat], expat_version, [https://github.com/libexpat/libexpat/issues])
  65. m4_undefine([expat_version])
  66. AC_CONFIG_SRCDIR([Makefile.in])
  67. AC_CONFIG_AUX_DIR([conftools])
  68. AC_CONFIG_MACRO_DIR([m4])
  69. AC_CANONICAL_HOST
  70. AM_INIT_AUTOMAKE
  71. AM_MAINTAINER_MODE([enable]) # to allow argument --disable-maintainer-mode
  72. dnl
  73. dnl Increment LIBREVISION if source code has changed at all
  74. dnl
  75. dnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0
  76. dnl
  77. dnl If the API changes compatibly (i.e. simply adding a new function
  78. dnl without changing or removing earlier interfaces), then increment LIBAGE.
  79. dnl
  80. dnl If the API changes incompatibly set LIBAGE back to 0
  81. dnl
  82. LIBCURRENT=12 # sync
  83. LIBREVISION=1 # with
  84. LIBAGE=11 # CMakeLists.txt!
  85. AC_CONFIG_HEADERS([expat_config.h])
  86. AH_TOP([#ifndef EXPAT_CONFIG_H
  87. #define EXPAT_CONFIG_H 1])
  88. AH_BOTTOM([#endif // ndef EXPAT_CONFIG_H])
  89. AM_PROG_AR
  90. AC_PROG_INSTALL
  91. AC_PROG_MAKE_SET
  92. LT_PREREQ([2.4])
  93. LT_INIT([win32-dll])
  94. AC_SUBST(LIBCURRENT)
  95. AC_SUBST(LIBREVISION)
  96. AC_SUBST(LIBAGE)
  97. AC_LANG([C])
  98. AC_PROG_CC_C99
  99. AS_IF([test "${ac_cv_prog_cc_c99}" = no],
  100. [AC_MSG_ERROR([Expat requires a C99 compiler.])])
  101. AS_IF([test "$GCC" = yes],
  102. [AX_APPEND_COMPILE_FLAGS([-Wall -Wextra], [AM_CFLAGS])
  103. dnl Be careful about adding the -fexceptions option; some versions of
  104. dnl GCC don't support it and it causes extra warnings that are only
  105. dnl distracting; avoid.
  106. AX_APPEND_COMPILE_FLAGS([-fexceptions], [AM_CFLAGS])
  107. AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing -Wmissing-prototypes -Wstrict-prototypes], [AM_CFLAGS])
  108. AX_APPEND_COMPILE_FLAGS([-pedantic -Wduplicated-cond -Wduplicated-branches -Wlogical-op], [AM_CFLAGS])
  109. AX_APPEND_COMPILE_FLAGS([-Wrestrict -Wnull-dereference -Wjump-misses-init -Wdouble-promotion], [AM_CFLAGS])
  110. AX_APPEND_COMPILE_FLAGS([-Wshadow -Wformat=2 -Wno-pedantic-ms-format -Wmisleading-indentation], [AM_CFLAGS])])
  111. AC_LANG_PUSH([C++])
  112. AC_PROG_CXX
  113. AS_IF([test "$GCC" = yes],
  114. [AX_APPEND_COMPILE_FLAGS([-Wall -Wextra], [AM_CXXFLAGS])
  115. dnl Be careful about adding the -fexceptions option; some versions of
  116. dnl GCC don't support it and it causes extra warnings that are only
  117. dnl distracting; avoid.
  118. AX_APPEND_COMPILE_FLAGS([-fexceptions], [AM_CXXFLAGS])
  119. AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing], [AM_CXXFLAGS])])
  120. AC_LANG_POP([C++])
  121. AS_IF([test "$GCC" = yes],
  122. [AX_APPEND_LINK_FLAGS([-fno-strict-aliasing],[AM_LDFLAGS])])
  123. dnl patching ${archive_cmds} to affect generation of file "libtool" to fix linking with clang (issue #312)
  124. AS_CASE(["$LD"],[*clang*],
  125. [AS_CASE(["${host_os}"],
  126. [*linux*],[archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'])])
  127. EXPATCFG_COMPILER_SUPPORTS_VISIBILITY([
  128. AX_APPEND_FLAG([-fvisibility=hidden], [AM_CFLAGS])
  129. AS_IF([test "${enable_shared}" = yes],
  130. [AX_APPEND_FLAG([-DXML_ENABLE_VISIBILITY=1], [AM_CPPFLAGS])])])
  131. dnl Checks for typedefs, structures, and compiler characteristics.
  132. dnl We define BYTEORDER to 1234 when the platform is little endian; it
  133. dnl defines it to 4321 when the platform is big endian. We also define
  134. dnl WORDS_BIGENDIAN to 1 when the platform is big endian.
  135. dnl
  136. dnl A long time ago (early 2000 years) AC_C_BIGENDIAN was considered
  137. dnl wrong when cross compiling, now (2018, GNU Autoconf 2.69) we assume
  138. dnl it is fine.
  139. AC_C_BIGENDIAN([AC_DEFINE([WORDS_BIGENDIAN], 1)
  140. AS_VAR_SET([BYTEORDER], 4321)],
  141. [AS_VAR_SET([BYTEORDER], 1234)])
  142. AC_DEFINE_UNQUOTED([BYTEORDER], $BYTEORDER, [1234 = LILENDIAN, 4321 = BIGENDIAN])
  143. AC_C_CONST
  144. AC_ARG_WITH([xmlwf],
  145. [AS_HELP_STRING([--without-xmlwf], [do not build xmlwf])],
  146. [],
  147. [with_xmlwf=yes])
  148. AM_CONDITIONAL([WITH_XMLWF], [test x${with_xmlwf} = xyes])
  149. AC_ARG_WITH([examples],
  150. [AS_HELP_STRING([--without-examples], [do not build examples @<:@default=included@:>@])],
  151. [],
  152. [with_examples=yes])
  153. AM_CONDITIONAL([WITH_EXAMPLES], [test x${with_examples} = xyes])
  154. AC_ARG_WITH([tests],
  155. [AS_HELP_STRING([--without-tests], [do not build tests @<:@default=included@:>@])],
  156. [],
  157. [with_tests=yes])
  158. AM_CONDITIONAL([WITH_TESTS], [test x${with_tests} = xyes])
  159. AS_IF([test x${with_tests} = xyes],
  160. [AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])])
  161. AS_VAR_SET([EXPATCFG_ON_MINGW],[no])
  162. AS_CASE("${host_os}",
  163. [mingw*],
  164. [AS_VAR_SET([EXPATCFG_ON_MINGW],[yes])
  165. AC_MSG_NOTICE([detected OS: MinGW])])
  166. AM_CONDITIONAL([MINGW], [test x${EXPATCFG_ON_MINGW} = xyes])
  167. dnl Note: Prefix "_INTERNAL_" here means exclusive use inside of file configure.ac
  168. AM_CONDITIONAL([UNICODE], [echo -- "${CPPFLAGS}${CFLAGS}" | ${FGREP} XML_UNICODE >/dev/null])
  169. AM_CONDITIONAL([_INTERNAL_UNICODE_WCHAR_T], [echo -- "${CPPFLAGS}${CFLAGS}" | ${FGREP} XML_UNICODE_WCHAR_T >/dev/null])
  170. AM_CONDITIONAL([_INTERNAL_MIN_SIZE], [echo -- "${CPPFLAGS}${CFLAGS}" | ${FGREP} XML_MIN_SIZE >/dev/null])
  171. AM_CONDITIONAL([_INTERNAL_LARGE_SIZE], [echo -- "${CPPFLAGS}${CFLAGS}" | ${FGREP} XML_LARGE_SIZE >/dev/null])
  172. LT_LIB_M
  173. AC_ARG_WITH([libbsd],
  174. [AS_HELP_STRING([--with-libbsd], [utilize libbsd (for arc4random_buf)])],
  175. [],
  176. [with_libbsd=no])
  177. AS_IF([test "x${with_libbsd}" != xno],
  178. [AC_CHECK_LIB([bsd],
  179. [arc4random_buf],
  180. [],
  181. [AS_IF([test "x${with_libbsd}" = xyes],
  182. [AC_MSG_ERROR([Enforced use of libbsd cannot be satisfied.])])])])
  183. AC_MSG_CHECKING([for arc4random_buf (BSD, libbsd or glibc 2.36+)])
  184. AC_LINK_IFELSE([AC_LANG_SOURCE([
  185. #if defined(HAVE_LIBBSD)
  186. # include <bsd/stdlib.h>
  187. #else
  188. # include <stdlib.h> /* for arc4random_buf on BSD */
  189. #endif
  190. int main(void) {
  191. char dummy[[123]]; // double brackets for m4
  192. arc4random_buf(dummy, 0U);
  193. return 0;
  194. }
  195. ])],
  196. [AC_DEFINE([HAVE_ARC4RANDOM_BUF], [1], [Define to 1 if you have the `arc4random_buf' function.])
  197. AC_MSG_RESULT([yes])],
  198. [AC_MSG_RESULT([no])
  199. AC_MSG_CHECKING([for arc4random (BSD, macOS, libbsd or glibc 2.36+)])
  200. AC_LINK_IFELSE([AC_LANG_SOURCE([
  201. #if defined(HAVE_LIBBSD)
  202. # include <bsd/stdlib.h>
  203. #else
  204. # include <stdlib.h>
  205. #endif
  206. int main(void) {
  207. arc4random();
  208. return 0;
  209. }
  210. ])],
  211. [AC_DEFINE([HAVE_ARC4RANDOM], [1], [Define to 1 if you have the `arc4random' function.])
  212. AC_MSG_RESULT([yes])],
  213. [AC_MSG_RESULT([no])])])
  214. AC_ARG_WITH([getrandom],
  215. [AS_HELP_STRING([--with-getrandom],
  216. [enforce the use of getrandom function in the system @<:@default=check@:>@])
  217. AS_HELP_STRING([--without-getrandom],
  218. [skip auto detect of getrandom @<:@default=check@:>@])],
  219. [],
  220. [with_getrandom=check])
  221. AS_IF([test "x$with_getrandom" != xno],
  222. [AC_MSG_CHECKING([for getrandom (Linux 3.17+, glibc 2.25+)])
  223. AC_LINK_IFELSE([AC_LANG_SOURCE([
  224. #include <stdlib.h> /* for NULL */
  225. #include <sys/random.h>
  226. int main(void) {
  227. return getrandom(NULL, 0U, 0U);
  228. }
  229. ])],
  230. [AC_DEFINE([HAVE_GETRANDOM], [1], [Define to 1 if you have the `getrandom' function.])
  231. AC_MSG_RESULT([yes])],
  232. [AC_MSG_RESULT([no])
  233. AS_IF([test "x$with_getrandom" = xyes],
  234. [AC_MSG_ERROR([enforced the use of getrandom --with-getrandom, but not detected])])])])
  235. AC_ARG_WITH([sys_getrandom],
  236. [AS_HELP_STRING([--with-sys-getrandom],
  237. [enforce the use of syscall SYS_getrandom function in the system @<:@default=check@:>@])
  238. AS_HELP_STRING([--without-sys-getrandom],
  239. [skip auto detect of syscall SYS_getrandom @<:@default=check@:>@])],
  240. [],
  241. [with_sys_getrandom=check])
  242. AS_IF([test "x$with_sys_getrandom" != xno],
  243. [AC_MSG_CHECKING([for syscall SYS_getrandom (Linux 3.17+)])
  244. AC_LINK_IFELSE([AC_LANG_SOURCE([
  245. #define _GNU_SOURCE
  246. #include <stdlib.h> /* for NULL */
  247. #include <unistd.h> /* for syscall */
  248. #include <sys/syscall.h> /* for SYS_getrandom */
  249. int main(void) {
  250. syscall(SYS_getrandom, NULL, 0, 0);
  251. return 0;
  252. }
  253. ])],
  254. [AC_DEFINE([HAVE_SYSCALL_GETRANDOM], [1], [Define to 1 if you have `syscall' and `SYS_getrandom'.])
  255. AC_MSG_RESULT([yes])],
  256. [AC_MSG_RESULT([no])
  257. AS_IF([test "x$with_sys_getrandom" = xyes],
  258. [AC_MSG_ERROR([enforced the use of syscall SYS_getrandom --with-sys-getrandom, but not detected])])])])
  259. dnl Only needed for xmlwf:
  260. AC_CHECK_HEADERS(fcntl.h unistd.h)
  261. AC_TYPE_OFF_T
  262. AC_FUNC_MMAP
  263. AS_IF([test "$ac_cv_func_mmap_fixed_mapped" = "yes"],
  264. [AS_VAR_SET(FILEMAP,unixfilemap)],
  265. [AS_VAR_SET(FILEMAP,readfilemap)])
  266. AC_SUBST(FILEMAP)
  267. dnl Some basic configuration:
  268. AC_DEFINE([XML_NS], 1,
  269. [Define to make XML Namespaces functionality available.])
  270. AC_DEFINE([XML_GE], 1,
  271. [Define as 1/0 to enable/disable support for general entities.])
  272. AC_DEFINE([XML_DTD], 1,
  273. [Define to make parameter entity parsing functionality available.])
  274. AC_DEFINE([XML_DEV_URANDOM], 1,
  275. [Define to include code reading entropy from `/dev/urandom'.])
  276. AC_ARG_ENABLE([xml-attr-info],
  277. [AS_HELP_STRING([--enable-xml-attr-info],
  278. [Enable retrieving the byte offsets for attribute names and values @<:@default=no@:>@])],
  279. [],
  280. [enable_xml_attr_info=no])
  281. AS_IF([test "x${enable_xml_attr_info}" = "xyes"],
  282. [AC_DEFINE([XML_ATTR_INFO], 1,
  283. [Define to allow retrieving the byte offsets for attribute names and values.])])
  284. AC_ARG_ENABLE([xml-context],
  285. AS_HELP_STRING([--enable-xml-context @<:@COUNT@:>@],
  286. [Retain context around the current parse point;
  287. default is enabled and a size of 1024 bytes])
  288. AS_HELP_STRING([--disable-xml-context],
  289. [Do not retain context around the current parse point]),
  290. [enable_xml_context=${enableval}])
  291. AS_IF([test "x${enable_xml_context}" != "xno"],
  292. [AS_IF([test "x${enable_xml_context}" = "xyes" \
  293. -o "x${enable_xml_context}" = "x"],
  294. [AS_VAR_SET(enable_xml_context,1024)])],
  295. [AS_VAR_SET(enable_xml_context,0)])
  296. AC_DEFINE_UNQUOTED([XML_CONTEXT_BYTES], [${enable_xml_context}],
  297. [Define to specify how much context to retain around the current parse point, 0 to disable.])
  298. AC_ARG_WITH([docbook],
  299. [AS_HELP_STRING([--with-docbook],
  300. [enforce XML to man page compilation @<:@default=check@:>@])
  301. AS_HELP_STRING([--without-docbook],
  302. [skip XML to man page compilation @<:@default=check@:>@])],
  303. [],
  304. [with_docbook=check])
  305. AC_ARG_VAR([DOCBOOK_TO_MAN], [docbook2x-man command])
  306. AS_IF([test "x$with_docbook" != xno],
  307. [AC_CHECK_PROGS([DOCBOOK_TO_MAN], [docbook2x-man db2x_docbook2man docbook2man docbook-to-man])])
  308. AS_IF([test "x${DOCBOOK_TO_MAN}" = x -a "x$with_docbook" = xyes],
  309. [AC_MSG_ERROR([Required program 'docbook2x-man' not found.])])
  310. AS_IF([test "x${DOCBOOK_TO_MAN}" != x -a "x$with_docbook" != xno],
  311. [AS_IF([${DOCBOOK_TO_MAN} --help | grep -i -q -F sgmlbase],
  312. [AC_MSG_ERROR([Your local ${DOCBOOK_TO_MAN} was found to work with SGML rather
  313. than XML. Please install docbook2X and use variable DOCBOOK_TO_MAN to point
  314. configure to command docbook2x-man of docbook2X.
  315. Or use DOCBOOK_TO_MAN="xmlto man --skip-validation" if you have xmlto around.
  316. You can also configure using --without-docbook if you can do without a man
  317. page for xmlwf.])])])
  318. dnl This will make sure that a release tarball shipping a pre-rendered xmlwf man page will
  319. dnl get it installed, when no working flavor of docbook2man is available (or wanted).
  320. dnl This relies on file xmlwf.1 being at least as recent as its source file xmlwf.xml.
  321. AS_IF([test -f "${srcdir}"/doc/xmlwf.1],
  322. [AM_CONDITIONAL(WITH_MANPAGE, [true])
  323. AS_IF([test "x$with_docbook" = xno -o "x${DOCBOOK_TO_MAN}" = x],
  324. [AM_CONDITIONAL(WITH_PREBUILT_MANPAGE, [true])
  325. AM_CONDITIONAL(WITH_DISTRIBUTABLE_MANPAGE, [false])],
  326. [AM_CONDITIONAL(WITH_PREBUILT_MANPAGE, [false])
  327. AM_CONDITIONAL(WITH_DISTRIBUTABLE_MANPAGE, [true])])
  328. ],
  329. [AS_IF([test "x$with_docbook" != xno -a "x${DOCBOOK_TO_MAN}" != x],
  330. [AM_CONDITIONAL(WITH_MANPAGE, [true])
  331. AM_CONDITIONAL(WITH_DISTRIBUTABLE_MANPAGE, [true])],
  332. [AM_CONDITIONAL(WITH_MANPAGE, [false])
  333. AM_CONDITIONAL(WITH_DISTRIBUTABLE_MANPAGE, [false])])
  334. AM_CONDITIONAL(WITH_PREBUILT_MANPAGE, [false])])
  335. dnl Configure CMake file templates
  336. dnl NOTE: The *_TRUE variables read here are Automake conditionals
  337. dnl that are either set to "" when enabled or to "#" when disabled
  338. dnl (because they are used to dynamically comment out certain things)
  339. AS_IF([test "x${enable_xml_attr_info}" = xyes],
  340. [EXPAT_ATTR_INFO=ON],
  341. [EXPAT_ATTR_INFO=OFF])
  342. EXPAT_DTD=ON
  343. AS_IF([test "x${_INTERNAL_LARGE_SIZE_TRUE}" = x],
  344. [EXPAT_LARGE_SIZE=ON],
  345. [EXPAT_LARGE_SIZE=OFF])
  346. AS_IF([test "x${_INTERNAL_MIN_SIZE_TRUE}" = x],
  347. [EXPAT_MIN_SIZE=ON],
  348. [EXPAT_MIN_SIZE=OFF])
  349. EXPAT_NS=ON
  350. AS_IF([test "x${enable_xml_context}" != xno],
  351. [EXPAT_CONTEXT_BYTES=${enable_xml_context}],
  352. [EXPAT_CONTEXT_BYTES=OFF])
  353. AS_IF([test "x${UNICODE_TRUE}" = x],
  354. [AS_IF(
  355. [test "x${_INTERNAL_UNICODE_WCHAR_T_TRUE}" = x],
  356. [EXPAT_CHAR_TYPE=wchar_t],
  357. [EXPAT_CHAR_TYPE=ushort])],
  358. [EXPAT_CHAR_TYPE=char])
  359. PACKAGE_INIT="${srcdir}"/cmake/autotools/expat-package-init.cmake
  360. LIBDIR_BASENAME="$(basename "${libdir}")"
  361. SO_MAJOR="$(expr "${LIBCURRENT}" - "${LIBAGE}")"
  362. SO_MINOR="${LIBAGE}"
  363. SO_PATCH="${LIBREVISION}"
  364. AC_SUBST([EXPAT_ATTR_INFO])
  365. AC_SUBST([EXPAT_DTD])
  366. AC_SUBST([EXPAT_LARGE_SIZE])
  367. AC_SUBST([EXPAT_MIN_SIZE])
  368. AC_SUBST([EXPAT_NS])
  369. AC_SUBST([EXPAT_CONTEXT_BYTES])
  370. AC_SUBST([EXPAT_CHAR_TYPE])
  371. AC_SUBST_FILE([PACKAGE_INIT])
  372. AC_SUBST([LIBDIR_BASENAME])
  373. AC_SUBST([SO_MAJOR])
  374. AC_SUBST([SO_MINOR])
  375. AC_SUBST([SO_PATCH])
  376. dnl The canonical way of doing this is AC_CHECK_SIZEOF(void *), but
  377. dnl that adds SIZEOF_VOID_P to expat_config.h.in, making it difficult
  378. dnl to have 32-bit and 64-bit versions of libexpat installed on the
  379. dnl same system with a single, shared copy of the header.
  380. AC_COMPUTE_INT(SIZEOF_VOID_P, [sizeof(void *)])
  381. AC_SUBST([SIZEOF_VOID_P])
  382. dnl write the Automake flags we set
  383. AC_SUBST([AM_CPPFLAGS])
  384. AC_SUBST([AM_CFLAGS])
  385. AC_SUBST([AM_CXXFLAGS])
  386. AC_SUBST([AM_LDFLAGS])
  387. dnl Emulate the use of CMAKE_SHARED_LIBRARY_PREFIX under CMake
  388. AC_MSG_CHECKING([for shared library name prefix])
  389. AS_CASE("${host_os}",
  390. [cygwin*], [CMAKE_SHARED_LIBRARY_PREFIX=cyg],
  391. [CMAKE_SHARED_LIBRARY_PREFIX=lib])
  392. AC_MSG_RESULT([${CMAKE_SHARED_LIBRARY_PREFIX}])
  393. AC_SUBST([CMAKE_SHARED_LIBRARY_PREFIX])
  394. AS_CASE("${host_os}",
  395. [darwin*], [
  396. CMAKE_SOURCE=cmake/autotools/expat__macos.cmake.in
  397. CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__macos.cmake.in
  398. ],
  399. [mingw*|cygwin*], [
  400. CMAKE_SOURCE=cmake/autotools/expat__windows.cmake.in
  401. CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__windows.cmake.in
  402. ],
  403. [
  404. CMAKE_SOURCE=cmake/autotools/expat__linux.cmake.in
  405. CMAKE_NOCONFIG_SOURCE=cmake/autotools/expat-noconfig__linux.cmake.in
  406. ])
  407. AC_CONFIG_FILES([Makefile]
  408. [expat.pc]
  409. [cmake/expat-config.cmake]
  410. [cmake/autotools/expat.cmake:${CMAKE_SOURCE}]
  411. [cmake/autotools/expat-config-version.cmake]
  412. [cmake/autotools/expat-noconfig.cmake:${CMAKE_NOCONFIG_SOURCE}]
  413. [doc/Makefile]
  414. [examples/Makefile]
  415. [lib/Makefile]
  416. [tests/Makefile]
  417. [tests/benchmark/Makefile]
  418. [xmlwf/Makefile])
  419. AC_CONFIG_FILES([run.sh], [chmod +x run.sh])
  420. AC_OUTPUT
  421. AC_MSG_NOTICE([
  422. Automake flags (can be overridden by user flags):
  423. [AM_CPPFLAGS]: ${AM_CPPFLAGS}
  424. [AM_CFLAGS]: ${AM_CFLAGS}
  425. [AM_CXXFLAGS]: ${AM_CXXFLAGS}
  426. [AM_LDFLAGS]: ${AM_LDFLAGS}
  427. User flags (override Automake flags on conflict):
  428. CPPFLAGS: ${CPPFLAGS}
  429. CFLAGS: ${CFLAGS}
  430. CXXFLAGS: ${CXXFLAGS}
  431. LDFLAGS: ${LDFLAGS}])