1 dnl Process this file with autoconf to produce a configuration script.
3 AC_INIT(libxslt/xslt.c)
4 AM_CONFIG_HEADER(config.h)
9 dnl libxslt is the main part of the package
10 dnl libexslt is an extension
12 LIBXSLT_MAJOR_VERSION=1
13 LIBXSLT_MINOR_VERSION=1
14 LIBXSLT_MICRO_VERSION=25
16 LIBEXSLT_MAJOR_VERSION=0
17 LIBEXSLT_MINOR_VERSION=8
18 LIBEXSLT_MICRO_VERSION=14
19 LIBXML_REQUIRED_VERSION=2.6.27
22 LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
23 LIBXSLT_VERSION_INFO=`expr $LIBXSLT_MAJOR_VERSION + $LIBXSLT_MINOR_VERSION`:$LIBXSLT_MICRO_VERSION:$LIBXSLT_MINOR_VERSION
25 LIBXSLT_VERSION_NUMBER=`expr $LIBXSLT_MAJOR_VERSION \* 10000 + $LIBXSLT_MINOR_VERSION \* 100 + $LIBXSLT_MICRO_VERSION`
26 LIBXSLT_MAJOR_MINOR_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION
28 if test -f CVS/Entries; then
29 extra=`grep ChangeLog CVS/Entries | grep -v LIBXSLT | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
31 if test "$extra" != ""
33 LIBXSLT_VERSION_EXTRA="-CVS$extra"
35 else if test -d .svn ; then
36 extra=`svn info | grep Revision | sed 's+Revision: ++'`
38 if test "$extra" != ""
40 LIBXSLT_VERSION_EXTRA="-SVN$extra"
42 else if test -d .git ; then
43 extra=`git describe | sed 's+LIBXSLT[[0-9.]]*-++'`
45 if test "$extra" != ""
47 LIBXSLT_VERSION_EXTRA="-GIT$extra"
53 AC_SUBST(LIBXSLT_MAJOR_VERSION)
54 AC_SUBST(LIBXSLT_MINOR_VERSION)
55 AC_SUBST(LIBXSLT_MICRO_VERSION)
56 AC_SUBST(LIBXSLT_VERSION)
57 AC_SUBST(LIBXSLT_VERSION_INFO)
58 AC_SUBST(LIBXSLT_VERSION_NUMBER)
59 AC_SUBST(LIBXSLT_VERSION_EXTRA)
60 AC_SUBST(LIBXSLT_MAJOR_MINOR_VERSION)
63 dnl libexslt is an extension library
66 LIBEXSLT_VERSION=$LIBEXSLT_MAJOR_VERSION.$LIBEXSLT_MINOR_VERSION.$LIBEXSLT_MICRO_VERSION
67 LIBEXSLT_VERSION_INFO=`expr $LIBEXSLT_MAJOR_VERSION + $LIBEXSLT_MINOR_VERSION`:$LIBEXSLT_MICRO_VERSION:$LIBEXSLT_MINOR_VERSION
69 LIBEXSLT_VERSION_NUMBER=`expr $LIBEXSLT_MAJOR_VERSION \* 10000 + $LIBEXSLT_MINOR_VERSION \* 100 + $LIBEXSLT_MICRO_VERSION`
71 if test -f CVS/Entries; then
72 LIBEXSLT_VERSION_EXTRA=-CVS`grep ChangeLog CVS/Entries | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
75 AC_SUBST(LIBEXSLT_MAJOR_VERSION)
76 AC_SUBST(LIBEXSLT_MINOR_VERSION)
77 AC_SUBST(LIBEXSLT_MICRO_VERSION)
78 AC_SUBST(LIBEXSLT_VERSION)
79 AC_SUBST(LIBEXSLT_VERSION_INFO)
80 AC_SUBST(LIBEXSLT_VERSION_NUMBER)
81 AC_SUBST(LIBEXSLT_VERSION_EXTRA)
83 VERSION=${LIBXSLT_VERSION}
85 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
90 dnl Specific dir for HTML output ?
93 AC_ARG_WITH(html-dir, AC_HELP_STRING([--with-html-dir=path],
94 [path to base html directory, default $datadir/doc/html]),
95 [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
97 AC_ARG_WITH(html-subdir, AC_HELP_STRING([--with-html-subdir=path],
98 [directory used under html-dir, default $PACKAGE-$VERSION/html]),
99 [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
100 [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
105 dnl Check the environment
112 AC_PATH_PROG(RM, rm, /bin/rm)
113 AC_PATH_PROG(MV, mv, /bin/mv)
114 AC_PATH_PROG(TAR, tar, /bin/tar)
115 AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
116 AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
124 AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
127 dnl if the system support linker version scripts for symbol versioning
130 VERSION_SCRIPT_FLAGS=
131 $(/usr/bin/ld --help 2>&1 | grep -- --version-script >/dev/null) && \
132 VERSION_SCRIPT_FLAGS=-Wl,--version-script=
133 test "`uname`" == "SunOS" && \
134 VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
135 AC_SUBST(VERSION_SCRIPT_FLAGS)
136 AM_CONDITIONAL([USE_VERSION_SCRIPT], [test -n "$VERSION_SCRIPT_FLAGS"])
138 dnl Look for pthread.h, needed for testThreads
140 AC_CHECK_HEADER(pthread.h,
141 AC_CHECK_LIB(pthread, pthread_join,[
142 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
143 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
144 THREAD_LIBS="-lpthread"]))
146 AC_SUBST(THREAD_LIBS)
149 dnl Detect supported locale
152 XSLT_LOCALE_XLOCALE=0
155 AC_CHECK_HEADERS([locale.h xlocale.h])
156 if test $ac_cv_header_xlocale_h = yes; then
158 dnl Check for generic locale_t declaration
160 AC_MSG_CHECKING([if xlocale program link])
161 AC_LINK_IFELSE(AC_LANG_PROGRAM([[
165 #ifdef HAVE_XLOCALE_H
176 typedef __locale_t xsltLocale;
178 typedef locale_t xsltLocale;
180 #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 2
181 #define newlocale __newlocale
182 #define freelocale __freelocale
183 #define strxfrm_l __strxfrm_l
184 #define LC_COLLATE_MASK (1 << LC_COLLATE)
188 const char *src[[2]] = { "\xc3\x84rger", "Zeppelin" };
193 locale = newlocale(LC_COLLATE_MASK, "en_US.utf8", NULL);
194 if (locale == NULL) exit(1);
195 for (i=0; i<2; ++i) {
196 len = strxfrm_l(NULL, src[[i]], 0, locale) + 1;
197 dst[[i]] = malloc(len);
198 if(dst[[i]] == NULL) exit(1);
199 r = strxfrm_l(dst[[i]], src[[i]], len, locale);
200 if(r >= len) exit(1);
202 if (strcmp(dst[[0]], dst[[1]]) >= 0) exit(1);
207 [AC_MSG_RESULT(yes); XSLT_LOCALE_XLOCALE=1],
213 AC_MSG_NOTICE([using winapi locale])
214 XSLT_LOCALE_WINAPI=1;;
218 AC_SUBST(XSLT_LOCALE_XLOCALE)
219 AC_SUBST(XSLT_LOCALE_WINAPI)
225 AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h ansidecl.h)
226 AC_CHECK_HEADERS(sys/timeb.h time.h sys/stat.h sys/select.h stdarg.h)
227 AC_CHECK_FUNCS(stat _stat)
228 AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
229 [M_LIBS="-lm"; AC_DEFINE(HAVE_ISNAN)]))
231 AC_CHECK_FUNC(isinf, , AC_CHECK_LIB(m, isinf,
232 [M_LIBS="-lm"; AC_DEFINE(HAVE_ISINF)]))
234 AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow,
235 [M_LIBS="-lm"; AC_DEFINE(HAVE_POW)]))
237 AC_CHECK_FUNC(floor, , AC_CHECK_LIB(m, floor,
238 [M_LIBS="-lm"; AC_DEFINE(HAVE_FLOOR)]))
240 AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
241 [M_LIBS="-lm"; AC_DEFINE(HAVE_FABS)]))
242 AC_CHECK_FUNCS(gettimeofday)
243 AC_CHECK_FUNCS(mktime localtime localtime_r asctime time gmtime_r ftime)
245 dnl Checking the standard string functions availability
246 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
250 dnl Check for trio string functions
253 if test "${NEED_TRIO}" = "1" ; then
254 echo Reusing trio library for string functions
262 dnl Some packages need to be checked against version numbers so we
263 dnl define a function here for later use
265 AC_DEFUN([VERSION_TO_NUMBER],
266 [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
269 dnl Perl is just needed for generating some data for XSLtmark
272 AC_CHECK_PROG(PERL, perl, perl, false)
273 AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
281 PYTHON_SITE_PACKAGES=
283 AC_ARG_WITH(python, [ --with-python[=DIR] Build Python bindings if found])
284 if test "$with_python" != "no" ; then
285 if test -x "$with_python/bin/python"
287 echo Found python in $with_python/bin/python
288 PYTHON="$with_python/bin/python"
290 if test -x "$with_python"
292 echo Found python in $with_python
293 PYTHON="$with_python"
297 echo Found python in environment PYTHON=$PYTHON
298 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
300 AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
304 if test "$PYTHON" != ""
306 echo "PYTHON is pointing at $PYTHON"
307 PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
308 echo Found Python version $PYTHON_VERSION
309 LIBXML2_PYTHON=`$PYTHON -c "try : import libxml2 ; print 1
311 if test "$LIBXML2_PYTHON" = "1"
313 echo Found libxml2-python module
315 echo Warning: Missing libxml2-python
318 if test "$PYTHON_VERSION" != ""
320 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
321 -d $with_python/lib/python$PYTHON_VERSION/site-packages
323 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
324 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
326 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
328 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
329 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
331 if test -r /usr/include/python$PYTHON_VERSION/Python.h
333 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
334 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
336 echo could not find python$PYTHON_VERSION/Python.h
339 if test ! -d "$PYTHON_SITE_PACKAGES"
341 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
345 if test "$with_python" != ""
347 pythondir='$(PYTHON_SITE_PACKAGES)'
349 pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
352 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
353 if test "$PYTHON_INCLUDES" != ""
360 AC_SUBST(PYTHON_SUBDIR)
362 AC_ARG_WITH(crypto, [ --with-crypto Add crypto support to exslt (on)])
364 if test "$with_crypto" = "no" ; then
365 echo Disabling crypto support
369 AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
370 if test "$LIBGCRYPT_CONFIG" != "no" ; then
371 LIBGCRYPT_VERSION=`$LIBGCRYPT_CONFIG --version`
372 if test VERSION_TO_NUMBER(echo $LIBGCRYPT_VERSION) -lt VERSION_TO_NUMBER(echo "1.1.42")
376 echo 'gcrypt library version < 1.1.42 - Crypto extensions will not be available.'
378 LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --cflags`
379 LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --libs`
380 AC_DEFINE(HAVE_GCRYPT, 1, [Define if gcrypt library is available.])
381 echo 'Crypto extensions will be available.'
387 echo 'Crypto extensions will not be available. Install libgcrypt and reconfigure to make available.'
390 AC_SUBST(WITH_CRYPTO)
391 AC_SUBST(LIBGCRYPT_CFLAGS)
392 AC_SUBST(LIBGCRYPT_LIBS)
395 dnl Debug for DV (-Wunreachable-code)
397 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
398 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxslt" ]]
400 if test "${with_mem_debug}" = "" ;
404 CFLAGS="-Wall -g -O -ansi -pedantic -W -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 "
405 if test "`uname -m`" != "x86_64" ;
407 STATIC_BINARIES="-static"
409 STATIC_BINARIES="-static"
411 if test "$LOGNAME" = "veillard"
413 LIBXML_SRC="/u/veillard/XML"
414 EXTRA_LIBS="$EXTRA_LIBS -ldl"
419 AC_SUBST(STATIC_BINARIES)
421 AC_ARG_WITH(debug, [ --with-debug Add the debugging code (on)])
422 if test "$with_debug" = "no" ; then
423 echo Disabling debug support
428 AC_SUBST(WITH_XSLT_DEBUG)
430 AC_ARG_WITH(mem_debug, [ --with-mem-debug Add the memory debugging module (off)])
431 if test "$with_mem_debug" = "yes" ; then
432 echo Enabling memory debug support
437 AC_SUBST(WITH_MEM_DEBUG)
440 dnl Is debugger support requested
442 AC_ARG_WITH(debugger, [ --with-debugger Add the debugging support (on)])
443 if test "$with_debugger" = "no" ; then
444 echo Disabling debugger
447 echo Enabling debugger
449 AC_DEFINE(WITH_DEBUGGER)
451 AC_SUBST(WITH_DEBUGGER)
454 dnl The following new parameters were added to offer
455 dnl the ability to specify the location of the libxml
456 dnl library during linking and compilation.
458 dnl original work - Mathieu Lacage 30/03/2000
459 dnl some tweaking - David Härdeman 30/10/2001
462 LIBXML_CONFIG_PREFIX=""
465 AC_ARG_WITH(libxml-prefix,
466 [ --with-libxml-prefix=[PFX] Specify location of libxml config],
467 LIBXML_CONFIG_PREFIX=$withval
470 AC_ARG_WITH(libxml-include-prefix,
471 [ --with-libxml-include-prefix=[PFX] Specify location of libxml headers],
472 LIBXML_CFLAGS="-I$withval"
475 AC_ARG_WITH(libxml-libs-prefix,
476 [ --with-libxml-libs-prefix=[PFX] Specify location of libxml libs],
477 LIBXML_LIBS="-L$withval"
480 AC_ARG_WITH(libxml-src,
481 [ --with-libxml-src=[DIR] For libxml thats not installed yet (sets all three above)],
482 LIBXML_SRC="$withval"
487 dnl where is xml2-config
490 AC_SUBST(LIBXML_REQUIRED_VERSION)
491 AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION)
492 if test "x$LIBXML_CONFIG_PREFIX" != "x"
494 XML_CONFIG=${LIBXML_CONFIG_PREFIX}/bin/xml2-config
496 XML_CONFIG=xml2-config
500 dnl imported from libxml2, c.f. #77827
502 if test "${GCC}" != "yes" ; then
505 CFLAGS="${CFLAGS} -Wp,-H30000"
508 CFLAGS="${CFLAGS} -ieee"
512 CFLAGS="${CFLAGS} -Wall"
515 CFLAGS="${CFLAGS} -mieee"
518 CFLAGS="${CFLAGS} -mieee"
524 dnl Override other variables if LIBXML_SRC is set
527 if test "x$LIBXML_SRC" != "x"
533 XML_CONFIG=${SRC_DIR}/xml2-config
534 LIBXML_CFLAGS="-I${SRC_DIR}/include"
535 LIBXML_LIBS="-L${SRC_DIR}"
538 AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
543 dnl make sure xml2-config is executable,
544 dnl test version and init our variables
547 if ${XML_CONFIG} --libs print > /dev/null 2>&1
549 XMLVERS=`$XML_CONFIG --version`
550 if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION)
552 LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`"
553 LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`"
554 AC_MSG_RESULT($XMLVERS found)
556 AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
559 AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
568 [ --with-plugins Add plugin extension support (on)])
569 if test "$with_plugins" = ""
574 AC_MSG_CHECKING([whether shared libraries will be built (required for plugins)])
575 if test "$enable_shared" = "no" -a "$with_plugins" = "yes"; then
577 AC_MSG_WARN([Disabling plugin support.])
578 AC_MSG_WARN([Plugins require that shared libraries be built.])
584 if test "$with_plugins" = "yes" ; then
585 AC_MSG_CHECKING([libxml2 module support])
586 WITH_MODULES="`$XML_CONFIG --modules`"
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
603 module_prefix=$prefix
604 test "x$module_prefix" = xNONE && module_prefix=$ac_default_prefix
605 LIBXSLT_DEFAULT_PLUGINS_PATH="$module_prefix/lib/libxslt-plugins"
606 AC_SUBST(LIBXSLT_DEFAULT_PLUGINS_PATH)
609 dnl In build tree I use a static version with memory debug enabled
611 if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ; then
612 dnl if test "`uname -i`" != "x86_64" -a -e $HOME/XML/.libs/libxml2.a ;
613 if test -e $HOME/XML/.libs/libxml2.a ;
615 LIBXML_LIBS="$HOME/XML/.libs/libxml2.a -lpthread -lz"
618 XSLTPROCDV="xsltproc.dv"
619 INSTALLED_XSLT_LIB=""
620 LIBXML_SRC="$HOME/XML/"
627 WIN32_EXTRA_LDFLAGS="-no-undefined"
630 WIN32_EXTRA_LIBADD="-lwsock32"
631 WIN32_EXTRA_LDFLAGS="-no-undefined"
632 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
633 AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
634 AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
637 AC_SUBST(WIN32_EXTRA_LIBADD)
638 AC_SUBST(WIN32_EXTRA_LDFLAGS)
644 AC_SUBST(LIBXML_LIBS)
645 AC_SUBST(LIBXML_CFLAGS)
647 AC_SUBST(PYTHON_VERSION)
648 AC_SUBST(PYTHON_INCLUDES)
649 AC_SUBST(PYTHON_SITE_PACKAGES)
651 XSLT_LIBDIR='-L${libdir}'
652 XSLT_INCLUDEDIR='-I${includedir}'
653 XSLT_LIBS="-lxslt $LIBXML_LIBS $M_LIBS"
654 AC_SUBST(XSLT_LIBDIR)
655 AC_SUBST(XSLT_INCLUDEDIR)
658 EXSLT_LIBDIR='-L${libdir}'
659 EXSLT_INCLUDEDIR='-I${includedir}'
660 EXSLT_LIBS="-lexslt $XSLT_LIBS $LIBGCRYPT_LIBS"
661 AC_SUBST(EXSLT_LIBDIR)
662 AC_SUBST(EXSLT_INCLUDEDIR)
665 EXTRA_LIBS="$EXTRA_LIBS $LIBXML_LIBS $M_LIBS"
670 dnl for the spec file
671 RELDATE=`date +'%a %b %e %Y'`
675 rm -f COPYING.LIB COPYING
676 $LN_S Copyright COPYING
686 libxslt/xsltwin32config.h
688 libexslt/exsltconfig.h
691 python/tests/Makefile
697 tests/general/Makefile
698 tests/reports/Makefile
699 tests/extensions/Makefile
700 tests/namespaces/Makefile
702 tests/numbers/Makefile
703 tests/documents/Makefile
704 tests/xmlspec/Makefile
705 tests/multiple/Makefile
706 tests/xinclude/Makefile
707 tests/XSLTMark/Makefile
708 tests/docbook/Makefile
710 tests/exslt/common/Makefile
711 tests/exslt/functions/Makefile
712 tests/exslt/math/Makefile
713 tests/exslt/sets/Makefile
714 tests/exslt/strings/Makefile
715 tests/exslt/date/Makefile
716 tests/exslt/dynamic/Makefile
717 tests/plugins/Makefile