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=24
16 LIBEXSLT_MAJOR_VERSION=0
17 LIBEXSLT_MINOR_VERSION=8
18 LIBEXSLT_MICRO_VERSION=13
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)
122 AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
124 dnl Look for pthread.h, needed for testThreads
126 AC_CHECK_HEADER(pthread.h,
127 AC_CHECK_LIB(pthread, pthread_join,[
128 AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
129 AC_DEFINE([HAVE_PTHREAD_H], [], [Define if <pthread.h> is there])
130 THREAD_LIBS="-lpthread"]))
132 AC_SUBST(THREAD_LIBS)
135 dnl Detect supported locale
138 XSLT_LOCALE_XLOCALE=0
141 AC_CHECK_HEADERS([locale.h xlocale.h])
142 if test $ac_cv_header_xlocale_h = yes; then
144 dnl Check for generic locale_t declaration
146 AC_MSG_CHECKING([if xlocale program link])
147 AC_LINK_IFELSE(AC_LANG_PROGRAM([[
151 #ifdef HAVE_XLOCALE_H
162 typedef __locale_t xsltLocale;
164 typedef locale_t xsltLocale;
166 #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 2
167 #define newlocale __newlocale
168 #define freelocale __freelocale
169 #define strxfrm_l __strxfrm_l
170 #define LC_COLLATE_MASK (1 << LC_COLLATE)
174 const char *src[[2]] = { "\xc3\x84rger", "Zeppelin" };
179 locale = newlocale(LC_COLLATE_MASK, "en_US.utf8", NULL);
180 if (locale == NULL) exit(1);
181 for (i=0; i<2; ++i) {
182 len = strxfrm_l(NULL, src[[i]], 0, locale) + 1;
183 dst[[i]] = malloc(len);
184 if(dst[[i]] == NULL) exit(1);
185 r = strxfrm_l(dst[[i]], src[[i]], len, locale);
186 if(r >= len) exit(1);
188 if (strcmp(dst[[0]], dst[[1]]) >= 0) exit(1);
193 [AC_MSG_RESULT(yes); XSLT_LOCALE_XLOCALE=1],
199 AC_MSG_NOTICE([using winapi locale])
200 XSLT_LOCALE_WINAPI=1;;
204 AC_SUBST(XSLT_LOCALE_XLOCALE)
205 AC_SUBST(XSLT_LOCALE_WINAPI)
211 AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h ansidecl.h)
212 AC_CHECK_HEADERS(sys/timeb.h time.h sys/stat.h sys/select.h stdarg.h)
213 AC_CHECK_FUNCS(stat _stat)
214 AC_CHECK_FUNC(isnan, , AC_CHECK_LIB(m, isnan,
215 [M_LIBS="-lm"; AC_DEFINE(HAVE_ISNAN)]))
217 AC_CHECK_FUNC(isinf, , AC_CHECK_LIB(m, isinf,
218 [M_LIBS="-lm"; AC_DEFINE(HAVE_ISINF)]))
220 AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow,
221 [M_LIBS="-lm"; AC_DEFINE(HAVE_POW)]))
223 AC_CHECK_FUNC(floor, , AC_CHECK_LIB(m, floor,
224 [M_LIBS="-lm"; AC_DEFINE(HAVE_FLOOR)]))
226 AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
227 [M_LIBS="-lm"; AC_DEFINE(HAVE_FABS)]))
228 AC_CHECK_FUNCS(gettimeofday)
229 AC_CHECK_FUNCS(mktime localtime localtime_r asctime time gmtime_r ftime)
231 dnl Checking the standard string functions availability
232 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
236 dnl Check for trio string functions
239 if test "${NEED_TRIO}" = "1" ; then
240 echo Reusing trio library for string functions
248 dnl Some packages need to be checked against version numbers so we
249 dnl define a function here for later use
251 AC_DEFUN([VERSION_TO_NUMBER],
252 [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
255 dnl Perl is just needed for generating some data for XSLtmark
258 AC_CHECK_PROG(PERL, perl, perl, false)
259 AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
267 PYTHON_SITE_PACKAGES=
269 AC_ARG_WITH(python, [ --with-python[=DIR] Build Python bindings if found])
270 if test "$with_python" != "no" ; then
271 if test -x "$with_python/bin/python"
273 echo Found python in $with_python/bin/python
274 PYTHON="$with_python/bin/python"
276 if test -x "$with_python"
278 echo Found python in $with_python
279 PYTHON="$with_python"
283 echo Found python in environment PYTHON=$PYTHON
284 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
286 AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
290 if test "$PYTHON" != ""
292 echo "PYTHON is pointing at $PYTHON"
293 PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
294 echo Found Python version $PYTHON_VERSION
295 LIBXML2_PYTHON=`$PYTHON -c "try : import libxml2 ; print 1
297 if test "$LIBXML2_PYTHON" = "1"
299 echo Found libxml2-python module
301 echo Warning: Missing libxml2-python
304 if test "$PYTHON_VERSION" != ""
306 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
307 -d $with_python/lib/python$PYTHON_VERSION/site-packages
309 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
310 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
312 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
314 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
315 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
317 if test -r /usr/include/python$PYTHON_VERSION/Python.h
319 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
320 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
322 echo could not find python$PYTHON_VERSION/Python.h
325 if test ! -d "$PYTHON_SITE_PACKAGES"
327 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
331 if test "$with_python" != ""
333 pythondir='$(PYTHON_SITE_PACKAGES)'
335 pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
338 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
339 if test "$PYTHON_INCLUDES" != ""
346 AC_SUBST(PYTHON_SUBDIR)
348 AC_ARG_WITH(crypto, [ --with-crypto Add crypto support to exslt (on)])
350 if test "$with_crypto" = "no" ; then
351 echo Disabling crypto support
355 AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
356 if test "$LIBGCRYPT_CONFIG" != "no" ; then
357 LIBGCRYPT_VERSION=`$LIBGCRYPT_CONFIG --version`
358 if test VERSION_TO_NUMBER(echo $LIBGCRYPT_VERSION) -lt VERSION_TO_NUMBER(echo "1.1.42")
362 echo 'gcrypt library version < 1.1.42 - Crypto extensions will not be available.'
364 LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --cflags`
365 LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --libs`
366 AC_DEFINE(HAVE_GCRYPT, 1, [Define if gcrypt library is available.])
367 echo 'Crypto extensions will be available.'
373 echo 'Crypto extensions will not be available. Install libgcrypt and reconfigure to make available.'
376 AC_SUBST(WITH_CRYPTO)
377 AC_SUBST(LIBGCRYPT_CFLAGS)
378 AC_SUBST(LIBGCRYPT_LIBS)
381 dnl Debug for DV (-Wunreachable-code)
383 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
384 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxslt" ]]
386 if test "${with_mem_debug}" = "" ;
390 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 "
391 if test "`uname -m`" != "x86_64" ;
393 STATIC_BINARIES="-static"
395 STATIC_BINARIES="-static"
397 if test "$LOGNAME" = "veillard"
399 LIBXML_SRC="/u/veillard/XML"
400 EXTRA_LIBS="$EXTRA_LIBS -ldl"
405 AC_SUBST(STATIC_BINARIES)
407 AC_ARG_WITH(debug, [ --with-debug Add the debugging code (on)])
408 if test "$with_debug" = "no" ; then
409 echo Disabling debug support
414 AC_SUBST(WITH_XSLT_DEBUG)
416 AC_ARG_WITH(mem_debug, [ --with-mem-debug Add the memory debugging module (off)])
417 if test "$with_mem_debug" = "yes" ; then
418 echo Enabling memory debug support
423 AC_SUBST(WITH_MEM_DEBUG)
426 dnl Is debugger support requested
428 AC_ARG_WITH(debugger, [ --with-debugger Add the debugging support (on)])
429 if test "$with_debugger" = "no" ; then
430 echo Disabling debugger
433 echo Enabling debugger
435 AC_DEFINE(WITH_DEBUGGER)
437 AC_SUBST(WITH_DEBUGGER)
440 dnl The following new parameters were added to offer
441 dnl the ability to specify the location of the libxml
442 dnl library during linking and compilation.
444 dnl original work - Mathieu Lacage 30/03/2000
445 dnl some tweaking - David Härdeman 30/10/2001
448 LIBXML_CONFIG_PREFIX=""
451 AC_ARG_WITH(libxml-prefix,
452 [ --with-libxml-prefix=[PFX] Specify location of libxml config],
453 LIBXML_CONFIG_PREFIX=$withval
456 AC_ARG_WITH(libxml-include-prefix,
457 [ --with-libxml-include-prefix=[PFX] Specify location of libxml headers],
458 LIBXML_CFLAGS="-I$withval"
461 AC_ARG_WITH(libxml-libs-prefix,
462 [ --with-libxml-libs-prefix=[PFX] Specify location of libxml libs],
463 LIBXML_LIBS="-L$withval"
466 AC_ARG_WITH(libxml-src,
467 [ --with-libxml-src=[DIR] For libxml thats not installed yet (sets all three above)],
468 LIBXML_SRC="$withval"
473 dnl where is xml2-config
476 AC_SUBST(LIBXML_REQUIRED_VERSION)
477 AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION)
478 if test "x$LIBXML_CONFIG_PREFIX" != "x"
480 XML_CONFIG=${LIBXML_CONFIG_PREFIX}/bin/xml2-config
482 XML_CONFIG=xml2-config
486 dnl imported from libxml2, c.f. #77827
488 if test "${GCC}" != "yes" ; then
491 CFLAGS="${CFLAGS} -Wp,-H30000"
494 CFLAGS="${CFLAGS} -ieee"
498 CFLAGS="${CFLAGS} -Wall"
501 CFLAGS="${CFLAGS} -mieee"
504 CFLAGS="${CFLAGS} -mieee"
510 dnl Override other variables if LIBXML_SRC is set
513 if test "x$LIBXML_SRC" != "x"
519 XML_CONFIG=${SRC_DIR}/xml2-config
520 LIBXML_CFLAGS="-I${SRC_DIR}/include"
521 LIBXML_LIBS="-L${SRC_DIR}"
524 AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
529 dnl make sure xml2-config is executable,
530 dnl test version and init our variables
533 if ${XML_CONFIG} --libs print > /dev/null 2>&1
535 XMLVERS=`$XML_CONFIG --version`
536 if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION)
538 LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`"
539 LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`"
540 AC_MSG_RESULT($XMLVERS found)
542 AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
545 AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
554 [ --with-plugins Add plugin extension support (on)])
555 if test "$with_plugins" = ""
560 AC_MSG_CHECKING([whether shared libraries will be built (required for plugins)])
561 if test "$enable_shared" = "no" -a "$with_plugins" = "yes"; then
563 AC_MSG_WARN([Disabling plugin support.])
564 AC_MSG_WARN([Plugins require that shared libraries be built.])
570 if test "$with_plugins" = "yes" ; then
571 AC_MSG_CHECKING([libxml2 module support])
572 WITH_MODULES="`$XML_CONFIG --modules`"
573 if test "${WITH_MODULES}" = "1"; then
583 AC_SUBST(WITH_MODULES)
584 AM_CONDITIONAL(WITH_MODULES, test "$WITH_MODULES" = "1")
587 dnl setup default module path
589 module_prefix=$prefix
590 test "x$module_prefix" = xNONE && module_prefix=$ac_default_prefix
591 LIBXSLT_DEFAULT_PLUGINS_PATH="$module_prefix/lib/libxslt-plugins"
592 AC_SUBST(LIBXSLT_DEFAULT_PLUGINS_PATH)
595 dnl In build tree I use a static version with memory debug enabled
597 if test "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ; then
598 dnl if test "`uname -i`" != "x86_64" -a -e $HOME/XML/.libs/libxml2.a ;
599 if test -e $HOME/XML/.libs/libxml2.a ;
601 LIBXML_LIBS="$HOME/XML/.libs/libxml2.a -lpthread -lz"
604 XSLTPROCDV="xsltproc.dv"
605 INSTALLED_XSLT_LIB=""
606 LIBXML_SRC="$HOME/XML/"
613 WIN32_EXTRA_LDFLAGS="-no-undefined"
616 WIN32_EXTRA_LIBADD="-lwsock32"
617 WIN32_EXTRA_LDFLAGS="-no-undefined"
618 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
619 AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
620 AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
623 AC_SUBST(WIN32_EXTRA_LIBADD)
624 AC_SUBST(WIN32_EXTRA_LDFLAGS)
630 AC_SUBST(LIBXML_LIBS)
631 AC_SUBST(LIBXML_CFLAGS)
633 AC_SUBST(PYTHON_VERSION)
634 AC_SUBST(PYTHON_INCLUDES)
635 AC_SUBST(PYTHON_SITE_PACKAGES)
637 XSLT_LIBDIR='-L${libdir}'
638 XSLT_INCLUDEDIR='-I${includedir}'
639 XSLT_LIBS="-lxslt $LIBXML_LIBS $M_LIBS"
640 AC_SUBST(XSLT_LIBDIR)
641 AC_SUBST(XSLT_INCLUDEDIR)
644 EXSLT_LIBDIR='-L${libdir}'
645 EXSLT_INCLUDEDIR='-I${includedir}'
646 EXSLT_LIBS="-lexslt $XSLT_LIBS $LIBGCRYPT_LIBS"
647 AC_SUBST(EXSLT_LIBDIR)
648 AC_SUBST(EXSLT_INCLUDEDIR)
651 EXTRA_LIBS="$EXTRA_LIBS $LIBXML_LIBS $M_LIBS"
656 dnl for the spec file
657 RELDATE=`date +'%a %b %e %Y'`
661 rm -f COPYING.LIB COPYING
662 $LN_S Copyright COPYING
672 libxslt/xsltwin32config.h
674 libexslt/exsltconfig.h
677 python/tests/Makefile
683 tests/general/Makefile
684 tests/reports/Makefile
685 tests/extensions/Makefile
686 tests/namespaces/Makefile
688 tests/numbers/Makefile
689 tests/documents/Makefile
690 tests/xmlspec/Makefile
691 tests/multiple/Makefile
692 tests/xinclude/Makefile
693 tests/XSLTMark/Makefile
694 tests/docbook/Makefile
696 tests/exslt/common/Makefile
697 tests/exslt/functions/Makefile
698 tests/exslt/math/Makefile
699 tests/exslt/sets/Makefile
700 tests/exslt/strings/Makefile
701 tests/exslt/date/Makefile
702 tests/exslt/dynamic/Makefile
703 tests/plugins/Makefile