configure.ac 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ([2.63])
  3. m4_define([MAJOR_VERSION], 2)
  4. m4_define([MINOR_VERSION], 12)
  5. m4_define([MICRO_VERSION], 9)
  6. AC_INIT([libxml2],[MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION])
  7. AC_CONFIG_SRCDIR([entities.c])
  8. AC_CONFIG_HEADERS([config.h])
  9. AC_CONFIG_MACRO_DIR([m4])
  10. AC_CANONICAL_HOST
  11. LIBXML_MAJOR_VERSION=MAJOR_VERSION
  12. LIBXML_MINOR_VERSION=MINOR_VERSION
  13. LIBXML_MICRO_VERSION=MICRO_VERSION
  14. LIBXML_MICRO_VERSION_SUFFIX=
  15. LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
  16. LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
  17. LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
  18. if test -d .git ; then
  19. extra=`git describe 2>/dev/null | sed 's+LIBXML[[0-9.]]*-++'`
  20. echo extra=$extra
  21. if test "$extra" != ""
  22. then
  23. LIBXML_VERSION_EXTRA="-GIT$extra"
  24. fi
  25. fi
  26. AC_SUBST(LIBXML_MAJOR_VERSION)
  27. AC_SUBST(LIBXML_MINOR_VERSION)
  28. AC_SUBST(LIBXML_MICRO_VERSION)
  29. AC_SUBST(LIBXML_VERSION)
  30. AC_SUBST(LIBXML_VERSION_INFO)
  31. AC_SUBST(LIBXML_VERSION_NUMBER)
  32. AC_SUBST(LIBXML_VERSION_EXTRA)
  33. VERSION=${LIBXML_VERSION}
  34. AM_INIT_AUTOMAKE([1.16.3 foreign no-dist-gzip dist-xz])
  35. AM_MAINTAINER_MODE([enable])
  36. AM_SILENT_RULES([yes])
  37. dnl Checks for programs.
  38. AC_PROG_CC
  39. AC_PROG_INSTALL
  40. AC_PROG_LN_S
  41. AC_PROG_MKDIR_P
  42. AC_PATH_PROG(TAR, tar, /bin/tar)
  43. AC_PATH_PROG(PERL, perl, /usr/bin/perl)
  44. AC_PATH_PROG(WGET, wget, /usr/bin/wget)
  45. AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
  46. PKG_PROG_PKG_CONFIG
  47. LT_INIT([disable-static])
  48. LT_LIB_M
  49. dnl
  50. dnl We process the AC_ARG_WITH first so that later we can modify
  51. dnl some of them to try to prevent impossible combinations. This
  52. dnl also allows up so alphabetize the choices
  53. dnl
  54. AC_ARG_WITH(c14n,
  55. [ --with-c14n Canonical XML 1.0 support (on)])
  56. AC_ARG_WITH(catalog,
  57. [ --with-catalog XML Catalogs support (on)])
  58. AC_ARG_WITH(debug,
  59. [ --with-debug debugging module and shell (on)])
  60. AC_ARG_WITH(ftp,
  61. [ --with-ftp FTP support (off)])
  62. AC_ARG_WITH(history,
  63. [ --with-history history support for shell (off)])
  64. AC_ARG_WITH(readline,
  65. [ --with-readline[[=DIR]] use readline in DIR (for shell history)])
  66. AC_ARG_WITH(html,
  67. [ --with-html HTML parser (on)])
  68. AC_ARG_WITH(http,
  69. [ --with-http HTTP support (on)])
  70. AC_ARG_WITH(iconv,
  71. [ --with-iconv[[=DIR]] iconv support (on)])
  72. AC_ARG_WITH(icu,
  73. [ --with-icu ICU support (off)])
  74. AC_ARG_WITH(iso8859x,
  75. [ --with-iso8859x ISO-8859-X support if no iconv (on)])
  76. AC_ARG_WITH(lzma,
  77. [ --with-lzma[[=DIR]] use liblzma in DIR (on)])
  78. AC_ARG_WITH(mem_debug,
  79. [ --with-mem-debug memory debugging module (off)])
  80. AC_ARG_WITH(modules,
  81. [ --with-modules dynamic modules support (on)])
  82. AC_ARG_WITH(output,
  83. [ --with-output serialization support (on)])
  84. AC_ARG_WITH(pattern,
  85. [ --with-pattern xmlPattern selection interface (on)])
  86. AC_ARG_WITH(push,
  87. [ --with-push push parser interfaces (on)])
  88. AC_ARG_WITH(python,
  89. [ --with-python Python bindings (on)])
  90. AC_ARG_WITH(reader,
  91. [ --with-reader xmlReader parsing interface (on)])
  92. AC_ARG_WITH(regexps,
  93. [ --with-regexps regular expressions support (on)])
  94. AC_ARG_WITH(run_debug,
  95. [ --with-run-debug runtime debugging module (off)])
  96. AC_ARG_WITH(sax1,
  97. [ --with-sax1 older SAX1 interface (on)])
  98. AC_ARG_WITH(schemas,
  99. [ --with-schemas XML Schemas 1.0 and RELAX NG support (on)])
  100. AC_ARG_WITH(schematron,
  101. [ --with-schematron Schematron support (on)])
  102. AC_ARG_WITH(threads,
  103. [ --with-threads multithreading support (on)])
  104. AC_ARG_WITH(thread-alloc,
  105. [ --with-thread-alloc per-thread malloc hooks (off)])
  106. AC_ARG_WITH(tree,
  107. [ --with-tree DOM like tree manipulation APIs (on)])
  108. AC_ARG_WITH(valid,
  109. [ --with-valid DTD validation support (on)])
  110. AC_ARG_WITH(writer,
  111. [ --with-writer xmlWriter serialization interface (on)])
  112. AC_ARG_WITH(xinclude,
  113. [ --with-xinclude XInclude 1.0 support (on)])
  114. AC_ARG_WITH(xpath,
  115. [ --with-xpath XPath 1.0 support (on)])
  116. AC_ARG_WITH(xptr,
  117. [ --with-xptr XPointer support (on)])
  118. AC_ARG_WITH(xptr-locs,
  119. [ --with-xptr-locs XPointer ranges and points (off)])
  120. AC_ARG_WITH(zlib,
  121. [ --with-zlib[[=DIR]] use libz in DIR (on)])
  122. AC_ARG_WITH(minimum,
  123. [ --with-minimum build a minimally sized library (off)])
  124. AC_ARG_WITH(legacy,
  125. [ --with-legacy maximum ABI compatibility (off)])
  126. AC_ARG_WITH(tls,
  127. [ --with-tls thread-local storage (on)])
  128. AC_ARG_WITH(fexceptions,
  129. [ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
  130. AC_ARG_WITH(coverage,
  131. [ --with-coverage build for code coverage with GCC (off)])
  132. dnl
  133. dnl hard dependencies on options
  134. dnl
  135. if test "$with_c14n" = "yes"; then
  136. if test "$with_output" = "no"; then
  137. echo WARNING: --with-c14n overrides --without-output
  138. fi
  139. with_output=yes
  140. if test "$with_xpath" = "no"; then
  141. echo WARNING: --with-c14n overrides --without-xpath
  142. fi
  143. with_xpath=yes
  144. fi
  145. if test "$with_schemas" = "yes"; then
  146. if test "$with_pattern" = "no"; then
  147. echo WARNING: --with-schemas overrides --without-pattern
  148. fi
  149. with_pattern=yes
  150. if test "$with_regexps" = "no"; then
  151. echo WARNING: --with-schemas overrides --without-regexps
  152. fi
  153. with_regexps=yes
  154. fi
  155. if test "$with_schematron" = "yes"; then
  156. if test "$with_pattern" = "no"; then
  157. echo WARNING: --with-schematron overrides --without-pattern
  158. fi
  159. with_pattern=yes
  160. if test "$with_tree" = "no"; then
  161. echo WARNING: --with-schematron overrides --without-tree
  162. fi
  163. with_tree=yes
  164. if test "$with_xpath" = "no"; then
  165. echo WARNING: --with-schematron overrides --without-xpath
  166. fi
  167. with_xpath=yes
  168. fi
  169. if test "$with_reader" = "yes"; then
  170. if test "$with_push" = "no"; then
  171. echo WARNING: --with-reader overrides --without-push
  172. fi
  173. with_push=yes
  174. if test "$with_tree" = "no"; then
  175. echo WARNING: --with-reader overrides --without-tree
  176. fi
  177. with_tree=yes
  178. fi
  179. if test "$with_writer" = "yes"; then
  180. if test "$with_output" = "no"; then
  181. echo WARNING: --with-writer overrides --without-output
  182. fi
  183. with_output=yes
  184. if test "$with_push" = "no"; then
  185. echo WARNING: --with-writer overrides --without-push
  186. fi
  187. with_push=yes
  188. fi
  189. if test "$with_xinclude" = "yes"; then
  190. if test "$with_xpath" = "no"; then
  191. echo WARNING: --with-xinclude overrides --without-xpath
  192. fi
  193. with_xpath=yes
  194. fi
  195. if test "$with_xptr_locs" = "yes"; then
  196. if test "$with_xptr" = "no"; then
  197. echo WARNING: --with-xptr-locs overrides --without-xptr
  198. fi
  199. with_xptr=yes
  200. fi
  201. if test "$with_xptr" = "yes"; then
  202. if test "$with_xpath" = "no"; then
  203. echo WARNING: --with-xptr overrides --without-xpath
  204. fi
  205. with_xpath=yes
  206. fi
  207. if test "$with_minimum" = "yes"; then
  208. dnl
  209. dnl option to build a minimal libxml2 library
  210. dnl
  211. echo "Configuring for a minimal library"
  212. test "$with_c14n" = "" && with_c14n=no
  213. test "$with_catalog" = "" && with_catalog=no
  214. test "$with_debug" = "" && with_debug=no
  215. test "$with_fexceptions" = "" && with_fexceptions=no
  216. test "$with_history" = "" && with_history=no
  217. test "$with_html" = "" && with_html=no
  218. test "$with_http" = "" && with_http=no
  219. test "$with_iconv" = "" && with_iconv=no
  220. test "$with_iso8859x" = "" && with_iso8859x=no
  221. test "$with_lzma" = "" && with_lzma=no
  222. test "$with_mem_debug" = "" && with_mem_debug=no
  223. test "$with_output" = "" && with_output=no
  224. test "$with_pattern" = "" && with_pattern=no
  225. test "$with_push" = "" && with_push=no
  226. test "$with_python" = "" && with_python=no
  227. test "$with_reader" = "" && with_reader=no
  228. test "$with_readline" = "" && with_readline=no
  229. test "$with_regexps" = "" && with_regexps=no
  230. test "$with_run_debug" = "" && with_run_debug=no
  231. test "$with_sax1" = "" && with_sax1=no
  232. test "$with_schemas" = "" && with_schemas=no
  233. test "$with_schematron" = "" && with_schematron=no
  234. test "$with_threads" = "" && with_threads=no
  235. test "$with_thread_alloc" = "" && with_thread_alloc=no
  236. test "$with_tree" = "" && with_tree=no
  237. test "$with_valid" = "" && with_valid=no
  238. test "$with_writer" = "" && with_writer=no
  239. test "$with_xinclude" = "" && with_xinclude=no
  240. test "$with_xpath" = "" && with_xpath=no
  241. test "$with_xptr" = "" && with_xptr=no
  242. test "$with_zlib" = "" && with_zlib=no
  243. test "$with_modules" = "" && with_modules=no
  244. else
  245. dnl
  246. dnl Disable dependent modules
  247. dnl
  248. if test "$with_output" = "no"; then
  249. with_c14n=no
  250. with_writer=no
  251. fi
  252. if test "$with_pattern" = "no"; then
  253. with_schemas=no
  254. with_schematron=no
  255. fi
  256. if test "$with_push" = "no"; then
  257. with_reader=no
  258. with_writer=no
  259. fi
  260. if test "$with_regexps" = "no"; then
  261. with_schemas=no
  262. fi
  263. if test "$with_tree" = "no"; then
  264. with_reader=no
  265. with_schematron=no
  266. fi
  267. if test "$with_xpath" = "no"; then
  268. with_c14n=no
  269. with_schematron=no
  270. with_xinclude=no
  271. with_xptr=no
  272. fi
  273. fi
  274. XML_PRIVATE_LIBS=
  275. XML_PRIVATE_CFLAGS=
  276. XML_PC_LIBS=
  277. XML_PC_REQUIRES=
  278. dnl
  279. dnl Checks for header files.
  280. dnl
  281. AC_CHECK_HEADERS([stdint.h inttypes.h])
  282. AC_CHECK_HEADERS([fcntl.h unistd.h sys/stat.h])
  283. AC_CHECK_HEADERS([sys/mman.h])
  284. AC_CHECK_HEADERS([sys/socket.h netinet/in.h arpa/inet.h netdb.h])
  285. AC_CHECK_HEADERS([sys/select.h poll.h])
  286. AC_CHECK_HEADERS([sys/time.h sys/timeb.h])
  287. AC_CHECK_HEADERS([dl.h dlfcn.h])
  288. AC_CHECK_HEADERS([glob.h])
  289. AM_CONDITIONAL(WITH_GLOB, test "$ac_cv_header_glob_h" = "yes")
  290. dnl
  291. dnl Checking types
  292. dnl
  293. AC_TYPE_UINT32_T
  294. dnl Checks for library functions.
  295. AC_CHECK_FUNCS([gettimeofday ftime stat isascii mmap munmap])
  296. AH_VERBATIM([HAVE_MUNMAP_AFTER],[/* mmap() is no good without munmap() */
  297. #if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP)
  298. # undef /**/ HAVE_MMAP
  299. #endif])
  300. dnl Checking for va_copy availability
  301. AC_MSG_CHECKING([for va_copy])
  302. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
  303. va_list ap1,ap2;]], [[va_copy(ap1,ap2);]])],
  304. have_va_copy=yes,
  305. have_va_copy=no)
  306. AC_MSG_RESULT($have_va_copy)
  307. if test x"$have_va_copy" = x"yes"; then
  308. AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
  309. else
  310. AC_MSG_CHECKING([for __va_copy])
  311. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
  312. va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],
  313. have___va_copy=yes,
  314. have___va_copy=no)
  315. AC_MSG_RESULT($have___va_copy)
  316. if test x"$have___va_copy" = x"yes"; then
  317. AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
  318. fi
  319. fi
  320. dnl Checking whether va_list is an array type
  321. AC_MSG_CHECKING([whether va_list is an array type])
  322. AC_TRY_COMPILE2([
  323. #include <stdarg.h>
  324. void a(va_list * ap) {}],[
  325. va_list ap1, ap2; a(&ap1); ap2 = (va_list) ap1],[
  326. AC_MSG_RESULT(no)],[
  327. AC_MSG_RESULT(yes)
  328. AC_DEFINE([VA_LIST_IS_ARRAY], [1],[Define if va_list is an array type])])
  329. dnl
  330. dnl Checks for inet libraries
  331. dnl
  332. if test "$with_http" != "no" || test "with_ftp" = "yes"; then
  333. case "$host" in
  334. *-*-mingw*)
  335. dnl AC_SEARCH_LIBS doesn't work because of non-standard calling
  336. dnl conventions on 32-bit Windows.
  337. NET_LIBS="$NET_LIBS -lws2_32"
  338. ;;
  339. *)
  340. _libs=$LIBS
  341. AC_SEARCH_LIBS(gethostbyname, [nsl], [
  342. if test "$ac_cv_search_gethostbyname" != "none required"; then
  343. NET_LIBS="$NET_LIBS $ac_cv_search_gethostbyname"
  344. fi], [:], [$NET_LIBS])
  345. AC_SEARCH_LIBS(connect, [bsd socket inet], [
  346. if test "$ac_cv_search_connect" != "none required"; then
  347. NET_LIBS="$NET_LIBS $ac_cv_search_connect"
  348. fi], [:], [$NET_LIBS])
  349. LIBS=$_libs
  350. ;;
  351. esac
  352. dnl Determine what socket length (socklen_t) data type is
  353. AC_MSG_CHECKING([for type of socket length (socklen_t)])
  354. AC_TRY_COMPILE2([
  355. #include <stddef.h>
  356. #ifdef _WIN32
  357. #include <ws2tcpip.h>
  358. #else
  359. #include <sys/socket.h>
  360. #endif],[
  361. (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
  362. AC_MSG_RESULT(socklen_t *)
  363. XML_SOCKLEN_T=socklen_t],[
  364. AC_TRY_COMPILE2([
  365. #include <stddef.h>
  366. #include <sys/socket.h>],[
  367. (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
  368. AC_MSG_RESULT(size_t *)
  369. XML_SOCKLEN_T=size_t],[
  370. AC_TRY_COMPILE2([
  371. #include <stddef.h>
  372. #include <sys/socket.h>],[
  373. (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
  374. AC_MSG_RESULT(int *)
  375. XML_SOCKLEN_T=int],[
  376. AC_MSG_WARN(could not determine)
  377. XML_SOCKLEN_T="int"])])])
  378. AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
  379. dnl
  380. dnl Checking for availability of IPv6
  381. dnl
  382. AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
  383. if test "$with_minimum" = "yes"
  384. then
  385. enable_ipv6=no
  386. fi
  387. if test $enable_ipv6 = yes; then
  388. AC_MSG_CHECKING([whether to enable IPv6])
  389. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  390. #ifdef _WIN32
  391. #include <winsock2.h>
  392. #else
  393. #include <sys/socket.h>
  394. #ifdef HAVE_NETDB_H
  395. #include <netdb.h>
  396. #endif
  397. #endif
  398. ]], [[
  399. struct sockaddr_storage ss;
  400. socket(AF_INET6, SOCK_STREAM, 0);
  401. getaddrinfo(0, 0, 0, 0);
  402. ]])], [
  403. AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
  404. AC_MSG_RESULT([yes])], [
  405. AC_MSG_RESULT([no])]
  406. )
  407. fi
  408. fi
  409. dnl
  410. dnl Extra flags
  411. dnl
  412. XML_LIBDIR='-L${libdir}'
  413. XML_INCLUDEDIR='-I${includedir}/libxml2'
  414. XML_CFLAGS=""
  415. dnl Thread-local storage
  416. if test "$with_tls" = "yes"; then
  417. AC_COMPILE_IFELSE([
  418. AC_LANG_SOURCE([_Thread_local int v;]) ], [
  419. AC_DEFINE([XML_THREAD_LOCAL], [_Thread_local], [TLS specifier]) ], [
  420. AC_COMPILE_IFELSE([
  421. AC_LANG_SOURCE([__thread int v;]) ], [
  422. AC_DEFINE([XML_THREAD_LOCAL], [__thread], [TLS specifier]) ], [
  423. AC_COMPILE_IFELSE([
  424. AC_LANG_SOURCE([__declspec(thread) int v;]) ], [
  425. AC_DEFINE([XML_THREAD_LOCAL], [__declspec(thread)], [TLS specifier]) ], [
  426. WARN_NO_TLS=1 ])])])
  427. fi
  428. dnl Checking whether __attribute__((destructor)) is accepted by the compiler
  429. AC_MSG_CHECKING([whether __attribute__((destructor)) is accepted])
  430. AC_TRY_COMPILE2([
  431. void __attribute__((destructor))
  432. f(void) {}], [], [
  433. AC_MSG_RESULT(yes)
  434. AC_DEFINE([HAVE_ATTRIBUTE_DESTRUCTOR], [1],[Define if __attribute__((destructor)) is accepted])
  435. AC_DEFINE([ATTRIBUTE_DESTRUCTOR], [__attribute__((destructor))],[A form that will not confuse apibuild.py])],[
  436. AC_MSG_RESULT(no)])
  437. dnl
  438. dnl Linker version scripts for symbol versioning
  439. dnl
  440. VERSION_SCRIPT_FLAGS=
  441. # lt_cv_prog_gnu_ld is from libtool 2.+
  442. if test "$lt_cv_prog_gnu_ld" = yes; then
  443. case $host in
  444. *-*-cygwin* | *-*-mingw* | *-*-msys* )
  445. ;;
  446. *)
  447. dnl lld 16 defaults to --no-undefined-version but the version script
  448. dnl can contain symbols disabled by configuration options.
  449. AX_APPEND_LINK_FLAGS([-Wl,--undefined-version], [VERSION_SCRIPT_FLAGS])
  450. AX_APPEND_FLAG([-Wl,--version-script=], [VERSION_SCRIPT_FLAGS])
  451. ;;
  452. esac
  453. else
  454. case $host in
  455. *-*-sunos*) VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,";;
  456. esac
  457. fi
  458. AC_SUBST(VERSION_SCRIPT_FLAGS)
  459. AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
  460. dnl
  461. dnl Workaround for native compilers
  462. dnl HP : http://bugs.gnome.org/db/31/3163.html
  463. dnl DEC : Enable NaN/Inf
  464. dnl
  465. if test "${GCC}" != "yes" ; then
  466. case "${host}" in
  467. hppa*-*-hpux* )
  468. AM_CFLAGS="${AM_CFLAGS} -Wp,-H30000"
  469. ;;
  470. *-dec-osf* )
  471. AM_CFLAGS="${AM_CFLAGS} -ieee"
  472. ;;
  473. alpha*-*-linux* )
  474. AM_CFLAGS="${AM_CFLAGS} -ieee"
  475. ;;
  476. esac
  477. else
  478. if test "$with_fexceptions" = "yes"
  479. then
  480. #
  481. # Not activated by default because this inflates the code size
  482. # Used to allow propagation of C++ exceptions through the library
  483. #
  484. AM_CFLAGS="${AM_CFLAGS} -fexceptions"
  485. fi
  486. # warnings we'd like to see
  487. AM_CFLAGS="${AM_CFLAGS} -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
  488. # warnings we'd like to suppress
  489. AM_CFLAGS="${AM_CFLAGS} -Wno-long-long -Wno-format-extra-args"
  490. case "${host}" in
  491. alpha*-*-linux* )
  492. AM_CFLAGS="${AM_CFLAGS} -mieee"
  493. ;;
  494. alpha*-*-osf* )
  495. AM_CFLAGS="${AM_CFLAGS} -mieee"
  496. ;;
  497. esac
  498. fi
  499. case ${host} in
  500. *-*-solaris*)
  501. XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
  502. ;;
  503. hppa*-hp-mpeix)
  504. NEED_TRIO=1
  505. ;;
  506. *-*-cygwin* | *-*-mingw* | *-*-msys* )
  507. # If the host is Windows, and shared libraries are disabled, we
  508. # need to add -DLIBXML_STATIC to AM_CFLAGS in order for linking to
  509. # work properly (without it, xmlexports.h would force the use of
  510. # DLL imports, which obviously aren't present in a static
  511. # library).
  512. if test "x$enable_shared" = "xno"; then
  513. XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
  514. AM_CFLAGS="$AM_CFLAGS -DLIBXML_STATIC"
  515. fi
  516. ;;
  517. esac
  518. dnl
  519. dnl Simple API modules
  520. dnl
  521. if test "$with_tree" = "no" ; then
  522. echo Disabling DOM like tree manipulation APIs
  523. WITH_TREE=0
  524. else
  525. WITH_TREE=1
  526. fi
  527. AC_SUBST(WITH_TREE)
  528. if test "$with_ftp" != "yes" ; then
  529. WITH_FTP=0
  530. else
  531. echo Enabling FTP support
  532. WITH_FTP=1
  533. fi
  534. AC_SUBST(WITH_FTP)
  535. AM_CONDITIONAL(WITH_FTP_SOURCES, test "$WITH_FTP" = "1")
  536. if test "$with_http" = "no" ; then
  537. echo Disabling HTTP support
  538. WITH_HTTP=0
  539. else
  540. WITH_HTTP=1
  541. fi
  542. AC_SUBST(WITH_HTTP)
  543. AM_CONDITIONAL(WITH_HTTP_SOURCES, test "$WITH_HTTP" = "1")
  544. if test "$with_legacy" != "yes" ; then
  545. WITH_LEGACY=0
  546. else
  547. echo Enabling deprecated APIs
  548. WITH_LEGACY=1
  549. fi
  550. AC_SUBST(WITH_LEGACY)
  551. AM_CONDITIONAL(WITH_LEGACY_SOURCES, test "$WITH_LEGACY" = "1")
  552. if test "$with_reader" = "no" ; then
  553. echo Disabling the xmlReader parsing interface
  554. WITH_READER=0
  555. else
  556. WITH_READER=1
  557. fi
  558. AC_SUBST(WITH_READER)
  559. AM_CONDITIONAL(WITH_READER_SOURCES, test "$WITH_READER" = "1")
  560. if test "$with_writer" = "no" ; then
  561. echo Disabling the xmlWriter saving interface
  562. WITH_WRITER=0
  563. else
  564. WITH_WRITER=1
  565. fi
  566. AC_SUBST(WITH_WRITER)
  567. AM_CONDITIONAL(WITH_WRITER_SOURCES, test "$WITH_WRITER" = "1")
  568. if test "$with_pattern" = "no" ; then
  569. echo Disabling the xmlPattern parsing interface
  570. WITH_PATTERN=0
  571. else
  572. WITH_PATTERN=1
  573. fi
  574. AC_SUBST(WITH_PATTERN)
  575. AM_CONDITIONAL(WITH_PATTERN_SOURCES, test "$WITH_PATTERN" = "1")
  576. if test "$with_sax1" = "no" ; then
  577. echo Disabling the older SAX1 interface
  578. WITH_SAX1=0
  579. else
  580. WITH_SAX1=1
  581. fi
  582. AC_SUBST(WITH_SAX1)
  583. AM_CONDITIONAL(WITH_SAX1_SOURCES, test "$WITH_SAX1" = "1")
  584. if test "$with_push" = "no" ; then
  585. echo Disabling the PUSH parser interfaces
  586. WITH_PUSH=0
  587. else
  588. WITH_PUSH=1
  589. fi
  590. AC_SUBST(WITH_PUSH)
  591. if test "$with_html" = "no" ; then
  592. echo Disabling HTML support
  593. WITH_HTML=0
  594. else
  595. WITH_HTML=1
  596. fi
  597. AC_SUBST(WITH_HTML)
  598. AM_CONDITIONAL(WITH_HTML_SOURCES, test "$WITH_HTML" = "1")
  599. if test "$with_valid" = "no" ; then
  600. echo Disabling DTD validation support
  601. WITH_VALID=0
  602. else
  603. WITH_VALID=1
  604. fi
  605. AC_SUBST(WITH_VALID)
  606. AM_CONDITIONAL(WITH_VALID_SOURCES, test "$WITH_VALID" = "1")
  607. if test "$with_catalog" = "no" ; then
  608. echo Disabling Catalog support
  609. WITH_CATALOG=0
  610. else
  611. WITH_CATALOG=1
  612. fi
  613. AC_SUBST(WITH_CATALOG)
  614. AM_CONDITIONAL(WITH_CATALOG_SOURCES, test "$WITH_CATALOG" = "1")
  615. if test "$with_xptr" = "no" ; then
  616. echo Disabling XPointer support
  617. WITH_XPTR=0
  618. WITH_XPTR_LOCS=0
  619. else
  620. WITH_XPTR=1
  621. fi
  622. AC_SUBST(WITH_XPTR)
  623. AM_CONDITIONAL(WITH_XPTR_SOURCES, test "$WITH_XPTR" = "1")
  624. if test "$with_xptr_locs" != "yes" ; then
  625. WITH_XPTR_LOCS=0
  626. else
  627. echo Enabling Xpointer locations support
  628. WITH_XPTR_LOCS=1
  629. fi
  630. AC_SUBST(WITH_XPTR_LOCS)
  631. if test "$with_c14n" = "no" ; then
  632. echo Disabling C14N support
  633. WITH_C14N=0
  634. else
  635. WITH_C14N=1
  636. fi
  637. AC_SUBST(WITH_C14N)
  638. AM_CONDITIONAL(WITH_C14N_SOURCES, test "$WITH_C14N" = "1")
  639. if test "$with_xinclude" = "no" ; then
  640. echo Disabling XInclude support
  641. WITH_XINCLUDE=0
  642. else
  643. WITH_XINCLUDE=1
  644. fi
  645. AC_SUBST(WITH_XINCLUDE)
  646. AM_CONDITIONAL(WITH_XINCLUDE_SOURCES, test "$WITH_XINCLUDE" = "1")
  647. if test "$with_schematron" = "no" ; then
  648. echo "Disabling Schematron support"
  649. WITH_SCHEMATRON=0
  650. else
  651. WITH_SCHEMATRON=1
  652. fi
  653. AC_SUBST(WITH_SCHEMATRON)
  654. AM_CONDITIONAL(WITH_SCHEMATRON_SOURCES, test "$WITH_SCHEMATRON" = "1")
  655. if test "$with_xpath" = "no" ; then
  656. echo Disabling XPATH support
  657. WITH_XPATH=0
  658. else
  659. WITH_XPATH=1
  660. fi
  661. AC_SUBST(WITH_XPATH)
  662. AM_CONDITIONAL(WITH_XPATH_SOURCES, test "$WITH_XPATH" = "1")
  663. if test "$with_output" = "no" ; then
  664. echo Disabling serialization/saving support
  665. WITH_OUTPUT=0
  666. else
  667. WITH_OUTPUT=1
  668. fi
  669. AC_SUBST(WITH_OUTPUT)
  670. AM_CONDITIONAL(WITH_OUTPUT_SOURCES, test "$WITH_OUTPUT" = "1")
  671. if test "$WITH_ICONV" != "1" && test "$with_iso8859x" = "no" ; then
  672. echo Disabling ISO8859X support
  673. WITH_ISO8859X=0
  674. else
  675. WITH_ISO8859X=1
  676. fi
  677. AC_SUBST(WITH_ISO8859X)
  678. if test "$with_schemas" = "no" ; then
  679. echo "Disabling Schemas/Relax-NG support"
  680. WITH_SCHEMAS=0
  681. else
  682. WITH_SCHEMAS=1
  683. fi
  684. AC_SUBST(WITH_SCHEMAS)
  685. AM_CONDITIONAL(WITH_SCHEMAS_SOURCES, test "$WITH_SCHEMAS" = "1")
  686. if test "$with_regexps" = "no" ; then
  687. echo Disabling Regexps support
  688. WITH_REGEXPS=0
  689. else
  690. WITH_REGEXPS=1
  691. fi
  692. AC_SUBST(WITH_REGEXPS)
  693. AM_CONDITIONAL(WITH_REGEXPS_SOURCES, test "$WITH_REGEXPS" = "1")
  694. if test "$with_debug" = "no" ; then
  695. echo Disabling DEBUG support
  696. WITH_DEBUG=0
  697. else
  698. WITH_DEBUG=1
  699. fi
  700. AC_SUBST(WITH_DEBUG)
  701. AM_CONDITIONAL(WITH_DEBUG_SOURCES, test "$WITH_DEBUG" = "1")
  702. if test "$with_mem_debug" = "yes" ; then
  703. if test "$with_thread_alloc" = "yes" ; then
  704. echo Disabling memory debug - cannot use mem-debug with thread-alloc!
  705. WITH_MEM_DEBUG=0
  706. else
  707. echo Enabling memory debug support
  708. WITH_MEM_DEBUG=1
  709. fi
  710. else
  711. WITH_MEM_DEBUG=0
  712. fi
  713. AC_SUBST(WITH_MEM_DEBUG)
  714. dnl
  715. dnl Check for Python
  716. dnl
  717. AS_IF([test "x$with_python" != "xno"], [
  718. AM_PATH_PYTHON
  719. PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}])
  720. ])
  721. AM_CONDITIONAL([WITH_PYTHON], [test "x$with_python" != "xno"])
  722. dnl
  723. dnl Extra Python flags for Windows
  724. dnl
  725. PYTHON_LDFLAGS=
  726. if test "${PYTHON}" != ""; then
  727. case "$host" in
  728. *-*-mingw* )
  729. PYTHON_LDFLAGS="-no-undefined -shrext .pyd"
  730. ;;
  731. *-*-cygwin* |*-*-msys* )
  732. PYTHON_LDFLAGS="-no-undefined"
  733. ;;
  734. esac
  735. fi
  736. AC_SUBST(PYTHON_LDFLAGS)
  737. dnl
  738. dnl Check for DSO support
  739. dnl
  740. WITH_MODULES=0
  741. if test "$with_modules" != "no" ; then
  742. case "$host" in
  743. *-*-cygwin* | *-*-msys* )
  744. MODULE_EXTENSION=".dll"
  745. ;;
  746. *-*-mingw*)
  747. MODULE_EXTENSION=".dll"
  748. WITH_MODULES=1
  749. ;;
  750. *-*-hpux*)
  751. MODULE_EXTENSION=".sl"
  752. ;;
  753. *)
  754. MODULE_EXTENSION=".so"
  755. ;;
  756. esac
  757. if test "$WITH_MODULES" = "0"; then
  758. _libs=$LIBS
  759. AC_SEARCH_LIBS([dlopen], [dl], [
  760. WITH_MODULES=1
  761. if test "$ac_cv_search_dlopen" != "none required"; then
  762. MODULE_PLATFORM_LIBS=$ac_cv_search_dlopen
  763. fi
  764. AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])], [
  765. AC_SEARCH_LIBS([shl_load], [dld], [
  766. WITH_MODULES=1
  767. if test "$ac_cv_search_shl_load" != "none required"; then
  768. MODULE_PLATFORM_LIBS=$ac_cv_search_shl_load
  769. fi
  770. AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])])])
  771. LIBS=$_libs
  772. fi
  773. fi
  774. AC_SUBST(WITH_MODULES)
  775. AC_SUBST(MODULE_PLATFORM_LIBS)
  776. AC_SUBST(MODULE_EXTENSION)
  777. AM_CONDITIONAL(WITH_MODULES_SOURCES, test "$WITH_MODULES" = "1")
  778. dnl
  779. dnl Check for trio string functions
  780. dnl
  781. if test "${NEED_TRIO}" = "1" ; then
  782. echo Adding trio library for string functions
  783. WITH_TRIO=1
  784. else
  785. WITH_TRIO=0
  786. fi
  787. AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
  788. AC_SUBST(WITH_TRIO)
  789. dnl
  790. dnl Thread-related stuff
  791. dnl
  792. THREAD_LIBS=""
  793. BASE_THREAD_LIBS=""
  794. WITH_THREADS=0
  795. THREAD_CFLAGS=""
  796. WITH_THREAD_ALLOC=0
  797. if test "$with_threads" = "no" ; then
  798. echo Disabling multithreaded support
  799. else
  800. case $host_os in
  801. *mingw*)
  802. dnl Default to native threads on Windows
  803. WITH_THREADS="1"
  804. ;;
  805. *)
  806. dnl Use pthread by default in other cases
  807. _libs=$LIBS
  808. AC_CHECK_HEADERS(pthread.h,
  809. AC_SEARCH_LIBS([pthread_join], [pthread], [
  810. WITH_THREADS="1"
  811. if test "$ac_cv_search_pthread_join" != "none required"; then
  812. THREAD_LIBS=$ac_cv_search_pthread_join
  813. fi
  814. AC_DEFINE([HAVE_PTHREAD_H], [],
  815. [Define if <pthread.h> is there])]))
  816. LIBS=$_libs
  817. ;;
  818. esac
  819. case $host_os in
  820. *linux*)
  821. if test "${GCC}" = "yes" ; then
  822. BASE_THREAD_LIBS="$THREAD_LIBS"
  823. THREAD_LIBS=""
  824. fi
  825. ;;
  826. esac
  827. if test "$WITH_THREADS" = "1" ; then
  828. THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
  829. fi
  830. fi
  831. if test "$with_thread_alloc" = "yes" && test "$WITH_THREADS" = "1" ; then
  832. WITH_THREAD_ALLOC=1
  833. fi
  834. AC_SUBST(THREAD_LIBS)
  835. AC_SUBST(BASE_THREAD_LIBS)
  836. AC_SUBST(WITH_THREADS)
  837. AC_SUBST(THREAD_CFLAGS)
  838. AC_SUBST(WITH_THREAD_ALLOC)
  839. dnl
  840. dnl xmllint shell history
  841. dnl
  842. if test "$with_history" = "yes" && test "$with_readline" != "no"; then
  843. echo Enabling xmllint shell history
  844. dnl check for terminal library. this is a very cool solution
  845. dnl from octave's configure.in
  846. unset tcap
  847. for termlib in ncurses curses termcap terminfo termlib; do
  848. AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
  849. test -n "$tcap" && break
  850. done
  851. _cppflags=$CPPFLAGS
  852. _libs=$LIBS
  853. if test "$with_readline" != "" && test "$with_readline" != "yes"; then
  854. RDL_DIR=$with_readline
  855. CPPFLAGS="${CPPFLAGS} -I$RDL_DIR/include"
  856. LIBS="${LIBS} -L$RDL_DIR/lib"
  857. fi
  858. AC_CHECK_HEADER(readline/history.h,
  859. AC_CHECK_LIB(history, append_history,[
  860. RDL_LIBS="-lhistory"
  861. if test "x${RDL_DIR}" != "x"; then
  862. RDL_CFLAGS="-I$RDL_DIR/include"
  863. RDL_LIBS="-L$RDL_DIR/lib $RDL_LIBS"
  864. fi
  865. AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
  866. AC_CHECK_HEADER(readline/readline.h,
  867. AC_CHECK_LIB(readline, readline,[
  868. RDL_LIBS="-lreadline $RDL_LIBS $tcap"
  869. if test "x$RDL_DIR" != "x"; then
  870. RDL_CFLAGS="-I$RDL_DIR/include"
  871. RDL_LIBS="-L$RDL_DIR/lib $RDL_LIBS"
  872. fi
  873. AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
  874. CPPFLAGS=$_cppflags
  875. LIBS=$_libs
  876. fi
  877. AC_SUBST(RDL_CFLAGS)
  878. AC_SUBST(RDL_LIBS)
  879. dnl
  880. dnl Checks for zlib library.
  881. dnl
  882. WITH_ZLIB=0
  883. if test "$with_zlib" = "no"; then
  884. echo "Disabling zlib compression support"
  885. else
  886. if test "$with_zlib" != "yes"; then
  887. Z_DIR=$with_zlib
  888. fi
  889. # Don't run pkg-config if with_zlib contains a path.
  890. if test "x$Z_DIR" = "x"; then
  891. # Try pkg-config first so that static linking works.
  892. PKG_CHECK_MODULES([Z],[zlib],
  893. [WITH_ZLIB=1; XML_PC_REQUIRES="${XML_PC_REQUIRES} zlib"],
  894. [:])
  895. fi
  896. if test "$WITH_ZLIB" = "0"; then
  897. _cppflags=$CPPFLAGS
  898. _libs=$LIBS
  899. if test "x$Z_DIR" != "x"; then
  900. CPPFLAGS="${CPPFLAGS} -I$Z_DIR/include"
  901. LIBS="${LIBS} -L$Z_DIR/lib"
  902. fi
  903. AC_CHECK_HEADERS(zlib.h,
  904. AC_CHECK_LIB(z, gzread,[
  905. WITH_ZLIB=1
  906. if test "x${Z_DIR}" != "x"; then
  907. Z_CFLAGS="-I${Z_DIR}/include"
  908. Z_LIBS="-L${Z_DIR}/lib -lz"
  909. [case ${host} in
  910. *-*-solaris*)
  911. Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
  912. ;;
  913. esac]
  914. else
  915. Z_LIBS="-lz"
  916. fi])
  917. XML_PC_LIBS="${XML_PC_LIBS} ${Z_LIBS}"
  918. )
  919. CPPFLAGS=$_cppflags
  920. LIBS=$_libs
  921. fi
  922. XML_PRIVATE_CFLAGS="${XML_PRIVATE_CFLAGS} ${Z_CFLAGS}"
  923. XML_PRIVATE_LIBS="${XML_PRIVATE_LIBS} ${Z_LIBS}"
  924. fi
  925. AC_SUBST(WITH_ZLIB)
  926. dnl
  927. dnl Checks for lzma library.
  928. dnl
  929. WITH_LZMA=0
  930. if test "$with_lzma" = "no"; then
  931. echo "Disabling lzma compression support"
  932. else
  933. if test "$with_lzma" != "yes"; then
  934. LZMA_DIR=$with_lzma
  935. fi
  936. # Don't run pkg-config if with_lzma contains a path.
  937. if test "x$LZMA_DIR" = "x"; then
  938. # Try pkg-config first so that static linking works.
  939. PKG_CHECK_MODULES([LZMA],[liblzma],
  940. [WITH_LZMA=1; XML_PC_REQUIRES="${XML_PC_REQUIRES} liblzma"],
  941. [:])
  942. fi
  943. # If pkg-config failed, fall back to AC_CHECK_LIB. This
  944. # will not pick up the necessary LIBS flags for liblzma's
  945. # private dependencies, though, so static linking may fail.
  946. if test "$WITH_LZMA" = "0"; then
  947. _cppflags=$CPPFLAGS
  948. _libs=$LIBS
  949. if test "x$LZMA_DIR" != "x"; then
  950. CPPFLAGS="${CPPFLAGS} -I$LZMA_DIR/include"
  951. LIBS="${LIBS} -L$LZMA_DIR/lib"
  952. fi
  953. AC_CHECK_HEADERS(lzma.h,
  954. AC_CHECK_LIB(lzma, lzma_code,[
  955. WITH_LZMA=1
  956. if test "x${LZMA_DIR}" != "x"; then
  957. LZMA_CFLAGS="-I${LZMA_DIR}/include"
  958. LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
  959. else
  960. LZMA_LIBS="-llzma"
  961. fi])
  962. XML_PC_LIBS="${XML_PC_LIBS} ${LZMA_LIBS}"
  963. )
  964. CPPFLAGS=$_cppflags
  965. LIBS=$_libs
  966. fi
  967. XML_PRIVATE_CFLAGS="${XML_PRIVATE_CFLAGS} ${LZMA_CFLAGS}"
  968. XML_PRIVATE_LIBS="${XML_PRIVATE_LIBS} ${LZMA_LIBS}"
  969. fi
  970. AC_SUBST(WITH_LZMA)
  971. AM_CONDITIONAL(WITH_LZMA_SOURCES, test "$WITH_LZMA" = "1")
  972. dnl
  973. dnl Checks for iconv library.
  974. dnl
  975. WITH_ICONV=0
  976. if test "$with_iconv" = "no" ; then
  977. echo Disabling ICONV support
  978. else
  979. _cppflags=$CPPFLAGS
  980. _libs=$LIBS
  981. if test "$with_iconv" != "yes" && test "$with_iconv" != "" ; then
  982. ICONV_DIR=$with_iconv
  983. CPPFLAGS="$CPPFLAGS -I$ICONV_DIR/include"
  984. LIBS="$LIBS -L$ICONV_DIR/lib"
  985. fi
  986. AC_MSG_CHECKING([for libiconv])
  987. AC_LINK_IFELSE([
  988. AC_LANG_PROGRAM([#include <iconv.h>], [iconv_open(0,0);])
  989. ], [
  990. WITH_ICONV=1
  991. AC_MSG_RESULT([none required])
  992. ], [
  993. LIBS="$LIBS -liconv"
  994. AC_LINK_IFELSE([
  995. AC_LANG_PROGRAM([#include <iconv.h>], [iconv_open(0,0);])
  996. ], [
  997. WITH_ICONV=1
  998. ICONV_LIBS="-liconv"
  999. AC_MSG_RESULT([yes])
  1000. ], [
  1001. AC_MSG_RESULT([no])
  1002. ])
  1003. ])
  1004. if test "$WITH_ICONV" = "1" && test "$ICONV_DIR" != ""; then
  1005. ICONV_CFLAGS="-I$ICONV_DIR/include"
  1006. ICONV_LIBS="-L$ICONV_DIR/lib $ICONV_LIBS"
  1007. # Export this since our headers include iconv.h
  1008. XML_INCLUDEDIR="$XML_INCLUDEDIR -I$ICONV_DIR/include"
  1009. fi
  1010. CPPFLAGS=$_cppflags
  1011. LIBS=$_libs
  1012. fi
  1013. AC_SUBST(WITH_ICONV)
  1014. AC_SUBST(ICONV_CFLAGS)
  1015. dnl
  1016. dnl Checks for ICU library.
  1017. dnl
  1018. WITH_ICU=0
  1019. if test "$with_icu" = "no" || test "$with_icu" = "" ; then
  1020. echo Disabling ICU support
  1021. else
  1022. # Try pkg-config first so that static linking works.
  1023. # If this succeeeds, we ignore the WITH_ICU directory.
  1024. PKG_CHECK_MODULES([ICU], [icu-i18n], [
  1025. WITH_ICU=1; XML_PC_REQUIRES="${XML_PC_REQUIRES} icu-i18n"
  1026. m4_ifdef([PKG_CHECK_VAR],
  1027. [PKG_CHECK_VAR([ICU_DEFS], [icu-i18n], [DEFS])])
  1028. if test "x$ICU_DEFS" != "x"; then
  1029. ICU_CFLAGS="$ICU_CFLAGS $ICU_DEFS"
  1030. fi],[:])
  1031. if test "$WITH_ICU" = "0"; then
  1032. ICU_CONFIG=icu-config
  1033. if ${ICU_CONFIG} --cflags >/dev/null 2>&1
  1034. then
  1035. WITH_ICU=1
  1036. ICU_CFLAGS=`${ICU_CONFIG} --cflags`
  1037. ICU_LIBS=`${ICU_CONFIG} --ldflags`
  1038. XML_PC_LIBS="${XML_PC_LIBS} ${ICU_LIBS}"
  1039. else
  1040. _cppflags="${CPPFLAGS}"
  1041. _libs="${LIBS}"
  1042. if test "$with_icu" != "yes" ; then
  1043. ICU_DIR=$with_icu
  1044. CPPFLAGS="${CPPFLAGS} -I$ICU_DIR/include"
  1045. LIBS="${LIBS} -L$ICU_DIR/lib"
  1046. fi
  1047. AC_CHECK_HEADER(unicode/ucnv.h, [
  1048. AC_CHECK_LIB([icucore], [ucnv_open], [
  1049. WITH_ICU=1
  1050. ICU_LIBS=-licucore
  1051. if test "$ICU_DIR" != ""; then
  1052. ICU_CFLAGS="-I$ICU_DIR/include"
  1053. ICU_LIBS="-L$ICU_DIR/lib $ICU_LIBS"
  1054. fi])])
  1055. XML_PC_LIBS="${XML_PC_LIBS} ${ICU_LIBS}"
  1056. CPPFLAGS=$_cppflags
  1057. LIBS=$_libs
  1058. fi
  1059. fi
  1060. XML_PRIVATE_CFLAGS="${XML_PRIVATE_CFLAGS} ${ICU_CFLAGS}"
  1061. XML_PRIVATE_LIBS="${XML_PRIVATE_LIBS} ${ICU_LIBS}"
  1062. fi
  1063. AC_SUBST(WITH_ICU)
  1064. if test "$with_coverage" = "yes" && test "${GCC}" = "yes"
  1065. then
  1066. echo Enabling code coverage for GCC
  1067. AM_CFLAGS="$AM_CFLAGS -fprofile-arcs -ftest-coverage"
  1068. AM_LDFLAGS="$AM_LDFLAGS -fprofile-arcs -ftest-coverage"
  1069. else
  1070. echo Disabling code coverage for GCC
  1071. fi
  1072. XML_LIBS="-lxml2"
  1073. XML_LIBTOOLLIBS="libxml2.la"
  1074. NON_PC_LIBS="${THREAD_LIBS} ${ICONV_LIBS} ${LIBM} ${NET_LIBS}"
  1075. XML_PC_LIBS="${XML_PC_LIBS} ${NON_PC_LIBS}"
  1076. XML_PRIVATE_LIBS="${XML_PRIVATE_LIBS} ${NON_PC_LIBS}"
  1077. XML_PRIVATE_CFLAGS="${XML_PRIVATE_CFLAGS} ${THREAD_CFLAGS} ${ICONV_CFLAGS}"
  1078. dnl When static-only:
  1079. dnl * Duplicate xml-config static --libs into --dynamic.
  1080. dnl * Fold pkg-config private fields into main fields.
  1081. if test "x$enable_shared" = "xno"; then
  1082. XML_PRIVATE_LIBS_NO_SHARED="${XML_PRIVATE_LIBS}"
  1083. XML_PC_PRIVATE=
  1084. XML_PC_LIBS_PRIVATE=
  1085. else
  1086. XML_PRIVATE_LIBS_NO_SHARED=
  1087. XML_PC_PRIVATE=".private"
  1088. XML_PC_LIBS_PRIVATE="
  1089. Libs.private:"
  1090. fi
  1091. AC_SUBST(XML_PRIVATE_LIBS_NO_SHARED)
  1092. AC_SUBST(XML_PC_PRIVATE)
  1093. AC_SUBST(XML_PC_LIBS_PRIVATE)
  1094. AM_SUBST_NOTMAKE(XML_PRIVATE_LIBS_NO_SHARED)
  1095. AM_SUBST_NOTMAKE(XML_PC_PRIVATE)
  1096. AM_SUBST_NOTMAKE(XML_PC_LIBS_PRIVATE)
  1097. AC_SUBST(XML_PC_LIBS)
  1098. AC_SUBST(XML_PC_REQUIRES)
  1099. AM_SUBST_NOTMAKE(XML_PC_LIBS)
  1100. AM_SUBST_NOTMAKE(XML_PC_REQUIRES)
  1101. AC_SUBST(AM_CFLAGS)
  1102. AC_SUBST(AM_LDFLAGS)
  1103. AC_SUBST(XML_CFLAGS)
  1104. AC_SUBST(XML_LIBDIR)
  1105. AC_SUBST(XML_LIBS)
  1106. AC_SUBST(XML_PRIVATE_LIBS)
  1107. AC_SUBST(XML_PRIVATE_CFLAGS)
  1108. AC_SUBST(XML_LIBTOOLLIBS)
  1109. AC_SUBST(XML_INCLUDEDIR)
  1110. dnl for the spec file
  1111. RELDATE=`date +'%a %b %e %Y'`
  1112. AC_SUBST(RELDATE)
  1113. # keep on one line for cygwin c.f. #130896
  1114. AC_CONFIG_FILES([Makefile include/Makefile include/libxml/Makefile include/private/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake])
  1115. AC_CONFIG_FILES([python/setup.py], [chmod +x python/setup.py])
  1116. AC_CONFIG_FILES([xml2-config], [chmod +x xml2-config])
  1117. AC_OUTPUT
  1118. if test "$WARN_NO_TLS" != ""; then
  1119. echo "================================================================"
  1120. echo "WARNING: Your C compiler appears to not support thread-local"
  1121. echo "storage. Future versions of libxml2 will require this feature"
  1122. echo "for multi-threading."
  1123. echo "================================================================"
  1124. fi