configure.in 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(entities.c)
  3. AM_CONFIG_HEADER(config.h)
  4. AC_CANONICAL_HOST
  5. LIBXML_MAJOR_VERSION=2
  6. LIBXML_MINOR_VERSION=7
  7. LIBXML_MICRO_VERSION=6
  8. LIBXML_MICRO_VERSION_SUFFIX=
  9. LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
  10. LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
  11. LIBXML_VERSION_NUMBER=`expr $LIBXML_MAJOR_VERSION \* 10000 + $LIBXML_MINOR_VERSION \* 100 + $LIBXML_MICRO_VERSION`
  12. if test -f CVS/Entries ; then
  13. extra=`grep ChangeLog CVS/Entries | grep -v LIBXML | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
  14. echo extra=$extra
  15. if test "$extra" != ""
  16. then
  17. LIBXML_VERSION_EXTRA="-CVS$extra"
  18. fi
  19. else if test -d .svn ; then
  20. extra=`svn info | grep Revision | sed 's+Revision: ++'`
  21. echo extra=$extra
  22. if test "$extra" != ""
  23. then
  24. LIBXML_VERSION_EXTRA="-SVN$extra"
  25. fi
  26. else if test -d .git ; then
  27. extra=`git describe | sed 's+LIBXML[[0-9.]]*-++'`
  28. echo extra=$extra
  29. if test "$extra" != ""
  30. then
  31. LIBXML_VERSION_EXTRA="-GIT$extra"
  32. fi
  33. fi
  34. fi
  35. fi
  36. AC_SUBST(LIBXML_MAJOR_VERSION)
  37. AC_SUBST(LIBXML_MINOR_VERSION)
  38. AC_SUBST(LIBXML_MICRO_VERSION)
  39. AC_SUBST(LIBXML_VERSION)
  40. AC_SUBST(LIBXML_VERSION_INFO)
  41. AC_SUBST(LIBXML_VERSION_NUMBER)
  42. AC_SUBST(LIBXML_VERSION_EXTRA)
  43. VERSION=${LIBXML_VERSION}
  44. AM_INIT_AUTOMAKE(libxml2, $VERSION)
  45. dnl Checks for programs.
  46. AC_PROG_CC
  47. AC_PROG_INSTALL
  48. AC_PROG_CPP
  49. AC_PATH_PROG(RM, rm, /bin/rm)
  50. AC_PATH_PROG(MV, mv, /bin/mv)
  51. AC_PATH_PROG(TAR, tar, /bin/tar)
  52. AC_PATH_PROG(PERL, perl, /usr/bin/perl)
  53. AC_PATH_PROG(WGET, wget, /usr/bin/wget)
  54. AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
  55. AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
  56. dnl Make sure we have an ANSI compiler
  57. AM_C_PROTOTYPES
  58. test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
  59. AC_LIBTOOL_WIN32_DLL
  60. AM_PROG_LIBTOOL
  61. dnl
  62. dnl if the system support linker version scripts for symbol versioning
  63. dnl then add it
  64. dnl
  65. VERSION_SCRIPT_FLAGS=
  66. $(/usr/bin/ld --help 2>&1 | grep -- --version-script >/dev/null) && \
  67. VERSION_SCRIPT_FLAGS=-Wl,--version-script=
  68. test "`uname`" == "SunOS" && \
  69. VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
  70. AC_SUBST(VERSION_SCRIPT_FLAGS)
  71. AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
  72. dnl
  73. dnl We process the AC_ARG_WITH first so that later we can modify
  74. dnl some of them to try to prevent impossible combinations. This
  75. dnl also allows up so alphabetize the choices
  76. dnl
  77. dnl
  78. dnl zlib option might change flags, so we save them initially
  79. dnl
  80. _cppflags="${CPPFLAGS}"
  81. _ldflags="${LDFLAGS}"
  82. AC_ARG_WITH(c14n,
  83. [ --with-c14n add the Canonicalization support (on)])
  84. AC_ARG_WITH(catalog,
  85. [ --with-catalog add the Catalog support (on)])
  86. AC_ARG_WITH(debug,
  87. [ --with-debug add the debugging module (on)])
  88. AC_ARG_WITH(docbook,
  89. [ --with-docbook add Docbook SGML support (on)])
  90. AC_ARG_WITH(fexceptions,
  91. [ --with-fexceptions add GCC flag -fexceptions for C++ exceptions (off)])
  92. AC_ARG_WITH(ftp,
  93. [ --with-ftp add the FTP support (on)])
  94. AC_ARG_WITH(history,
  95. [ --with-history add history support to xmllint shell(off)])
  96. AC_ARG_WITH(html,
  97. [ --with-html add the HTML support (on)])
  98. dnl Specific dir for HTML output ?
  99. AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
  100. [path to base html directory, default $datadir/doc/html]),
  101. [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
  102. AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
  103. [directory used under html-dir, default $PACKAGE-$VERSION/html]),
  104. [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
  105. [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
  106. AC_SUBST(HTML_DIR)
  107. AC_ARG_WITH(http,
  108. [ --with-http add the HTTP support (on)])
  109. AC_ARG_WITH(iconv,
  110. [ --with-iconv[[=DIR]] add ICONV support (on)])
  111. AC_ARG_WITH(iso8859x,
  112. [ --with-iso8859x add ISO8859X support if no iconv (on)])
  113. AC_ARG_WITH(legacy,
  114. [ --with-legacy add deprecated APIs for compatibility (on)])
  115. AC_ARG_WITH(mem_debug,
  116. [ --with-mem-debug add the memory debugging module (off)])
  117. AC_ARG_WITH(minimum,
  118. [ --with-minimum build a minimally sized library (off)])
  119. AC_ARG_WITH(output,
  120. [ --with-output add the serialization support (on)])
  121. AC_ARG_WITH(pattern,
  122. [ --with-pattern add the xmlPattern selection interface (on)])
  123. AC_ARG_WITH(push,
  124. [ --with-push add the PUSH parser interfaces (on)])
  125. AC_ARG_WITH(python,
  126. [ --with-python[[=DIR]] build Python bindings if found])
  127. AC_ARG_WITH(reader,
  128. [ --with-reader add the xmlReader parsing interface (on)])
  129. AC_ARG_WITH(readline,
  130. [ --with-readline=DIR use readline in DIR],[
  131. if test "$withval" != "no" -a "$withval" != "yes"; then
  132. RDL_DIR=$withval
  133. CPPFLAGS="${CPPFLAGS} -I$withval/include"
  134. LDFLAGS="${LDFLAGS} -L$withval/lib"
  135. fi
  136. ])
  137. AC_ARG_WITH(regexps,
  138. [ --with-regexps add Regular Expressions support (on)])
  139. AC_ARG_WITH(run_debug,
  140. [ --with-run-debug add the runtime debugging module (off)])
  141. AC_ARG_WITH(sax1,
  142. [ --with-sax1 add the older SAX1 interface (on)])
  143. AC_ARG_WITH(schemas,
  144. [ --with-schemas add Relax-NG and Schemas support (on)])
  145. AC_ARG_WITH(schematron,
  146. [ --with-schematron add Schematron support (on)])
  147. AC_ARG_WITH(threads,
  148. [ --with-threads add multithread support(on)])
  149. AC_ARG_WITH(thread-alloc,
  150. [ --with-thread-alloc add per-thread memory(off)])
  151. AC_ARG_WITH(tree,
  152. [ --with-tree add the DOM like tree manipulation APIs (on)])
  153. AC_ARG_WITH(valid,
  154. [ --with-valid add the DTD validation support (on)])
  155. AC_ARG_WITH(writer,
  156. [ --with-writer add the xmlWriter saving interface (on)])
  157. AC_ARG_WITH(xinclude,
  158. [ --with-xinclude add the XInclude support (on)])
  159. AC_ARG_WITH(xpath,
  160. [ --with-xpath add the XPATH support (on)])
  161. AC_ARG_WITH(xptr,
  162. [ --with-xptr add the XPointer support (on)])
  163. AC_ARG_WITH(modules,
  164. [ --with-modules add the dynamic modules support (on)])
  165. AC_ARG_WITH(zlib,
  166. [ --with-zlib[[=DIR]] use libz in DIR],[
  167. if test "$withval" != "no" -a "$withval" != "yes"; then
  168. Z_DIR=$withval
  169. CPPFLAGS="${CPPFLAGS} -I$withval/include"
  170. LDFLAGS="${LDFLAGS} -L$withval/lib"
  171. fi
  172. ])
  173. AC_ARG_WITH(coverage,
  174. [ --with-coverage build for code coverage with GCC (off)])
  175. AC_ARG_ENABLE(rebuild-docs,
  176. [ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=yes]]])
  177. AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "no"])
  178. dnl
  179. dnl hard dependancies on options
  180. dnl
  181. if test "$with_schemas" = "yes"
  182. then
  183. with_pattern=yes
  184. with_regexps=yes
  185. fi
  186. if test "$with_schematron" = "yes"
  187. then
  188. with_pattern=yes
  189. with_xpath=yes
  190. fi
  191. if test "$with_reader" = "yes"
  192. then
  193. with_push=yes
  194. fi
  195. if test "$with_xptr" = "yes"
  196. then
  197. with_xpath=yes
  198. fi
  199. dnl
  200. dnl option to build a minimal libxml2 library
  201. dnl
  202. if test "$with_minimum" = "yes"
  203. then
  204. echo "Configuring for a minimal library"
  205. if test "$with_c14n" = ""
  206. then
  207. with_c14n=no
  208. fi
  209. if test "$with_catalog" = ""
  210. then
  211. with_catalog=no
  212. fi
  213. echo So far so good!
  214. if test "$with_debug" = ""
  215. then
  216. with_debug=no
  217. fi
  218. if test "$with_docbook" = ""
  219. then
  220. with_docbook=no
  221. fi
  222. if test "$with_fexceptions" = ""
  223. then
  224. with_fexceptions=no
  225. fi
  226. if test "$with_ftp" = ""
  227. then
  228. with_ftp=no
  229. fi
  230. if test "$with_history" = ""
  231. then
  232. with_history=no
  233. fi
  234. if test "$with_html" = ""
  235. then
  236. with_html=no
  237. fi
  238. if test "$with_http" = ""
  239. then
  240. with_http=no
  241. fi
  242. if test "$with_iconv" = ""
  243. then
  244. with_iconv=no
  245. fi
  246. if test "$with_iso8859x" = ""
  247. then
  248. with_iso8859x=no
  249. fi
  250. if test "$with_legacy" = ""
  251. then
  252. with_legacy=no
  253. fi
  254. if test "$with_mem_debug" = ""
  255. then
  256. with_mem_debug=no
  257. fi
  258. if test "$with_output" = ""
  259. then
  260. with_output=no
  261. fi
  262. if test "$with_pattern" = ""
  263. then
  264. with_pattern=no
  265. fi
  266. if test "$with_push" = ""
  267. then
  268. with_push=no
  269. fi
  270. if test "$with_python" = ""
  271. then
  272. with_python=no
  273. fi
  274. if test "$with_reader" = ""
  275. then
  276. with_reader=no
  277. fi
  278. if test "$with_readline" = ""
  279. then
  280. with_readline=no
  281. fi
  282. if test "$with_regexps" = ""
  283. then
  284. with_regexps=no
  285. fi
  286. if test "$with_run_debug" = ""
  287. then
  288. with_run_debug=no
  289. fi
  290. if test "$with_sax1" = ""
  291. then
  292. with_sax1=no
  293. fi
  294. if test "$with_schemas" = ""
  295. then
  296. with_schemas=no
  297. fi
  298. if test "$with_schematron" = ""
  299. then
  300. with_schematron=no
  301. fi
  302. if test "$with_threads" = ""
  303. then
  304. with_threads=no
  305. fi
  306. if test "$with_thread_alloc" = ""
  307. then
  308. with_thread_alloc=no
  309. fi
  310. if test "$with_tree" = ""
  311. then
  312. with_tree=no
  313. fi
  314. if test "$with_valid" = ""
  315. then
  316. with_valid=no
  317. fi
  318. if test "$with_writer" = ""
  319. then
  320. with_writer=no
  321. fi
  322. if test "$with_xinclude" = ""
  323. then
  324. with_xinclude=no
  325. fi
  326. if test "$with_xpath" = ""
  327. then
  328. with_xpath=no
  329. fi
  330. if test "$with_xptr" = ""
  331. then
  332. with_xptr=no
  333. fi
  334. if test "$with_zlib" = ""
  335. then
  336. with_zlib=no
  337. fi
  338. if test "$with_modules" = ""
  339. then
  340. with_modules=no
  341. fi
  342. fi
  343. echo Checking zlib
  344. dnl Checks for zlib library.
  345. WITH_ZLIB=0
  346. if test "$with_zlib" = "no"; then
  347. echo "Disabling compression support"
  348. else
  349. AC_CHECK_HEADERS(zlib.h,
  350. AC_CHECK_LIB(z, gzread,[
  351. AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
  352. WITH_ZLIB=1
  353. if test "x${Z_DIR}" != "x"; then
  354. Z_CFLAGS="-I${Z_DIR}/include"
  355. Z_LIBS="-L${Z_DIR}/lib -lz"
  356. [case ${host} in
  357. *-*-solaris*)
  358. Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
  359. ;;
  360. esac]
  361. else
  362. Z_LIBS="-lz"
  363. fi]))
  364. fi
  365. AC_SUBST(Z_CFLAGS)
  366. AC_SUBST(Z_LIBS)
  367. AC_SUBST(WITH_ZLIB)
  368. CPPFLAGS=${_cppflags}
  369. LDFLAGS=${_ldflags}
  370. echo Checking headers
  371. dnl Checks for header files.
  372. AC_HEADER_DIRENT
  373. AC_HEADER_STDC
  374. AC_CHECK_HEADERS([fcntl.h])
  375. AC_CHECK_HEADERS([unistd.h])
  376. AC_CHECK_HEADERS([ctype.h])
  377. AC_CHECK_HEADERS([dirent.h])
  378. AC_CHECK_HEADERS([errno.h])
  379. AC_CHECK_HEADERS([malloc.h])
  380. AC_CHECK_HEADERS([stdarg.h])
  381. AC_CHECK_HEADERS([sys/stat.h])
  382. AC_CHECK_HEADERS([sys/types.h])
  383. AC_CHECK_HEADERS([stdint.h])
  384. AC_CHECK_HEADERS([inttypes.h.h])
  385. AC_CHECK_HEADERS([time.h])
  386. AC_CHECK_HEADERS([ansidecl.h])
  387. AC_CHECK_HEADERS([ieeefp.h])
  388. AC_CHECK_HEADERS([nan.h])
  389. AC_CHECK_HEADERS([math.h])
  390. AC_CHECK_HEADERS([limits.h])
  391. AC_CHECK_HEADERS([fp_class.h])
  392. AC_CHECK_HEADERS([float.h])
  393. AC_CHECK_HEADERS([stdlib.h])
  394. AC_CHECK_HEADERS([sys/socket.h], [], [],
  395. [#if HAVE_SYS_TYPES_H
  396. # include <sys/types.h>
  397. # endif
  398. ])
  399. AC_CHECK_HEADERS([netinet/in.h], [], [],
  400. [#if HAVE_SYS_TYPES_H
  401. # include <sys/types.h>
  402. # endif
  403. ])
  404. AC_CHECK_HEADERS([arpa/inet.h], [], [],
  405. [#if HAVE_SYS_TYPES_H
  406. # include <sys/types.h>
  407. # endif
  408. #if HAVE_ARPA_INET_H
  409. # include <arpa/inet.h>
  410. # endif
  411. ])
  412. AC_CHECK_HEADERS([netdb.h])
  413. AC_CHECK_HEADERS([sys/time.h])
  414. AC_CHECK_HEADERS([sys/select.h])
  415. AC_CHECK_HEADERS([poll.h])
  416. AC_CHECK_HEADERS([sys/mman.h])
  417. AC_CHECK_HEADERS([sys/timeb.h])
  418. AC_CHECK_HEADERS([signal.h])
  419. AC_CHECK_HEADERS([arpa/nameser.h], [], [],
  420. [#if HAVE_SYS_TYPES_H
  421. # include <sys/types.h>
  422. # endif
  423. ])
  424. AC_CHECK_HEADERS([resolv.h], [], [],
  425. [#if HAVE_SYS_TYPES_H
  426. # include <sys/types.h>
  427. # endif
  428. #if HAVE_NETINET_IN_H
  429. # include <netinet/in.h>
  430. # endif
  431. #if HAVE_ARPA_NAMESER_H
  432. # include <arpa/nameser.h>
  433. # endif
  434. ])
  435. AC_CHECK_HEADERS([dl.h])
  436. AC_CHECK_HEADERS([dlfcn.h])
  437. echo Checking libraries
  438. dnl Checks for library functions.
  439. AC_FUNC_STRFTIME
  440. AC_CHECK_FUNCS(strdup strndup strerror)
  441. AC_CHECK_FUNCS(finite isnand fp_class class fpclass)
  442. AC_CHECK_FUNCS(strftime localtime gettimeofday ftime)
  443. AC_CHECK_FUNCS(stat _stat signal)
  444. dnl Checking the standard string functions availability
  445. AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
  446. NEED_TRIO=1)
  447. dnl Checking for va_copy availability
  448. AC_MSG_CHECKING([for va_copy])
  449. AC_TRY_LINK([#include <stdarg.h>
  450. va_list ap1,ap2;], [va_copy(ap1,ap2);],
  451. have_va_copy=yes,
  452. have_va_copy=no)
  453. AC_MSG_RESULT($have_va_copy)
  454. if test x"$have_va_copy" = x"yes"; then
  455. AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
  456. else
  457. AC_MSG_CHECKING([for __va_copy])
  458. AC_TRY_LINK([#include <stdarg.h>
  459. va_list ap1,ap2;], [__va_copy(ap1,ap2);],
  460. have___va_copy=yes,
  461. have___va_copy=no)
  462. AC_MSG_RESULT($have___va_copy)
  463. if test x"$have___va_copy" = x"yes"; then
  464. AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
  465. fi
  466. fi
  467. dnl Checks for inet libraries:
  468. AC_SEARCH_LIBS(gethostent, [nsl])
  469. AC_SEARCH_LIBS(setsockopt, [socket net network])
  470. AC_SEARCH_LIBS(connect, [inet])
  471. dnl Determine what socket length (socklen_t) data type is
  472. AC_MSG_CHECKING([for type of socket length (socklen_t)])
  473. AC_TRY_COMPILE2([
  474. #include <stddef.h>
  475. #include <sys/types.h>
  476. #include <sys/socket.h>],[
  477. (void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)],[
  478. AC_MSG_RESULT(socklen_t *)
  479. XML_SOCKLEN_T=socklen_t],[
  480. AC_TRY_COMPILE2([
  481. #include <stddef.h>
  482. #include <sys/types.h>
  483. #include <sys/socket.h>],[
  484. (void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)],[
  485. AC_MSG_RESULT(size_t *)
  486. XML_SOCKLEN_T=size_t],[
  487. AC_TRY_COMPILE2([
  488. #include <stddef.h>
  489. #include <sys/types.h>
  490. #include <sys/socket.h>],[
  491. (void)getsockopt (1, 1, 1, NULL, (int *)NULL)],[
  492. AC_MSG_RESULT(int *)
  493. XML_SOCKLEN_T=int],[
  494. AC_MSG_WARN(could not determine)
  495. XML_SOCKLEN_T="int"])])])
  496. AC_DEFINE_UNQUOTED(XML_SOCKLEN_T, $XML_SOCKLEN_T, [Determine what socket length (socklen_t) data type is])
  497. dnl ***********************Checking for availability of IPv6*******************
  498. AC_MSG_CHECKING([whether to enable IPv6])
  499. AC_ARG_ENABLE(ipv6, [ --enable-ipv6[[=yes/no]] enables compilation of IPv6 code [[default=yes]]],, enable_ipv6=yes)
  500. if test "$with_minimum" = "yes"
  501. then
  502. enable_ipv6=no
  503. fi
  504. if test $enable_ipv6 = yes; then
  505. have_ipv6=no
  506. AC_TRY_COMPILE([
  507. #include <sys/types.h>
  508. #include <sys/socket.h>
  509. ], [
  510. struct sockaddr_storage ss;
  511. socket(AF_INET6, SOCK_STREAM, 0)
  512. ],
  513. have_ipv6=yes,
  514. have_ipv6=no
  515. )
  516. AC_MSG_RESULT($have_ipv6)
  517. if test $have_ipv6 = yes; then
  518. AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6])
  519. have_broken_ss_family=no
  520. dnl *********************************************************************
  521. dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have
  522. dnl a ss_family member, but rather __ss_family. Let's detect that
  523. dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these
  524. dnl platforms. However, we should only do this if ss_family is not
  525. dnl present.
  526. dnl ********************************************************************
  527. AC_MSG_CHECKING([struct sockaddr::ss_family])
  528. AC_TRY_COMPILE([
  529. #include <sys/types.h>
  530. #include <sys/socket.h>
  531. ], [
  532. struct sockaddr_storage ss ;
  533. ss.ss_family = 0 ;
  534. ],
  535. have_ss_family=yes,
  536. have_ss_family=no
  537. )
  538. AC_MSG_RESULT($have_ss_family)
  539. if test x$have_ss_family = xno ; then
  540. AC_MSG_CHECKING([broken struct sockaddr::ss_family])
  541. AC_TRY_COMPILE([
  542. #include <sys/types.h>
  543. #include <sys/socket.h>
  544. ], [
  545. struct sockaddr_storage ss ;
  546. ss.__ss_family = 0 ;
  547. ],
  548. have_broken_ss_family=yes,
  549. have_broken_ss_family=no
  550. )
  551. AC_MSG_RESULT($have_broken_ss_family)
  552. if test x$have_broken_ss_family = xyes ; then
  553. AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [],
  554. [Whether struct sockaddr::__ss_family exists])
  555. AC_DEFINE(ss_family, __ss_family,
  556. [ss_family is not defined here, use __ss_family instead])
  557. else
  558. AC_MSG_WARN(ss_family and __ss_family not found)
  559. fi
  560. fi
  561. have_getaddrinfo=no
  562. AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
  563. if test $have_getaddrinfo != yes; then
  564. for lib in bsd socket inet; do
  565. AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes;break])
  566. done
  567. fi
  568. if test $have_getaddrinfo = yes; then
  569. AC_DEFINE([HAVE_GETADDRINFO], [], [Define if getaddrinfo is there])
  570. fi
  571. fi
  572. fi
  573. dnl ******************************End IPv6 checks******************************
  574. dnl Checks for isnan in libm if not in libc
  575. AC_CHECK_FUNC(isnan, AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there]) , AC_CHECK_LIB(m, isnan,
  576. [AC_DEFINE([HAVE_ISNAN],[], [Define if isnan is there])]))
  577. AC_CHECK_FUNC(isinf, AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there]) , AC_CHECK_LIB(m, isinf,
  578. [AC_DEFINE([HAVE_ISINF], [], [Define if isinf is there])]))
  579. XML_LIBDIR='-L${libdir}'
  580. XML_INCLUDEDIR='-I${includedir}/libxml2'
  581. dnl
  582. dnl Extra flags
  583. dnl
  584. XML_CFLAGS=""
  585. RDL_LIBS=""
  586. dnl
  587. dnl Workaround for native compilers
  588. dnl HP : http://bugs.gnome.org/db/31/3163.html
  589. dnl DEC : Enable NaN/Inf
  590. dnl
  591. if test "${GCC}" != "yes" ; then
  592. case "${host}" in
  593. hppa*-*-hpux* )
  594. CFLAGS="${CFLAGS} -Wp,-H30000"
  595. ;;
  596. *-dec-osf* )
  597. CFLAGS="${CFLAGS} -ieee"
  598. ;;
  599. alpha*-*-linux* )
  600. CFLAGS="${CFLAGS} -ieee"
  601. ;;
  602. esac
  603. else
  604. if test "$with_fexceptions" = "yes"
  605. then
  606. #
  607. # Not activated by default because this inflates the code size
  608. # Used to allow propagation of C++ exceptions through the library
  609. #
  610. CFLAGS="${CFLAGS} -fexceptions"
  611. fi
  612. CFLAGS="${CFLAGS} -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls"
  613. case "${host}" in
  614. alpha*-*-linux* )
  615. CFLAGS="${CFLAGS} -mieee"
  616. ;;
  617. alpha*-*-osf* )
  618. CFLAGS="${CFLAGS} -mieee"
  619. ;;
  620. esac
  621. fi
  622. case ${host} in
  623. *-*-solaris*)
  624. XML_LIBDIR="${XML_LIBDIR} -R${libdir}"
  625. ;;
  626. hppa*-hp-mpeix)
  627. NEED_TRIO=1
  628. ;;
  629. *-*-mingw* | *-*-cygwin* | *-*-msvc* )
  630. # If the host is Windows, and shared libraries are disabled, we
  631. # need to add -DLIBXML_STATIC to CFLAGS in order for linking to
  632. # work properly (without it, xmlexports.h would force the use of
  633. # DLL imports, which obviously aren't present in a static
  634. # library).
  635. if test "x$enable_shared" = "xno"; then
  636. XML_CFLAGS="$XML_CFLAGS -DLIBXML_STATIC"
  637. CFLAGS="$CFLAGS -DLIBXML_STATIC"
  638. fi
  639. ;;
  640. esac
  641. dnl
  642. dnl check for python
  643. dnl
  644. PYTHON_VERSION=
  645. PYTHON_INCLUDES=
  646. PYTHON_SITE_PACKAGES=
  647. PYTHON_TESTS=
  648. pythondir=
  649. if test "$with_python" != "no" ; then
  650. if test -x "$with_python/bin/python"
  651. then
  652. echo Found python in $with_python/bin/python
  653. PYTHON="$with_python/bin/python"
  654. else
  655. if test -x "$with_python"
  656. then
  657. echo Found python in $with_python
  658. PYTHON="$with_python"
  659. else
  660. if test -x "$PYTHON"
  661. then
  662. echo Found python in environment PYTHON=$PYTHON
  663. with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
  664. else
  665. AC_PATH_PROG(PYTHON, python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
  666. fi
  667. fi
  668. fi
  669. if test "$PYTHON" != ""
  670. then
  671. PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
  672. echo Found Python version $PYTHON_VERSION
  673. fi
  674. if test "$PYTHON_VERSION" != ""
  675. then
  676. if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
  677. -d $with_python/lib/python$PYTHON_VERSION/site-packages
  678. then
  679. PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
  680. PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
  681. else
  682. if test -r $prefix/include/python$PYTHON_VERSION/Python.h
  683. then
  684. PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
  685. PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
  686. else
  687. if test -r /usr/include/python$PYTHON_VERSION/Python.h
  688. then
  689. PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
  690. PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
  691. else
  692. echo could not find python$PYTHON_VERSION/Python.h
  693. fi
  694. fi
  695. if test ! -d "$PYTHON_SITE_PACKAGES"
  696. then
  697. PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
  698. fi
  699. fi
  700. PYTHON_LIBS=`python$PYTHON_VERSION-config --libs`
  701. fi
  702. if test "$with_python" != ""
  703. then
  704. pythondir='$(PYTHON_SITE_PACKAGES)'
  705. else
  706. pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
  707. fi
  708. else
  709. PYTHON=
  710. fi
  711. AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
  712. if test "$PYTHON_INCLUDES" != ""
  713. then
  714. PYTHON_SUBDIR=python
  715. else
  716. PYTHON_SUBDIR=
  717. fi
  718. AC_SUBST(pythondir)
  719. AC_SUBST(PYTHON_SUBDIR)
  720. AC_SUBST(PYTHON_LIBS)
  721. dnl check for dso support
  722. WITH_MODULES=0
  723. TEST_MODULES=
  724. if test "$with_modules" != "no" ; then
  725. case "$host" in
  726. *-*-cygwin*)
  727. MODULE_EXTENSION=".dll"
  728. AC_CHECK_LIB(cygwin, dlopen, [
  729. WITH_MODULES=1
  730. MODULE_PLATFORM_LIBS=
  731. AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
  732. ])
  733. ;;
  734. *)
  735. AC_CHECK_FUNC(shl_load, libxml_have_shl_load=yes, [
  736. AC_CHECK_LIB(dld, shl_load, [
  737. MODULE_PLATFORM_LIBS="-ldld"
  738. libxml_have_shl_load=yes], [
  739. AC_CHECK_FUNC(dlopen, libxml_have_dlopen=yes, [
  740. AC_CHECK_LIB(dl, dlopen, [
  741. MODULE_PLATFORM_LIBS="-ldl"
  742. libxml_have_dlopen=yes])])])])
  743. if test "${libxml_have_shl_load}" = "yes"; then
  744. MODULE_EXTENSION=".sl"
  745. WITH_MODULES=1
  746. AC_DEFINE([HAVE_SHLLOAD], [], [Have shl_load based dso])
  747. fi
  748. if test "${libxml_have_dlopen}" = "yes"; then
  749. case "${host}" in
  750. *-*-hpux* )
  751. MODULE_EXTENSION=".sl"
  752. ;;
  753. * )
  754. MODULE_EXTENSION=".so"
  755. ;;
  756. esac
  757. WITH_MODULES=1
  758. AC_DEFINE([HAVE_DLOPEN], [], [Have dlopen based dso])
  759. fi
  760. ;;
  761. esac
  762. fi
  763. if test "${WITH_MODULES}" = "1"; then
  764. TEST_MODULES="ModuleTests"
  765. fi
  766. AC_SUBST(WITH_MODULES)
  767. AC_SUBST(MODULE_PLATFORM_LIBS)
  768. AC_SUBST(MODULE_EXTENSION)
  769. AC_SUBST(TEST_MODULES)
  770. dnl
  771. dnl Tester makes use of readline if present
  772. dnl
  773. dnl
  774. dnl specific tests to setup DV and Bill's devel environments with debug etc ...
  775. dnl (-Wunreachable-code)
  776. dnl
  777. if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \
  778. [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/home/veillard/libxml2" ]] || \
  779. [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxml2" ]]
  780. then
  781. if test "$with_minimum" != "yes"
  782. then
  783. if test "${with_mem_debug}" = "" ; then
  784. echo Activating memory debugging
  785. with_mem_debug="yes"
  786. with_run_debug="yes"
  787. fi
  788. if test "${with_docbook}" = "" ; then
  789. with_docbook="yes"
  790. fi
  791. fi
  792. if test "${GCC}" = "yes" ; then
  793. CFLAGS="-g -O -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall"
  794. fi
  795. STATIC_BINARIES="-static"
  796. dnl -Wcast-qual -ansi
  797. else
  798. STATIC_BINARIES=
  799. fi
  800. AC_SUBST(STATIC_BINARIES)
  801. dnl
  802. dnl Check for trio string functions
  803. dnl
  804. if test "${NEED_TRIO}" = "1" ; then
  805. echo Adding trio library for string functions
  806. WITH_TRIO=1
  807. else
  808. WITH_TRIO=0
  809. fi
  810. AM_CONDITIONAL(WITH_TRIO_SOURCES, test "${NEED_TRIO}" = "1")
  811. AC_SUBST(WITH_TRIO)
  812. dnl
  813. dnl Allow to enable/disable various pieces
  814. dnl
  815. echo Checking configuration requirements
  816. dnl
  817. dnl Thread-related stuff
  818. dnl
  819. THREAD_LIBS=""
  820. BASE_THREAD_LIBS=""
  821. WITH_THREADS=0
  822. THREAD_CFLAGS=""
  823. TEST_THREADS=""
  824. THREADS_W32=""
  825. if test "$with_threads" = "no" ; then
  826. echo Disabling multithreaded support
  827. else
  828. echo Enabling multithreaded support
  829. dnl Use pthread by default
  830. if test "$with_threads" = "pthread" || test "$with_threads" = "" || test "$with_threads" = "yes" ; then
  831. AC_CHECK_HEADER(pthread.h,
  832. AC_CHECK_LIB(pthread, pthread_join,[
  833. THREAD_LIBS="-lpthread"
  834. AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
  835. AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
  836. WITH_THREADS="1"]))
  837. fi
  838. case $host_os in
  839. *mingw32*) if test "$THREAD_LIBS" != "-lpthread"; then
  840. WITH_THREADS="1"
  841. THREADS_W32="Win32"
  842. THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_WIN32_THREADS"
  843. fi
  844. ;;
  845. *cygwin*) THREAD_LIBS=""
  846. ;;
  847. *beos*) WITH_THREADS="1"
  848. THREAD_CFLAGS="$THREAD_CFLAGS -DHAVE_BEOS_THREADS"
  849. ;;
  850. *linux*)
  851. if test "${GCC}" = "yes" ; then
  852. GCC_VERSION=`${CC} --version | head -1 | awk '{print $3}'`
  853. GCC_MAJOR=`echo ${GCC_VERSION} | sed 's+\..*++'`
  854. GCC_MEDIUM=`echo ${GCC_VERSION} | sed 's+[[0-9]]*\.++' | sed 's+\..*++'`
  855. if test "${THREAD_LIBS}" = "-lpthread" ; then
  856. if expr ${GCC_MEDIUM} \> 2 \& ${GCC_MAJOR} = 3 > /dev/null
  857. then
  858. THREAD_LIBS=""
  859. BASE_THREAD_LIBS="-lpthread"
  860. else
  861. if expr ${GCC_MAJOR} \> 3 > /dev/null
  862. then
  863. THREAD_LIBS=""
  864. BASE_THREAD_LIBS="-lpthread"
  865. else
  866. echo old GCC disabling weak symbols for pthread
  867. fi
  868. fi
  869. fi
  870. fi
  871. ;;
  872. esac
  873. if test "$WITH_THREADS" = "1" ; then
  874. THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT"
  875. TEST_THREADS="Threadtests"
  876. fi
  877. fi
  878. if test "$with_thread_alloc" = "yes" -a "$WITH_THREADS" = "1" ; then
  879. THREAD_CFLAGS="$THREAD_CFLAGS -DLIBXML_THREAD_ALLOC_ENABLED"
  880. fi
  881. AC_SUBST(THREAD_LIBS)
  882. AC_SUBST(BASE_THREAD_LIBS)
  883. AC_SUBST(WITH_THREADS)
  884. AC_SUBST(THREAD_CFLAGS)
  885. AC_SUBST(TEST_THREADS)
  886. AC_SUBST(THREADS_W32)
  887. dnl
  888. dnl xmllint shell history
  889. dnl
  890. if test "$with_history" = "yes" ; then
  891. echo Enabling xmllint shell history
  892. dnl check for terminal library. this is a very cool solution
  893. dnl from octave's configure.in
  894. unset tcap
  895. for termlib in ncurses curses termcap terminfo termlib; do
  896. AC_CHECK_LIB(${termlib}, tputs, [tcap="-l$termlib"])
  897. test -n "$tcap" && break
  898. done
  899. AC_CHECK_HEADER(readline/history.h,
  900. AC_CHECK_LIB(history, append_history,[
  901. RDL_LIBS="-lhistory"
  902. AC_DEFINE([HAVE_LIBHISTORY], [], [Define if history library is there (-lhistory)])]))
  903. AC_CHECK_HEADER(readline/readline.h,
  904. AC_CHECK_LIB(readline, readline,[
  905. RDL_LIBS="-lreadline $RDL_LIBS $tcap"
  906. AC_DEFINE([HAVE_LIBREADLINE], [], [Define if readline library is there (-lreadline)])], , $tcap))
  907. if test -n "$RDL_DIR" -a -n "$RDL_LIBS"; then
  908. CPPFLAGS="$CPPFLAGS -I${RDL_DIR}/include"
  909. RDL_LIBS="-L${RDL_DIR}/lib $RDL_LIBS"
  910. fi
  911. fi
  912. dnl
  913. dnl Tree functions
  914. dnl
  915. if test "$with_tree" = "no" ; then
  916. echo Disabling DOM like tree manipulation APIs
  917. WITH_TREE=0
  918. else
  919. WITH_TREE=1
  920. fi
  921. AC_SUBST(WITH_TREE)
  922. if test "$with_ftp" = "no" ; then
  923. echo Disabling FTP support
  924. WITH_FTP=0
  925. FTP_OBJ=
  926. else
  927. WITH_FTP=1
  928. FTP_OBJ=nanoftp.o
  929. fi
  930. AC_SUBST(WITH_FTP)
  931. AC_SUBST(FTP_OBJ)
  932. if test "$with_http" = "no" ; then
  933. echo Disabling HTTP support
  934. WITH_HTTP=0
  935. HTTP_OBJ=
  936. else
  937. WITH_HTTP=1
  938. HTTP_OBJ=nanohttp.o
  939. fi
  940. AC_SUBST(WITH_HTTP)
  941. AC_SUBST(HTTP_OBJ)
  942. if test "$with_legacy" = "no" ; then
  943. echo Disabling deprecated APIs
  944. WITH_LEGACY=0
  945. else
  946. WITH_LEGACY=1
  947. fi
  948. AC_SUBST(WITH_LEGACY)
  949. if test "$with_reader" = "no" ; then
  950. echo Disabling the xmlReader parsing interface
  951. WITH_READER=0
  952. READER_TEST=
  953. else
  954. WITH_READER=1
  955. READER_TEST=Readertests
  956. if test "$with_push" = "no" ; then
  957. echo xmlReader requires Push interface - enabling it
  958. with_push=yes
  959. fi
  960. fi
  961. AC_SUBST(WITH_READER)
  962. AC_SUBST(READER_TEST)
  963. if test "$with_writer" = "no" ; then
  964. echo Disabling the xmlWriter saving interface
  965. WITH_WRITER=0
  966. # WRITER_TEST=
  967. else
  968. WITH_WRITER=1
  969. # WRITER_TEST=Writertests
  970. if test "$with_push" = "no" ; then
  971. echo xmlWriter requires Push interface - enabling it
  972. with_push=yes
  973. fi
  974. if test "$with_output" = "no" ; then
  975. echo xmlWriter requires Output interface - enabling it
  976. with_output=yes
  977. fi
  978. fi
  979. AC_SUBST(WITH_WRITER)
  980. #AC_SUBST(WRITER_TEST)
  981. if test "$with_pattern" = "no" ; then
  982. echo Disabling the xmlPattern parsing interface
  983. WITH_PATTERN=0
  984. TEST_PATTERN=
  985. else
  986. WITH_PATTERN=1
  987. TEST_PATTERN=Patterntests
  988. fi
  989. AC_SUBST(WITH_PATTERN)
  990. AC_SUBST(TEST_PATTERN)
  991. if test "$with_sax1" = "no" ; then
  992. echo Disabling the older SAX1 interface
  993. WITH_SAX1=0
  994. TEST_SAX=
  995. else
  996. WITH_SAX1=1
  997. TEST_SAX=SAXtests
  998. fi
  999. AC_SUBST(WITH_SAX1)
  1000. AC_SUBST(TEST_SAX)
  1001. if test "$with_push" = "no" ; then
  1002. echo Disabling the PUSH parser interfaces
  1003. WITH_PUSH=0
  1004. TEST_PUSH=
  1005. else
  1006. WITH_PUSH=1
  1007. TEST_PUSH="XMLPushtests"
  1008. fi
  1009. AC_SUBST(WITH_PUSH)
  1010. AC_SUBST(TEST_PUSH)
  1011. if test "$with_html" = "no" ; then
  1012. echo Disabling HTML support
  1013. WITH_HTML=0
  1014. HTML_OBJ=
  1015. TEST_HTML=
  1016. else
  1017. WITH_HTML=1
  1018. HTML_OBJ="HTMLparser.o HTMLtree.o"
  1019. TEST_HTML=HTMLtests
  1020. if test "$with_push" != "no" ; then
  1021. TEST_PHTML=HTMLPushtests
  1022. else
  1023. TEST_PHTML=
  1024. fi
  1025. fi
  1026. AC_SUBST(WITH_HTML)
  1027. AC_SUBST(HTML_OBJ)
  1028. AC_SUBST(TEST_HTML)
  1029. AC_SUBST(TEST_PHTML)
  1030. if test "$with_valid" = "no" ; then
  1031. echo Disabling DTD validation support
  1032. WITH_VALID=0
  1033. TEST_VALID=
  1034. TEST_VTIME=
  1035. else
  1036. WITH_VALID=1
  1037. TEST_VALID=Validtests
  1038. TEST_VTIME=VTimingtests
  1039. fi
  1040. AC_SUBST(WITH_VALID)
  1041. AC_SUBST(TEST_VALID)
  1042. AC_SUBST(TEST_VTIME)
  1043. if test "$with_catalog" = "no" ; then
  1044. echo Disabling Catalog support
  1045. WITH_CATALOG=0
  1046. CATALOG_OBJ=
  1047. TEST_CATALOG=
  1048. else
  1049. WITH_CATALOG=1
  1050. CATALOG_OBJ="catalog.o"
  1051. TEST_CATALOG=Catatests
  1052. fi
  1053. AC_SUBST(WITH_CATALOG)
  1054. AC_SUBST(CATALOG_OBJ)
  1055. AC_SUBST(TEST_CATALOG)
  1056. if test "$with_docbook" = "no" ; then
  1057. echo Disabling Docbook support
  1058. WITH_DOCB=0
  1059. DOCB_OBJ=
  1060. else
  1061. WITH_DOCB=1
  1062. DOCB_OBJ="DOCBparser.o"
  1063. fi
  1064. AC_SUBST(WITH_DOCB)
  1065. AC_SUBST(DOCB_OBJ)
  1066. if test "$with_xptr" = "no" ; then
  1067. echo Disabling XPointer support
  1068. WITH_XPTR=0
  1069. XPTR_OBJ=
  1070. TEST_XPTR=
  1071. else
  1072. WITH_XPTR=1
  1073. XPTR_OBJ=xpointer.o
  1074. TEST_XPTR=XPtrtests
  1075. if test "$with_xpath" = "no" ; then
  1076. echo XPointer requires XPath support - enabling it
  1077. with_xpath=yes
  1078. fi
  1079. fi
  1080. AC_SUBST(WITH_XPTR)
  1081. AC_SUBST(XPTR_OBJ)
  1082. AC_SUBST(TEST_XPTR)
  1083. if test "$with_c14n" = "no" ; then
  1084. echo Disabling C14N support
  1085. WITH_C14N=0
  1086. C14N_OBJ=
  1087. TEST_C14N=
  1088. else
  1089. WITH_C14N=1
  1090. C14N_OBJ="c14n.c"
  1091. TEST_C14N=C14Ntests
  1092. if test "$with_xpath" = "no" ; then
  1093. echo C14N requires XPath support - enabling it
  1094. with_xpath=yes
  1095. fi
  1096. fi
  1097. AC_SUBST(WITH_C14N)
  1098. AC_SUBST(C14N_OBJ)
  1099. AC_SUBST(TEST_C14N)
  1100. if test "$with_xinclude" = "no" ; then
  1101. echo Disabling XInclude support
  1102. WITH_XINCLUDE=0
  1103. XINCLUDE_OBJ=
  1104. with_xinclude="no"
  1105. TEST_XINCLUDE=
  1106. else
  1107. WITH_XINCLUDE=1
  1108. XINCLUDE_OBJ=xinclude.o
  1109. TEST_XINCLUDE=XIncludetests
  1110. if test "$with_xpath" = "no" ; then
  1111. echo XInclude requires XPath support - enabling it
  1112. with_xpath=yes
  1113. fi
  1114. fi
  1115. AC_SUBST(WITH_XINCLUDE)
  1116. AC_SUBST(XINCLUDE_OBJ)
  1117. AC_SUBST(TEST_XINCLUDE)
  1118. if test "$with_xpath" = "no" ; then
  1119. echo Disabling XPATH support
  1120. WITH_XPATH=0
  1121. XPATH_OBJ=
  1122. TEST_XPATH=
  1123. else
  1124. WITH_XPATH=1
  1125. XPATH_OBJ=xpath.o
  1126. TEST_XPATH=XPathtests
  1127. fi
  1128. AC_SUBST(WITH_XPATH)
  1129. AC_SUBST(XPATH_OBJ)
  1130. AC_SUBST(TEST_XPATH)
  1131. dnl
  1132. dnl output functions
  1133. dnl
  1134. if test "$with_output" = "no" ; then
  1135. echo Disabling serialization/saving support
  1136. WITH_OUTPUT=0
  1137. else
  1138. WITH_OUTPUT=1
  1139. fi
  1140. AC_SUBST(WITH_OUTPUT)
  1141. WITH_ICONV=0
  1142. if test "$with_iconv" = "no" ; then
  1143. echo Disabling ICONV support
  1144. else
  1145. if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
  1146. CPPFLAGS="${CPPFLAGS} -I$with_iconv/include"
  1147. # Export this since our headers include iconv.h
  1148. XML_INCLUDEDIR="${XML_INCLUDEDIR} -I$with_iconv/include"
  1149. ICONV_LIBS="-L$with_iconv/lib"
  1150. fi
  1151. AC_CHECK_HEADER(iconv.h,
  1152. AC_MSG_CHECKING(for iconv)
  1153. AC_TRY_LINK([#include <stdlib.h>
  1154. #include <iconv.h>],[
  1155. iconv_t cd = iconv_open ("","");
  1156. iconv (cd, NULL, NULL, NULL, NULL);],[
  1157. AC_MSG_RESULT(yes)
  1158. WITH_ICONV=1],[
  1159. AC_MSG_RESULT(no)
  1160. AC_MSG_CHECKING(for iconv in -liconv)
  1161. _ldflags="${LDFLAGS}"
  1162. _libs="${LIBS}"
  1163. LDFLAGS="${LDFLAGS} ${ICONV_LIBS}"
  1164. LIBS="${LIBS} -liconv"
  1165. AC_TRY_LINK([#include <stdlib.h>
  1166. #include <iconv.h>],[
  1167. iconv_t cd = iconv_open ("","");
  1168. iconv (cd, NULL, NULL, NULL, NULL);],[
  1169. AC_MSG_RESULT(yes)
  1170. WITH_ICONV=1
  1171. ICONV_LIBS="${ICONV_LIBS} -liconv"
  1172. LIBS="${_libs}"
  1173. LDFLAGS="${_ldflags}"],[
  1174. AC_MSG_RESULT(no)
  1175. LIBS="${_libs}"
  1176. LDFLAGS="${_ldflags}"])]))
  1177. if test "$WITH_ICONV" = "1" ; then
  1178. AC_MSG_CHECKING([for iconv declaration])
  1179. AC_CACHE_VAL(xml_cv_iconv_arg2, [
  1180. AC_TRY_COMPILE([#include <stdlib.h>
  1181. #include <iconv.h>
  1182. extern
  1183. #ifdef __cplusplus
  1184. "C"
  1185. #endif
  1186. #if defined(__STDC__) || defined(__cplusplus)
  1187. size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
  1188. #else
  1189. size_t iconv();
  1190. #endif
  1191. ], [], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
  1192. xml_cv_iconv_decl="extern size_t iconv (iconv_t cd, $xml_cv_iconv_arg2 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
  1193. AC_MSG_RESULT([${xml_xxx:-
  1194. }$xml_cv_iconv_decl])
  1195. AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
  1196. [Define as const if the declaration of iconv() needs const.])
  1197. fi
  1198. fi
  1199. case "$host" in
  1200. *mingw*) M_LIBS=""
  1201. ;;
  1202. *beos*) M_LIBS=""
  1203. ;;
  1204. *haiku*) M_LIBS=""
  1205. ;;
  1206. *) M_LIBS="-lm"
  1207. ;;
  1208. esac
  1209. XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS"
  1210. XML_LIBTOOLLIBS="libxml2.la"
  1211. AC_SUBST(WITH_ICONV)
  1212. WITH_ISO8859X=1
  1213. if test "$WITH_ICONV" != "1" ; then
  1214. if test "$with_iso8859x" = "no" ; then
  1215. echo Disabling ISO8859X support
  1216. WITH_ISO8859X=0
  1217. fi
  1218. fi
  1219. AC_SUBST(WITH_ISO8859X)
  1220. if test "$with_schematron" = "no" ; then
  1221. echo "Disabling Schematron support"
  1222. WITH_SCHEMATRON=0
  1223. TEST_SCHEMATRON=
  1224. else
  1225. echo "Enabled Schematron support"
  1226. WITH_SCHEMATRON=1
  1227. TEST_SCHEMATRON="Schematrontests"
  1228. with_xpath=yes
  1229. with_pattern=yes
  1230. fi
  1231. AC_SUBST(WITH_SCHEMATRON)
  1232. AC_SUBST(TEST_SCHEMATRON)
  1233. if test "$with_schemas" = "no" ; then
  1234. echo "Disabling Schemas/Relax-NG support"
  1235. WITH_SCHEMAS=0
  1236. TEST_SCHEMAS=
  1237. else
  1238. echo "Enabled Schemas/Relax-NG support"
  1239. WITH_SCHEMAS=1
  1240. TEST_SCHEMAS="Schemastests Relaxtests"
  1241. if test "$PYTHON_INCLUDES" != "" ; then
  1242. PYTHON_TESTS="$PYTHON_TESTS RelaxNGPythonTests SchemasPythonTests"
  1243. fi
  1244. with_regexps=yes
  1245. fi
  1246. AC_SUBST(WITH_SCHEMAS)
  1247. AC_SUBST(TEST_SCHEMAS)
  1248. if test "$with_regexps" = "no" ; then
  1249. echo Disabling Regexps support
  1250. WITH_REGEXPS=0
  1251. TEST_REGEXPS=
  1252. else
  1253. WITH_REGEXPS=1
  1254. TEST_REGEXPS="Regexptests Automatatests"
  1255. fi
  1256. AC_SUBST(WITH_REGEXPS)
  1257. AC_SUBST(TEST_REGEXPS)
  1258. if test "$with_debug" = "no" ; then
  1259. echo Disabling DEBUG support
  1260. WITH_DEBUG=0
  1261. DEBUG_OBJ=
  1262. TEST_DEBUG=
  1263. else
  1264. WITH_DEBUG=1
  1265. DEBUG_OBJ=debugXML.o
  1266. TEST_DEBUG=Scripttests
  1267. fi
  1268. AC_SUBST(WITH_DEBUG)
  1269. AC_SUBST(DEBUG_OBJ)
  1270. AC_SUBST(TEST_DEBUG)
  1271. if test "$with_mem_debug" = "yes" ; then
  1272. if test "$with_thread_alloc" = "yes" ; then
  1273. echo Disabling memory debug - cannot use mem-debug with thread-alloc!
  1274. WITH_MEM_DEBUG=0
  1275. else
  1276. echo Enabling memory debug support
  1277. WITH_MEM_DEBUG=1
  1278. fi
  1279. else
  1280. WITH_MEM_DEBUG=0
  1281. fi
  1282. AC_SUBST(WITH_MEM_DEBUG)
  1283. if test "$with_run_debug" = "yes" ; then
  1284. echo Enabling runtime debug support
  1285. WITH_RUN_DEBUG=1
  1286. else
  1287. WITH_RUN_DEBUG=0
  1288. fi
  1289. AC_SUBST(WITH_RUN_DEBUG)
  1290. WIN32_EXTRA_LIBADD=
  1291. WIN32_EXTRA_LDFLAGS=
  1292. CYGWIN_EXTRA_LDFLAGS=
  1293. CYGWIN_EXTRA_PYTHON_LIBADD=
  1294. case "$host" in
  1295. *-*-mingw*)
  1296. CPPFLAGS="$CPPFLAGS -DWIN32"
  1297. WIN32_EXTRA_LIBADD="-lws2_32"
  1298. WIN32_EXTRA_LDFLAGS="-no-undefined"
  1299. AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
  1300. AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
  1301. AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
  1302. ;;
  1303. *-*-cygwin*)
  1304. CYGWIN_EXTRA_LDFLAGS="-no-undefined"
  1305. if test "${PYTHON}" != ""
  1306. then
  1307. CYGWIN_EXTRA_PYTHON_LIBADD="-L/usr/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
  1308. fi
  1309. ;;
  1310. esac
  1311. AC_SUBST(WIN32_EXTRA_LIBADD)
  1312. AC_SUBST(WIN32_EXTRA_LDFLAGS)
  1313. AC_SUBST(CYGWIN_EXTRA_LDFLAGS)
  1314. AC_SUBST(CYGWIN_EXTRA_PYTHON_LIBADD)
  1315. if test "$with_coverage" = "yes" -a "${GCC}" = "yes"
  1316. then
  1317. echo Enabling code coverage for GCC
  1318. CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
  1319. LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
  1320. else
  1321. echo Disabling code coverage for GCC
  1322. fi
  1323. AC_SUBST(CPPFLAGS)
  1324. AC_SUBST(CFLAGS)
  1325. AC_SUBST(LDFLAGS)
  1326. AC_SUBST(XML_CFLAGS)
  1327. AC_SUBST(XML_LIBDIR)
  1328. AC_SUBST(XML_LIBS)
  1329. AC_SUBST(XML_LIBTOOLLIBS)
  1330. AC_SUBST(ICONV_LIBS)
  1331. AC_SUBST(XML_INCLUDEDIR)
  1332. AC_SUBST(HTML_DIR)
  1333. AC_SUBST(HAVE_ISNAN)
  1334. AC_SUBST(HAVE_ISINF)
  1335. AC_SUBST(PYTHON)
  1336. AC_SUBST(PYTHON_VERSION)
  1337. AC_SUBST(PYTHON_INCLUDES)
  1338. AC_SUBST(PYTHON_SITE_PACKAGES)
  1339. AC_SUBST(M_LIBS)
  1340. AC_SUBST(RDL_LIBS)
  1341. dnl for the spec file
  1342. RELDATE=`date +'%a %b %e %Y'`
  1343. AC_SUBST(RELDATE)
  1344. AC_SUBST(PYTHON_TESTS)
  1345. rm -f COPYING.LIB COPYING
  1346. ln -s Copyright COPYING
  1347. # keep on one line for cygwin c.f. #130896
  1348. AC_OUTPUT(libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h xml2-config libxml-2.0.pc libxml-2.0-uninstalled.pc python/setup.py)
  1349. chmod +x xml2-config python/setup.py
  1350. echo Done configuring