[CVE-2021-30560] Fix use-after-free in xsltApplyTemplates
[platform/upstream/libxslt.git] / configure.ac
1 dnl Process this file with autoconf to produce a configuration script.
2 AC_PREREQ(2.63)
3
4 m4_define([MAJOR_VERSION], [1])
5 m4_define([MINOR_VERSION], [1])
6 m4_define([MICRO_VERSION], [34])
7
8 AC_INIT([libxslt], [MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION])
9 AC_CONFIG_SRCDIR([libxslt/xslt.c])
10 AC_CONFIG_HEADERS(config.h)
11 AC_CANONICAL_HOST
12 AC_USE_SYSTEM_EXTENSIONS
13
14 dnl
15 dnl libxslt is the main part of the package
16 dnl libexslt is an extension
17 dnl
18 LIBXSLT_MAJOR_VERSION=MAJOR_VERSION
19 LIBXSLT_MINOR_VERSION=MINOR_VERSION
20 LIBXSLT_MICRO_VERSION=MICRO_VERSION
21 LIBEXSLT_MAJOR_VERSION=0
22 LIBEXSLT_MINOR_VERSION=8
23 LIBEXSLT_MICRO_VERSION=20
24 LIBXML_REQUIRED_VERSION=2.6.27
25
26
27 LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
28 LIBXSLT_VERSION_INFO=`expr $LIBXSLT_MAJOR_VERSION + $LIBXSLT_MINOR_VERSION`:$LIBXSLT_MICRO_VERSION:$LIBXSLT_MINOR_VERSION
29
30 LIBXSLT_VERSION_NUMBER=`expr $LIBXSLT_MAJOR_VERSION \* 10000 + $LIBXSLT_MINOR_VERSION \* 100 + $LIBXSLT_MICRO_VERSION`
31 LIBXSLT_MAJOR_MINOR_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION
32
33 if test -f CVS/Entries; then
34   extra=`grep ChangeLog CVS/Entries | grep -v LIBXSLT | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
35   echo extra=$extra
36   if test "$extra" != ""
37   then
38       LIBXSLT_VERSION_EXTRA="-CVS$extra"
39   fi
40 else if test -d .svn ; then
41   extra=`svn info | grep Revision | sed 's+Revision: ++'`
42   echo extra=$extra
43   if test "$extra" != ""
44   then
45       LIBXSLT_VERSION_EXTRA="-SVN$extra"
46   fi
47 else if test -d .git ; then
48   extra=`git describe | sed 's+LIBXSLT[[0-9.]]*-++'`
49   echo extra=$extra
50   if test "$extra" != ""
51   then
52       LIBXSLT_VERSION_EXTRA="-GIT$extra"
53   fi
54 fi
55 fi
56 fi
57
58 AC_SUBST(LIBXSLT_MAJOR_VERSION)
59 AC_SUBST(LIBXSLT_MINOR_VERSION)
60 AC_SUBST(LIBXSLT_MICRO_VERSION)
61 AC_SUBST(LIBXSLT_VERSION)
62 AC_SUBST(LIBXSLT_VERSION_INFO)
63 AC_SUBST(LIBXSLT_VERSION_NUMBER)
64 AC_SUBST(LIBXSLT_VERSION_EXTRA)
65 AC_SUBST(LIBXSLT_MAJOR_MINOR_VERSION)
66
67 dnl
68 dnl libexslt is an extension library
69 dnl
70
71 LIBEXSLT_VERSION=$LIBEXSLT_MAJOR_VERSION.$LIBEXSLT_MINOR_VERSION.$LIBEXSLT_MICRO_VERSION
72 LIBEXSLT_VERSION_INFO=`expr $LIBEXSLT_MAJOR_VERSION + $LIBEXSLT_MINOR_VERSION`:$LIBEXSLT_MICRO_VERSION:$LIBEXSLT_MINOR_VERSION
73
74 LIBEXSLT_VERSION_NUMBER=`expr $LIBEXSLT_MAJOR_VERSION \* 10000 + $LIBEXSLT_MINOR_VERSION \* 100 + $LIBEXSLT_MICRO_VERSION`
75
76 if test -f CVS/Entries; then
77   LIBEXSLT_VERSION_EXTRA=-CVS`grep ChangeLog CVS/Entries | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
78 fi
79
80 AC_SUBST(LIBEXSLT_MAJOR_VERSION)
81 AC_SUBST(LIBEXSLT_MINOR_VERSION)
82 AC_SUBST(LIBEXSLT_MICRO_VERSION)
83 AC_SUBST(LIBEXSLT_VERSION)
84 AC_SUBST(LIBEXSLT_VERSION_INFO)
85 AC_SUBST(LIBEXSLT_VERSION_NUMBER)
86 AC_SUBST(LIBEXSLT_VERSION_EXTRA)
87
88 AM_INIT_AUTOMAKE([foreign])
89
90 # AM_MAINTAINER_MODE
91
92 # Support silent build rules, requires at least automake-1.11. Disable
93 # by either passing --disable-silent-rules to configure or passing V=1
94 # to make
95 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
96
97 dnl
98 dnl Specific dir for HTML output ?
99 dnl
100
101 AC_ARG_WITH(html-dir, AS_HELP_STRING([--with-html-dir=path],
102             [path to base html directory, default $datadir/doc/html]),
103             [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
104
105 AC_ARG_WITH(html-subdir, AS_HELP_STRING([--with-html-subdir=path],
106             [directory used under html-dir, default $PACKAGE-$VERSION/html]),
107             [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
108             [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
109
110 AC_SUBST(HTML_DIR)
111
112 dnl
113 dnl Check the environment
114 dnl
115
116 AC_PROG_CC
117 AC_PROG_INSTALL
118 AC_PROG_CPP
119 AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
120 AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
121 PKG_PROG_PKG_CONFIG
122
123 AC_HEADER_STDC
124
125 LT_INIT(win32-dll)
126
127
128 AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
129
130 dnl
131 dnl if the system support linker version scripts for symbol versioning
132 dnl then add it
133 dnl
134 AC_MSG_CHECKING([how to pass version script to the linker ($LD)])
135 VERSION_SCRIPT_FLAGS=none
136 if $LD --help 2>&1 | grep "version-script" >/dev/null 2>/dev/null; then
137     VERSION_SCRIPT_FLAGS=-Wl,--version-script=
138 elif $LD --help 2>&1 | grep "M mapfile" >/dev/null 2>/dev/null; then
139     VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
140 fi
141 AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
142 AC_SUBST(VERSION_SCRIPT_FLAGS)
143 AM_CONDITIONAL([USE_VERSION_SCRIPT], [test "$VERSION_SCRIPT_FLAGS" != none])
144
145 dnl Look for pthread.h, needed for testThreads
146 case $host in
147   *-mingw*) ;;
148   *)
149 THREAD_LIBS=""
150 AC_CHECK_HEADER(pthread.h,
151     AC_CHECK_LIB(pthread, pthread_join,[
152        AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
153        AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
154        THREAD_LIBS="-lpthread"]))
155   ;;
156 esac
157
158 AC_SUBST(THREAD_LIBS)
159
160 dnl
161 dnl Detect supported locale
162 dnl
163
164 AC_CHECK_HEADERS([locale.h xlocale.h])
165 AC_CHECK_FUNCS([strxfrm_l])
166
167 dnl
168 dnl Math detection
169 dnl
170
171 AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h)
172 AC_CHECK_HEADERS(sys/timeb.h time.h sys/stat.h sys/select.h stdarg.h)
173 AC_CHECK_HEADERS(errno.h)
174 AC_CHECK_FUNCS(stat _stat)
175 AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow,
176   [M_LIBS="-lm"; AC_DEFINE([HAVE_POW],[], [Define if pow is there])]))
177
178 AC_CHECK_FUNC(floor, , AC_CHECK_LIB(m, floor,
179   [M_LIBS="-lm"; AC_DEFINE([HAVE_FLOOR],[], [Define if floor is there])]))
180
181 AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
182   [M_LIBS="-lm"; AC_DEFINE([HAVE_FABS],[], [Define if fabs is there])]))
183
184
185 AC_CHECK_FUNCS(gettimeofday)
186 AC_CHECK_FUNCS(localtime localtime_r time gmtime gmtime_r ftime)
187
188 dnl Checking the standard string functions availability
189 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
190                NEED_TRIO=1)
191
192 dnl Checking for POSIX timers
193 AC_CHECK_FUNCS(clock_gettime, [], [
194   AC_CHECK_LIB(rt, clock_gettime, [
195     AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
196     EXTRA_LIBS="$EXTRA_LIBS -lrt"
197   ])
198 ])
199
200 dnl
201 dnl Check for trio string functions
202 dnl
203
204 if test "${NEED_TRIO}" = "1" ; then
205     echo Reusing trio library for string functions
206     WITH_TRIO=1
207 else    
208     WITH_TRIO=0
209 fi
210 AC_SUBST(WITH_TRIO)
211
212 dnl
213 dnl Some packages need to be checked against version numbers so we
214 dnl define a function here for later use
215 dnl
216 AC_DEFUN([VERSION_TO_NUMBER],
217 [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
218
219 dnl
220 dnl Perl is just needed for generating some data for XSLtmark
221 dnl
222
223 AC_CHECK_PROG(PERL, perl, perl, false)
224 AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
225
226 dnl
227 dnl check for python
228 dnl
229
230 PYTHON_VERSION=
231 PYTHON_INCLUDES=
232 PYTHON_SITE_PACKAGES=
233 pythondir=
234 AC_ARG_WITH(python, [  --with-python[=DIR]    Build Python bindings if found])
235 if test "$with_python" != "no" ; then
236     if test -x "$with_python/bin/python"
237     then
238         echo Found python in $with_python/bin/python
239         PYTHON="$with_python/bin/python"
240     else
241         if test -x "$with_python"
242         then
243             echo Found python in $with_python
244             PYTHON="$with_python"
245         else
246             if test -x "$PYTHON"
247             then
248                 echo Found python in environment PYTHON=$PYTHON
249                 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
250             else
251                 AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
252             fi
253         fi
254     fi
255     if test "$PYTHON" != ""
256     then
257         echo "PYTHON is pointing at $PYTHON"
258         PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
259         echo Found Python version $PYTHON_VERSION
260         LIBXML2_PYTHON=`$PYTHON -c "try : import libxml2 ; print 1
261 except: print 0"`
262         if test "$LIBXML2_PYTHON" = "1"
263         then
264             echo Found libxml2-python module
265         else
266             echo Warning: Missing libxml2-python
267         fi
268     fi
269     if test "$PYTHON_VERSION" != ""
270     then
271         if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
272            -d $with_python/lib/python$PYTHON_VERSION/site-packages
273         then
274             PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
275             PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
276         else
277             if test -r $prefix/include/python$PYTHON_VERSION/Python.h
278             then
279                 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
280                 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
281             else
282                 if test -r /usr/include/python$PYTHON_VERSION/Python.h
283                 then
284                     PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
285                     PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
286                 else
287                     echo could not find python$PYTHON_VERSION/Python.h
288                 fi
289             fi
290             if test ! -d "$PYTHON_SITE_PACKAGES"
291             then
292                     PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
293             fi
294         fi
295         PYTHON_LIBS=`python$PYTHON_VERSION-config --libs`
296     fi
297     if test "$with_python" != ""
298     then
299         pythondir='$(PYTHON_SITE_PACKAGES)'
300     else
301         pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
302     fi
303 fi
304 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
305 if test "$PYTHON_INCLUDES" != ""
306 then
307     PYTHON_SUBDIR=python
308 else
309     PYTHON_SUBDIR=
310 fi
311 AC_SUBST(pythondir)
312 AC_SUBST(PYTHON_SUBDIR)
313 AC_SUBST(PYTHON_LIBS)
314
315 AC_ARG_WITH(crypto, [  --with-crypto           Add crypto support to exslt (on)])
316 WITH_CRYPTO=0
317 CRYPTO_TESTDIR=
318 if test "$with_crypto" = "no" ; then
319     echo Disabling crypto support
320     LIBGCRYPT_CFLAGS=""
321     LIBGCRYPT_LIBS=""
322 else
323 case $host in
324   *-mingw*)
325     dnl Use only native crypto-API for mingw* hosts
326     dnl TODO: to implement --with-crypto=foo to allow switch between
327     dnl crypto libraries
328     WITH_CRYPTO=1
329     CRYPTO_TESTDIR=crypto
330     ;;
331   *)
332     AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no)
333     if test "$LIBGCRYPT_CONFIG" != "no" ; then
334       LIBGCRYPT_VERSION=`$LIBGCRYPT_CONFIG --version`
335       if test VERSION_TO_NUMBER(echo $LIBGCRYPT_VERSION) -lt VERSION_TO_NUMBER(echo "1.1.42")
336       then
337         LIBGCRYPT_CFLAGS=""
338         LIBGCRYPT_LIBS=""
339         echo 'gcrypt library version < 1.1.42 - Crypto extensions will not be available.'
340       else
341         LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --cflags`
342         LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --libs`
343         AC_DEFINE(HAVE_GCRYPT, 1, [Define if gcrypt library is available.])
344         echo 'Crypto extensions will be available.'
345         WITH_CRYPTO=1
346         CRYPTO_TESTDIR=crypto
347       fi
348     else
349       LIBGCRYPT_CFLAGS=""
350       LIBGCRYPT_LIBS=""
351       echo 'Crypto extensions will not be available. Install libgcrypt and reconfigure to make available.'
352     fi
353 esac
354 fi
355 AC_SUBST(WITH_CRYPTO)
356 AC_SUBST(CRYPTO_TESTDIR)
357 AC_SUBST(LIBGCRYPT_CFLAGS)
358 AC_SUBST(LIBGCRYPT_LIBS)
359
360 dnl
361 dnl Debug for DV (-Wunreachable-code)
362 dnl
363 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
364    [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxslt" ]]
365    then
366     if test "${with_mem_debug}" = "" ;
367     then
368         with_mem_debug="yes"
369     fi
370     CFLAGS="-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat=2 -Wmissing-format-attribute -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline "
371 fi
372
373 AC_ARG_WITH(debug, [  --with-debug            Add the debugging code (on)])
374 if test "$with_debug" = "no" ; then
375     echo Disabling debug support
376     WITH_XSLT_DEBUG=0
377 else    
378     WITH_XSLT_DEBUG=1
379 fi
380 AC_SUBST(WITH_XSLT_DEBUG)
381
382 AC_ARG_WITH(mem_debug, [  --with-mem-debug        Add the memory debugging module (off)])
383 if test "$with_mem_debug" = "yes" ; then
384     echo Enabling memory debug support
385     WITH_MEM_DEBUG=1
386 else    
387     WITH_MEM_DEBUG=0
388 fi
389 AC_SUBST(WITH_MEM_DEBUG)
390
391 dnl 
392 dnl Is debugger support requested
393 dnl
394 AC_ARG_WITH(debugger, [  --with-debugger        Add the debugging support (on)])
395 if test "$with_debugger" = "no" ; then
396     echo Disabling debugger
397     WITH_DEBUGGER=0
398 else
399     echo Enabling debugger
400     WITH_DEBUGGER=1
401     AC_DEFINE([WITH_DEBUGGER],[], [Define if debugging support is enabled])
402 fi
403 AC_SUBST(WITH_DEBUGGER)
404
405 dnl
406 dnl Is profiler support requested
407 dnl
408 AC_ARG_WITH(profiler, [  --with-profiler        Add the profiling support (on)])
409 if test "$with_profiler" = "no" ; then
410     echo Disabling profiler
411     WITH_PROFILER=0
412 else
413     echo Enabling profiler
414     WITH_PROFILER=1
415     AC_DEFINE([WITH_PROFILER],[], [Define if profiling support is enabled])
416 fi
417 AC_SUBST(WITH_PROFILER)
418
419 dnl
420 dnl The following new parameters were added to offer
421 dnl the ability to specify the location of the libxml
422 dnl library during linking and compilation.
423 dnl
424 dnl original work - Mathieu Lacage 30/03/2000
425 dnl some tweaking - David Härdeman 30/10/2001
426 dnl
427
428 LIBXML_CONFIG_PREFIX=""
429 LIBXML_SRC=""
430
431 AC_ARG_WITH(libxml-prefix,
432         [  --with-libxml-prefix=[PFX]           Specify location of libxml config],
433         LIBXML_CONFIG_PREFIX=$withval
434 )
435         
436 AC_ARG_WITH(libxml-include-prefix,
437         [  --with-libxml-include-prefix=[PFX]   Specify location of libxml headers],
438         LIBXML_CFLAGS="-I$withval"
439 )
440
441 AC_ARG_WITH(libxml-libs-prefix,
442         [  --with-libxml-libs-prefix=[PFX]      Specify location of libxml libs],
443         LIBXML_LIBS="-L$withval"
444 )
445
446 AC_ARG_WITH(libxml-src,
447         [  --with-libxml-src=[DIR]              For libxml thats not installed yet (sets all three above)],
448         LIBXML_SRC="$withval"
449 )
450 AC_SUBST(LIBXML_SRC)
451
452 dnl
453 dnl where is xml2-config
454 dnl
455
456 AC_SUBST(LIBXML_REQUIRED_VERSION)
457 if test "x$LIBXML_CONFIG_PREFIX" != "x"
458 then
459         AC_PATH_TOOL([XML_CONFIG], [xml2-config], [false], [${LIBXML_CONFIG_PREFIX}/bin])
460 else
461         AC_PATH_TOOL([XML_CONFIG], [xml2-config], [false])
462 fi
463
464 dnl
465 dnl imported from libxml2, c.f. #77827 
466 dnl
467 if test "${GCC}" != "yes" ; then
468     case "${host}" in
469           *-*-hpux* )
470                CFLAGS="${CFLAGS} -Wp,-H30000"
471                ;;
472           *-dec-osf* )
473                CFLAGS="${CFLAGS} -ieee"
474                ;;
475     esac
476 else
477     CFLAGS="${CFLAGS} -Wall -Wextra -Wformat=2 -Wmissing-format-attribute"
478     case "${host}" in
479           alpha*-*-linux* )
480                CFLAGS="${CFLAGS} -mieee"
481                ;;
482           alpha*-*-osf* )
483                CFLAGS="${CFLAGS} -mieee"
484                ;;
485     esac
486 fi
487
488 dnl
489 dnl Check which type of library to build. Default to building shared and static.
490 dnl
491
492 build_shared_libs="yes"
493 build_static_libs="yes"
494
495 if test "$enable_shared" = "no"; then
496     build_shared_libs="no"
497 fi
498
499 if test "$enable_static" = "no"; then
500     build_static_libs="no"
501 fi
502
503 if test "$build_shared_libs" = "no" -a "$build_static_libs" = "no"; then
504     build_static_libs="yes"
505 fi
506
507 dnl
508 dnl Override other variables if LIBXML_SRC is set
509 dnl
510
511 if test "x$LIBXML_SRC" != "x"
512 then
513         CWD=`pwd`
514         if cd $LIBXML_SRC
515         then
516                 LIBXML_SRC=`pwd`
517                 XML_CONFIG="${LIBXML_SRC}/xml2-config"
518                 LIBXML_CFLAGS="-I${LIBXML_SRC}/include"
519                 LIBXML_LIBS="-L${LIBXML_SRC} `$XML_CONFIG --libs`"
520                 WITH_MODULES="`$XML_CONFIG --modules`"
521                 cd $CWD
522         else
523                 AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
524         fi
525 fi
526
527 dnl
528 dnl Try pkg-config first if nothing is set
529 dnl
530
531 if test "x$LIBXML_CONFIG_PREFIX" = "x" -a "x$LIBXML_LIBS" = "x"
532 then
533         PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= $LIBXML_REQUIRED_VERSION], [
534                 WITH_MODULES="`$PKG_CONFIG --variable=modules libxml-2.0`"
535         ], [ ])
536 fi
537
538 dnl
539 dnl make sure xml2-config is executable,
540 dnl test version and init our variables
541 dnl
542
543 if test "x$LIBXML_LIBS" = "x" && ${XML_CONFIG} --libs print > /dev/null 2>&1
544 then
545         AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION)
546         XMLVERS=`$XML_CONFIG --version`
547         if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION)
548         then
549                 AC_MSG_RESULT($XMLVERS found)
550         else
551                 AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
552         fi
553         LIBXML_LIBS="`$XML_CONFIG --libs`"
554         LIBXML_CFLAGS="`$XML_CONFIG --cflags`"
555         WITH_MODULES="`$XML_CONFIG --modules`"
556 fi
557
558 if test "x$LIBXML_LIBS" = "x"
559 then
560         AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
561 fi
562
563
564 AC_SUBST(CFLAGS)
565 AC_SUBST(CPPFLAGS)
566 AC_SUBST(LDFLAGS)
567
568 AC_ARG_WITH(plugins,
569 [  --with-plugins          Add plugin extension support (on)])
570 if test "$with_plugins" = ""
571 then
572     with_plugins=yes
573 fi
574
575 AC_MSG_CHECKING([whether shared libraries will be built (required for plugins)])
576 if test "$build_shared_libs" = "no" -a "$with_plugins" = "yes"; then
577          AC_MSG_RESULT(no)
578          AC_MSG_WARN([Disabling plugin support.])
579          AC_MSG_WARN([Plugins require that shared libraries be built.])
580          with_plugins=no
581 else
582          AC_MSG_RESULT(yes)
583 fi
584
585 if test "$with_plugins" = "yes" ; then
586   AC_MSG_CHECKING([libxml2 module support])
587   if test "${WITH_MODULES}" = "1"; then
588     AC_MSG_RESULT(yes)
589   else
590     AC_MSG_RESULT(no)
591     WITH_MODULES="0"
592   fi
593 else
594   WITH_MODULES="0"
595 fi
596
597 AC_SUBST(WITH_MODULES)
598 AM_CONDITIONAL(WITH_MODULES, test "$WITH_MODULES" = "1")
599
600 dnl
601 dnl setup default module path
602 dnl
603 expanded_libdir=$(
604     test "x$prefix" = xNONE && prefix="$ac_default_prefix"
605     test "x$exec_prefix" = xNONE && exec_prefix="$prefix"
606     while test "$libdir_old" != "$libdir"; do
607       libdir_old="$libdir"
608       eval libdir="$libdir"
609     done
610     echo "$libdir"
611 )
612 LIBXSLT_DEFAULT_PLUGINS_PATH="$expanded_libdir/libxslt-plugins"
613 AC_SUBST(LIBXSLT_DEFAULT_PLUGINS_PATH)
614
615 case "$host" in
616  *-*-cygwin*|*-*-mingw*)
617  LDFLAGS="$LDFLAGS -no-undefined"
618  ;;
619 esac
620
621
622 AC_SUBST(XSLTPROCDV)
623 AC_SUBST(PYTHONSODV)
624 AC_SUBST(XML_CONFIG)
625 AC_SUBST(LIBXML_LIBS)
626 AC_SUBST(LIBXML_CFLAGS)
627 AC_SUBST(PYTHON)
628 AC_SUBST(PYTHON_VERSION)
629 AC_SUBST(PYTHON_INCLUDES)
630 AC_SUBST(PYTHON_SITE_PACKAGES)
631
632 XSLT_LIBDIR='-L${libdir}'
633 XSLT_INCLUDEDIR='-I${includedir}'
634 XSLT_LIBS="-lxslt $LIBXML_LIBS"
635 XSLT_PRIVATE_LIBS="$M_LIBS"
636 AC_SUBST(XSLT_LIBDIR)
637 AC_SUBST(XSLT_INCLUDEDIR)
638 AC_SUBST(XSLT_LIBS)
639 AC_SUBST(XSLT_PRIVATE_LIBS)
640
641 EXSLT_LIBDIR='-L${libdir}'
642 EXSLT_INCLUDEDIR='-I${includedir}'
643 EXSLT_LIBS="-lexslt $XSLT_LIBS"
644 EXSLT_PRIVATE_LIBS="$XSLT_PRIVATE_LIBS $LIBGCRYPT_LIBS"
645 AC_SUBST(EXSLT_LIBDIR)
646 AC_SUBST(EXSLT_INCLUDEDIR)
647 AC_SUBST(EXSLT_LIBS)
648 AC_SUBST(EXSLT_PRIVATE_LIBS)
649
650 AC_SUBST(EXTRA_LIBS)
651
652 AC_SUBST(M_LIBS)
653
654 dnl for the spec file
655 RELDATE=`date +'%a %b %e %Y'`
656 AC_SUBST(RELDATE)
657
658 rm -f COPYING.LIB COPYING 2>/dev/null && $LN_S $srcdir/Copyright COPYING
659
660
661 AC_CONFIG_FILES([
662 Makefile
663 libxslt.pc
664 libexslt.pc
665 libxslt/Makefile
666 libxslt/xsltconfig.h
667 libxslt/xsltwin32config.h
668 libexslt/Makefile
669 libexslt/exsltconfig.h
670 xsltproc/Makefile
671 python/Makefile
672 python/tests/Makefile
673 tests/Makefile
674 tests/docs/Makefile
675 tests/REC1/Makefile
676 tests/REC2/Makefile
677 tests/REC/Makefile
678 tests/general/Makefile
679 tests/reports/Makefile
680 tests/extensions/Makefile
681 tests/namespaces/Makefile
682 tests/keys/Makefile
683 tests/numbers/Makefile
684 tests/documents/Makefile
685 tests/xmlspec/Makefile
686 tests/multiple/Makefile
687 tests/xinclude/Makefile
688 tests/XSLTMark/Makefile
689 tests/docbook/Makefile
690 tests/exslt/Makefile
691 tests/exslt/common/Makefile
692 tests/exslt/functions/Makefile
693 tests/exslt/math/Makefile
694 tests/exslt/saxon/Makefile
695 tests/exslt/sets/Makefile
696 tests/exslt/strings/Makefile
697 tests/exslt/date/Makefile
698 tests/exslt/dynamic/Makefile
699 tests/exslt/crypto/Makefile
700 tests/plugins/Makefile
701 tests/fuzz/Makefile
702 doc/Makefile
703 xslt-config
704 libxslt.spec
705 ])
706 AC_CONFIG_LINKS([tests/fuzz/xpath.xml:tests/fuzz/xpath.xml])
707 AC_CONFIG_LINKS([tests/fuzz/xslt.xml:tests/fuzz/xslt.xml])
708
709 AC_OUTPUT