1 dnl Process this file with autoconf to produce a configuration script.
4 m4_define([MAJOR_VERSION], [1])
5 m4_define([MINOR_VERSION], [1])
6 m4_define([MICRO_VERSION], [34])
8 AC_INIT([libxslt], [MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION])
9 AC_CONFIG_SRCDIR([libxslt/xslt.c])
10 AC_CONFIG_HEADERS(config.h)
12 AC_USE_SYSTEM_EXTENSIONS
15 dnl libxslt is the main part of the package
16 dnl libexslt is an extension
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
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
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
33 if test -f CVS/Entries; then
34 extra=`grep ChangeLog CVS/Entries | grep -v LIBXSLT | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
36 if test "$extra" != ""
38 LIBXSLT_VERSION_EXTRA="-CVS$extra"
40 else if test -d .svn ; then
41 extra=`svn info | grep Revision | sed 's+Revision: ++'`
43 if test "$extra" != ""
45 LIBXSLT_VERSION_EXTRA="-SVN$extra"
47 else if test -d .git ; then
48 extra=`git describe | sed 's+LIBXSLT[[0-9.]]*-++'`
50 if test "$extra" != ""
52 LIBXSLT_VERSION_EXTRA="-GIT$extra"
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)
68 dnl libexslt is an extension library
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
74 LIBEXSLT_VERSION_NUMBER=`expr $LIBEXSLT_MAJOR_VERSION \* 10000 + $LIBEXSLT_MINOR_VERSION \* 100 + $LIBEXSLT_MICRO_VERSION`
76 if test -f CVS/Entries; then
77 LIBEXSLT_VERSION_EXTRA=-CVS`grep ChangeLog CVS/Entries | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
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)
88 AM_INIT_AUTOMAKE([foreign])
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
95 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
98 dnl Specific dir for HTML output ?
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'])
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"])
113 dnl Check the environment
119 AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
120 AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
128 AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
131 dnl if the system support linker version scripts for symbol versioning
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,"
141 AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
142 AC_SUBST(VERSION_SCRIPT_FLAGS)
143 AM_CONDITIONAL([USE_VERSION_SCRIPT], [test "$VERSION_SCRIPT_FLAGS" != none])
145 dnl Look for pthread.h, needed for testThreads
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"]))
158 AC_SUBST(THREAD_LIBS)
161 dnl Detect supported locale
164 AC_CHECK_HEADERS([locale.h xlocale.h])
165 AC_CHECK_FUNCS([strxfrm_l])
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])]))
178 AC_CHECK_FUNC(floor, , AC_CHECK_LIB(m, floor,
179 [M_LIBS="-lm"; AC_DEFINE([HAVE_FLOOR],[], [Define if floor is there])]))
181 AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
182 [M_LIBS="-lm"; AC_DEFINE([HAVE_FABS],[], [Define if fabs is there])]))
185 AC_CHECK_FUNCS(gettimeofday)
186 AC_CHECK_FUNCS(localtime localtime_r time gmtime gmtime_r ftime)
188 dnl Checking the standard string functions availability
189 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
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"
201 dnl Check for trio string functions
204 if test "${NEED_TRIO}" = "1" ; then
205 echo Reusing trio library for string functions
213 dnl Some packages need to be checked against version numbers so we
214 dnl define a function here for later use
216 AC_DEFUN([VERSION_TO_NUMBER],
217 [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
220 dnl Perl is just needed for generating some data for XSLtmark
223 AC_CHECK_PROG(PERL, perl, perl, false)
224 AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
232 PYTHON_SITE_PACKAGES=
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"
238 echo Found python in $with_python/bin/python
239 PYTHON="$with_python/bin/python"
241 if test -x "$with_python"
243 echo Found python in $with_python
244 PYTHON="$with_python"
248 echo Found python in environment PYTHON=$PYTHON
249 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
251 AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
255 if test "$PYTHON" != ""
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
262 if test "$LIBXML2_PYTHON" = "1"
264 echo Found libxml2-python module
266 echo Warning: Missing libxml2-python
269 if test "$PYTHON_VERSION" != ""
271 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
272 -d $with_python/lib/python$PYTHON_VERSION/site-packages
274 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
275 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
277 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
279 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
280 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
282 if test -r /usr/include/python$PYTHON_VERSION/Python.h
284 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
285 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
287 echo could not find python$PYTHON_VERSION/Python.h
290 if test ! -d "$PYTHON_SITE_PACKAGES"
292 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
295 PYTHON_LIBS=`python$PYTHON_VERSION-config --libs`
297 if test "$with_python" != ""
299 pythondir='$(PYTHON_SITE_PACKAGES)'
301 pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
304 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
305 if test "$PYTHON_INCLUDES" != ""
312 AC_SUBST(PYTHON_SUBDIR)
313 AC_SUBST(PYTHON_LIBS)
315 AC_ARG_WITH(crypto, [ --with-crypto Add crypto support to exslt (on)])
318 if test "$with_crypto" = "no" ; then
319 echo Disabling crypto support
325 dnl Use only native crypto-API for mingw* hosts
326 dnl TODO: to implement --with-crypto=foo to allow switch between
329 CRYPTO_TESTDIR=crypto
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")
339 echo 'gcrypt library version < 1.1.42 - Crypto extensions will not be available.'
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.'
346 CRYPTO_TESTDIR=crypto
351 echo 'Crypto extensions will not be available. Install libgcrypt and reconfigure to make available.'
355 AC_SUBST(WITH_CRYPTO)
356 AC_SUBST(CRYPTO_TESTDIR)
357 AC_SUBST(LIBGCRYPT_CFLAGS)
358 AC_SUBST(LIBGCRYPT_LIBS)
361 dnl Debug for DV (-Wunreachable-code)
363 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
364 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxslt" ]]
366 if test "${with_mem_debug}" = "" ;
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 "
373 AC_ARG_WITH(debug, [ --with-debug Add the debugging code (on)])
374 if test "$with_debug" = "no" ; then
375 echo Disabling debug support
380 AC_SUBST(WITH_XSLT_DEBUG)
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
389 AC_SUBST(WITH_MEM_DEBUG)
392 dnl Is debugger support requested
394 AC_ARG_WITH(debugger, [ --with-debugger Add the debugging support (on)])
395 if test "$with_debugger" = "no" ; then
396 echo Disabling debugger
399 echo Enabling debugger
401 AC_DEFINE([WITH_DEBUGGER],[], [Define if debugging support is enabled])
403 AC_SUBST(WITH_DEBUGGER)
406 dnl Is profiler support requested
408 AC_ARG_WITH(profiler, [ --with-profiler Add the profiling support (on)])
409 if test "$with_profiler" = "no" ; then
410 echo Disabling profiler
413 echo Enabling profiler
415 AC_DEFINE([WITH_PROFILER],[], [Define if profiling support is enabled])
417 AC_SUBST(WITH_PROFILER)
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.
424 dnl original work - Mathieu Lacage 30/03/2000
425 dnl some tweaking - David Härdeman 30/10/2001
428 LIBXML_CONFIG_PREFIX=""
431 AC_ARG_WITH(libxml-prefix,
432 [ --with-libxml-prefix=[PFX] Specify location of libxml config],
433 LIBXML_CONFIG_PREFIX=$withval
436 AC_ARG_WITH(libxml-include-prefix,
437 [ --with-libxml-include-prefix=[PFX] Specify location of libxml headers],
438 LIBXML_CFLAGS="-I$withval"
441 AC_ARG_WITH(libxml-libs-prefix,
442 [ --with-libxml-libs-prefix=[PFX] Specify location of libxml libs],
443 LIBXML_LIBS="-L$withval"
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"
453 dnl where is xml2-config
456 AC_SUBST(LIBXML_REQUIRED_VERSION)
457 if test "x$LIBXML_CONFIG_PREFIX" != "x"
459 AC_PATH_TOOL([XML_CONFIG], [xml2-config], [false], [${LIBXML_CONFIG_PREFIX}/bin])
461 AC_PATH_TOOL([XML_CONFIG], [xml2-config], [false])
465 dnl imported from libxml2, c.f. #77827
467 if test "${GCC}" != "yes" ; then
470 CFLAGS="${CFLAGS} -Wp,-H30000"
473 CFLAGS="${CFLAGS} -ieee"
477 CFLAGS="${CFLAGS} -Wall -Wextra -Wformat=2 -Wmissing-format-attribute"
480 CFLAGS="${CFLAGS} -mieee"
483 CFLAGS="${CFLAGS} -mieee"
489 dnl Check which type of library to build. Default to building shared and static.
492 build_shared_libs="yes"
493 build_static_libs="yes"
495 if test "$enable_shared" = "no"; then
496 build_shared_libs="no"
499 if test "$enable_static" = "no"; then
500 build_static_libs="no"
503 if test "$build_shared_libs" = "no" -a "$build_static_libs" = "no"; then
504 build_static_libs="yes"
508 dnl Override other variables if LIBXML_SRC is set
511 if test "x$LIBXML_SRC" != "x"
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`"
523 AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
528 dnl Try pkg-config first if nothing is set
531 if test "x$LIBXML_CONFIG_PREFIX" = "x" -a "x$LIBXML_LIBS" = "x"
533 PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= $LIBXML_REQUIRED_VERSION], [
534 WITH_MODULES="`$PKG_CONFIG --variable=modules libxml-2.0`"
539 dnl make sure xml2-config is executable,
540 dnl test version and init our variables
543 if test "x$LIBXML_LIBS" = "x" && ${XML_CONFIG} --libs print > /dev/null 2>&1
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)
549 AC_MSG_RESULT($XMLVERS found)
551 AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
553 LIBXML_LIBS="`$XML_CONFIG --libs`"
554 LIBXML_CFLAGS="`$XML_CONFIG --cflags`"
555 WITH_MODULES="`$XML_CONFIG --modules`"
558 if test "x$LIBXML_LIBS" = "x"
560 AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
569 [ --with-plugins Add plugin extension support (on)])
570 if test "$with_plugins" = ""
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
578 AC_MSG_WARN([Disabling plugin support.])
579 AC_MSG_WARN([Plugins require that shared libraries be built.])
585 if test "$with_plugins" = "yes" ; then
586 AC_MSG_CHECKING([libxml2 module support])
587 if test "${WITH_MODULES}" = "1"; then
597 AC_SUBST(WITH_MODULES)
598 AM_CONDITIONAL(WITH_MODULES, test "$WITH_MODULES" = "1")
601 dnl setup default module path
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
608 eval libdir="$libdir"
612 LIBXSLT_DEFAULT_PLUGINS_PATH="$expanded_libdir/libxslt-plugins"
613 AC_SUBST(LIBXSLT_DEFAULT_PLUGINS_PATH)
616 *-*-cygwin*|*-*-mingw*)
617 LDFLAGS="$LDFLAGS -no-undefined"
625 AC_SUBST(LIBXML_LIBS)
626 AC_SUBST(LIBXML_CFLAGS)
628 AC_SUBST(PYTHON_VERSION)
629 AC_SUBST(PYTHON_INCLUDES)
630 AC_SUBST(PYTHON_SITE_PACKAGES)
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)
639 AC_SUBST(XSLT_PRIVATE_LIBS)
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)
648 AC_SUBST(EXSLT_PRIVATE_LIBS)
654 dnl for the spec file
655 RELDATE=`date +'%a %b %e %Y'`
658 rm -f COPYING.LIB COPYING 2>/dev/null && $LN_S $srcdir/Copyright COPYING
667 libxslt/xsltwin32config.h
669 libexslt/exsltconfig.h
672 python/tests/Makefile
678 tests/general/Makefile
679 tests/reports/Makefile
680 tests/extensions/Makefile
681 tests/namespaces/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
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
706 AC_CONFIG_LINKS([tests/fuzz/xpath.xml:tests/fuzz/xpath.xml])
707 AC_CONFIG_LINKS([tests/fuzz/xslt.xml:tests/fuzz/xslt.xml])