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