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