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=26
16 LIBEXSLT_MAJOR_VERSION=0
17 LIBEXSLT_MINOR_VERSION=8
18 LIBEXSLT_MICRO_VERSION=15
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)]))
244 AC_CHECK_FUNCS(gettimeofday)
245 AC_CHECK_FUNCS(mktime localtime localtime_r asctime time gmtime_r ftime)
247 dnl Checking the standard string functions availability
248 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
251 dnl Checking for POSIX timers
252 AC_CHECK_FUNCS(clock_gettime, [], [
253 AC_CHECK_LIB(rt, clock_gettime, [
254 AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
255 EXTRA_LIBS="$EXTRA_LIBS -lrt"
260 dnl Check for trio string functions
263 if test "${NEED_TRIO}" = "1" ; then
264 echo Reusing trio library for string functions
272 dnl Some packages need to be checked against version numbers so we
273 dnl define a function here for later use
275 AC_DEFUN([VERSION_TO_NUMBER],
276 [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
279 dnl Perl is just needed for generating some data for XSLtmark
282 AC_CHECK_PROG(PERL, perl, perl, false)
283 AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
291 PYTHON_SITE_PACKAGES=
293 AC_ARG_WITH(python, [ --with-python[=DIR] Build Python bindings if found])
294 if test "$with_python" != "no" ; then
295 if test -x "$with_python/bin/python"
297 echo Found python in $with_python/bin/python
298 PYTHON="$with_python/bin/python"
300 if test -x "$with_python"
302 echo Found python in $with_python
303 PYTHON="$with_python"
307 echo Found python in environment PYTHON=$PYTHON
308 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
310 AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
314 if test "$PYTHON" != ""
316 echo "PYTHON is pointing at $PYTHON"
317 PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
318 echo Found Python version $PYTHON_VERSION
319 LIBXML2_PYTHON=`$PYTHON -c "try : import libxml2 ; print 1
321 if test "$LIBXML2_PYTHON" = "1"
323 echo Found libxml2-python module
325 echo Warning: Missing libxml2-python
328 if test "$PYTHON_VERSION" != ""
330 if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
331 -d $with_python/lib/python$PYTHON_VERSION/site-packages
333 PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
334 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
336 if test -r $prefix/include/python$PYTHON_VERSION/Python.h
338 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
339 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
341 if test -r /usr/include/python$PYTHON_VERSION/Python.h
343 PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
344 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
346 echo could not find python$PYTHON_VERSION/Python.h
349 if test ! -d "$PYTHON_SITE_PACKAGES"
351 PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
354 PYTHON_LIBS=`python$PYTHON_VERSION-config --libs`
356 if test "$with_python" != ""
358 pythondir='$(PYTHON_SITE_PACKAGES)'
360 pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
363 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
364 if test "$PYTHON_INCLUDES" != ""
371 AC_SUBST(PYTHON_SUBDIR)
372 AC_SUBST(PYTHON_LIBS)
374 AC_ARG_WITH(crypto, [ --with-crypto Add crypto support to exslt (on)])
376 if test "$with_crypto" = "no" ; then
377 echo Disabling crypto support
381 AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
382 if test "$LIBGCRYPT_CONFIG" != "no" ; then
383 LIBGCRYPT_VERSION=`$LIBGCRYPT_CONFIG --version`
384 if test VERSION_TO_NUMBER(echo $LIBGCRYPT_VERSION) -lt VERSION_TO_NUMBER(echo "1.1.42")
388 echo 'gcrypt library version < 1.1.42 - Crypto extensions will not be available.'
390 LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --cflags`
391 LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --libs`
392 AC_DEFINE(HAVE_GCRYPT, 1, [Define if gcrypt library is available.])
393 echo 'Crypto extensions will be available.'
399 echo 'Crypto extensions will not be available. Install libgcrypt and reconfigure to make available.'
402 AC_SUBST(WITH_CRYPTO)
403 AC_SUBST(LIBGCRYPT_CFLAGS)
404 AC_SUBST(LIBGCRYPT_LIBS)
407 dnl Debug for DV (-Wunreachable-code)
409 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
410 [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxslt" ]]
412 if test "${with_mem_debug}" = "" ;
416 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 "
419 AC_ARG_WITH(debug, [ --with-debug Add the debugging code (on)])
420 if test "$with_debug" = "no" ; then
421 echo Disabling debug support
426 AC_SUBST(WITH_XSLT_DEBUG)
428 AC_ARG_WITH(mem_debug, [ --with-mem-debug Add the memory debugging module (off)])
429 if test "$with_mem_debug" = "yes" ; then
430 echo Enabling memory debug support
435 AC_SUBST(WITH_MEM_DEBUG)
438 dnl Is debugger support requested
440 AC_ARG_WITH(debugger, [ --with-debugger Add the debugging support (on)])
441 if test "$with_debugger" = "no" ; then
442 echo Disabling debugger
445 echo Enabling debugger
447 AC_DEFINE(WITH_DEBUGGER)
449 AC_SUBST(WITH_DEBUGGER)
452 dnl The following new parameters were added to offer
453 dnl the ability to specify the location of the libxml
454 dnl library during linking and compilation.
456 dnl original work - Mathieu Lacage 30/03/2000
457 dnl some tweaking - David Härdeman 30/10/2001
460 LIBXML_CONFIG_PREFIX=""
463 AC_ARG_WITH(libxml-prefix,
464 [ --with-libxml-prefix=[PFX] Specify location of libxml config],
465 LIBXML_CONFIG_PREFIX=$withval
468 AC_ARG_WITH(libxml-include-prefix,
469 [ --with-libxml-include-prefix=[PFX] Specify location of libxml headers],
470 LIBXML_CFLAGS="-I$withval"
473 AC_ARG_WITH(libxml-libs-prefix,
474 [ --with-libxml-libs-prefix=[PFX] Specify location of libxml libs],
475 LIBXML_LIBS="-L$withval"
478 AC_ARG_WITH(libxml-src,
479 [ --with-libxml-src=[DIR] For libxml thats not installed yet (sets all three above)],
480 LIBXML_SRC="$withval"
485 dnl where is xml2-config
488 AC_SUBST(LIBXML_REQUIRED_VERSION)
489 AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION)
490 if test "x$LIBXML_CONFIG_PREFIX" != "x"
492 XML_CONFIG=${LIBXML_CONFIG_PREFIX}/bin/xml2-config
494 XML_CONFIG=xml2-config
498 dnl imported from libxml2, c.f. #77827
500 if test "${GCC}" != "yes" ; then
503 CFLAGS="${CFLAGS} -Wp,-H30000"
506 CFLAGS="${CFLAGS} -ieee"
510 CFLAGS="${CFLAGS} -Wall"
513 CFLAGS="${CFLAGS} -mieee"
516 CFLAGS="${CFLAGS} -mieee"
522 dnl Override other variables if LIBXML_SRC is set
525 if test "x$LIBXML_SRC" != "x"
531 XML_CONFIG=${SRC_DIR}/xml2-config
532 LIBXML_CFLAGS="-I${SRC_DIR}/include"
533 LIBXML_LIBS="-L${SRC_DIR}"
536 AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
541 dnl make sure xml2-config is executable,
542 dnl test version and init our variables
545 if ${XML_CONFIG} --libs print > /dev/null 2>&1
547 XMLVERS=`$XML_CONFIG --version`
548 if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION)
550 LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`"
551 LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`"
552 AC_MSG_RESULT($XMLVERS found)
554 AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
557 AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
566 [ --with-plugins Add plugin extension support (on)])
567 if test "$with_plugins" = ""
572 AC_MSG_CHECKING([whether shared libraries will be built (required for plugins)])
573 if test "$enable_shared" = "no" -a "$with_plugins" = "yes"; then
575 AC_MSG_WARN([Disabling plugin support.])
576 AC_MSG_WARN([Plugins require that shared libraries be built.])
582 if test "$with_plugins" = "yes" ; then
583 AC_MSG_CHECKING([libxml2 module support])
584 WITH_MODULES="`$XML_CONFIG --modules`"
585 if test "${WITH_MODULES}" = "1"; then
595 AC_SUBST(WITH_MODULES)
596 AM_CONDITIONAL(WITH_MODULES, test "$WITH_MODULES" = "1")
599 dnl setup default module path
601 module_prefix=$prefix
602 test "x$module_prefix" = xNONE && module_prefix=$ac_default_prefix
603 LIBXSLT_DEFAULT_PLUGINS_PATH="$module_prefix/lib/libxslt-plugins"
604 AC_SUBST(LIBXSLT_DEFAULT_PLUGINS_PATH)
610 WIN32_EXTRA_LDFLAGS="-no-undefined"
613 WIN32_EXTRA_LIBADD="-lwsock32"
614 WIN32_EXTRA_LDFLAGS="-no-undefined"
615 AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
616 AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
617 AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
620 AC_SUBST(WIN32_EXTRA_LIBADD)
621 AC_SUBST(WIN32_EXTRA_LDFLAGS)
627 AC_SUBST(LIBXML_LIBS)
628 AC_SUBST(LIBXML_CFLAGS)
630 AC_SUBST(PYTHON_VERSION)
631 AC_SUBST(PYTHON_INCLUDES)
632 AC_SUBST(PYTHON_SITE_PACKAGES)
634 XSLT_LIBDIR='-L${libdir}'
635 XSLT_INCLUDEDIR='-I${includedir}'
636 XSLT_LIBS="-lxslt $LIBXML_LIBS $M_LIBS"
637 AC_SUBST(XSLT_LIBDIR)
638 AC_SUBST(XSLT_INCLUDEDIR)
641 EXSLT_LIBDIR='-L${libdir}'
642 EXSLT_INCLUDEDIR='-I${includedir}'
643 EXSLT_LIBS="-lexslt $XSLT_LIBS $LIBGCRYPT_LIBS"
644 AC_SUBST(EXSLT_LIBDIR)
645 AC_SUBST(EXSLT_INCLUDEDIR)
648 EXTRA_LIBS="$EXTRA_LIBS $LIBXML_LIBS $M_LIBS"
653 dnl for the spec file
654 RELDATE=`date +'%a %b %e %Y'`
658 rm -f COPYING.LIB COPYING
659 $LN_S Copyright COPYING
669 libxslt/xsltwin32config.h
671 libexslt/exsltconfig.h
674 python/tests/Makefile
680 tests/general/Makefile
681 tests/reports/Makefile
682 tests/extensions/Makefile
683 tests/namespaces/Makefile
685 tests/numbers/Makefile
686 tests/documents/Makefile
687 tests/xmlspec/Makefile
688 tests/multiple/Makefile
689 tests/xinclude/Makefile
690 tests/XSLTMark/Makefile
691 tests/docbook/Makefile
693 tests/exslt/common/Makefile
694 tests/exslt/functions/Makefile
695 tests/exslt/math/Makefile
696 tests/exslt/sets/Makefile
697 tests/exslt/strings/Makefile
698 tests/exslt/date/Makefile
699 tests/exslt/dynamic/Makefile
700 tests/plugins/Makefile