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