Point to GIT for source code and a bit of cleanup
[platform/upstream/libxslt.git] / configure.in
1 dnl Process this file with autoconf to produce a configuration script.
2 AC_PREREQ(2.2)
3 AC_INIT(libxslt/xslt.c)
4 AM_CONFIG_HEADER(config.h)
5 AC_CANONICAL_HOST
6 AC_GNU_SOURCE
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 dnl
90 dnl Specific dir for HTML output ?
91 dnl
92
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'])
96
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"])
101
102 AC_SUBST(HTML_DIR)
103
104 dnl
105 dnl Check the environment
106 dnl
107
108 AC_ISC_POSIX
109 AC_PROG_CC
110 AC_PROG_INSTALL
111 AC_PROG_CPP
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)
117
118 AC_STDC_HEADERS
119
120 AC_LIBTOOL_WIN32_DLL
121 AM_PROG_LIBTOOL
122
123
124 AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
125
126 dnl
127 dnl if the system support linker version scripts for symbol versioning
128 dnl then add it
129 dnl
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"])
137
138 dnl Look for pthread.h, needed for testThreads
139 THREAD_LIBS=""
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"]))
145
146 AC_SUBST(THREAD_LIBS)
147
148 dnl
149 dnl Detect supported locale
150 dnl
151
152 XSLT_LOCALE_XLOCALE=0
153 XSLT_LOCALE_WINAPI=0
154
155 AC_CHECK_HEADERS([locale.h xlocale.h])
156 if test $ac_cv_header_xlocale_h = yes; then
157 dnl
158 dnl Check for generic locale_t declaration
159 dnl
160 AC_MSG_CHECKING([if xlocale program link])
161 AC_LINK_IFELSE(AC_LANG_PROGRAM([[
162 #ifdef HAVE_LOCALE_H
163 #include <locale.h>
164 #endif
165 #ifdef HAVE_XLOCALE_H
166 #include <xlocale.h>
167 #endif
168 #ifdef HAVE_STRING_H
169 #include <string.h>
170 #endif
171 #ifdef HAVE_STDLIB_H
172 #include <stdlib.h>
173 #endif
174
175 #ifdef __GLIBC__
176 typedef __locale_t xsltLocale;
177 #else
178 typedef locale_t xsltLocale;
179 #endif
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)
185 #endif
186 ]],[[
187     xsltLocale locale;
188     const char *src[[2]] = { "\xc3\x84rger", "Zeppelin" };
189     char *dst[[2]];
190     size_t len, r;
191     int i;
192
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);
201     }
202     if (strcmp(dst[[0]], dst[[1]]) >= 0) exit(1);
203
204     exit(0);
205     return(0);
206 ]]),
207   [AC_MSG_RESULT(yes); XSLT_LOCALE_XLOCALE=1],
208   [AC_MSG_RESULT(no)]
209 )
210 else
211   case "$host" in
212     *-*-mingw*)
213       AC_MSG_NOTICE([using winapi locale])
214       XSLT_LOCALE_WINAPI=1;;
215   esac
216 fi
217
218 AC_SUBST(XSLT_LOCALE_XLOCALE)
219 AC_SUBST(XSLT_LOCALE_WINAPI)
220
221 dnl
222 dnl Math detection
223 dnl
224
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)]))
230
231 AC_CHECK_FUNC(isinf, , AC_CHECK_LIB(m, isinf,
232   [M_LIBS="-lm"; AC_DEFINE(HAVE_ISINF)]))
233
234 AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow,
235   [M_LIBS="-lm"; AC_DEFINE(HAVE_POW)]))
236
237 AC_CHECK_FUNC(floor, , AC_CHECK_LIB(m, floor,
238   [M_LIBS="-lm"; AC_DEFINE(HAVE_FLOOR)]))
239
240 AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
241   [M_LIBS="-lm"; AC_DEFINE(HAVE_FABS)]))
242
243
244 AC_CHECK_FUNCS(gettimeofday)
245 AC_CHECK_FUNCS(mktime localtime localtime_r asctime time gmtime_r ftime)
246
247 dnl Checking the standard string functions availability
248 AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
249                NEED_TRIO=1)
250
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"
256   ])
257 ])
258
259 dnl
260 dnl Check for trio string functions
261 dnl
262
263 if test "${NEED_TRIO}" = "1" ; then
264     echo Reusing trio library for string functions
265     WITH_TRIO=1
266 else    
267     WITH_TRIO=0
268 fi
269 AC_SUBST(WITH_TRIO)
270
271 dnl
272 dnl Some packages need to be checked against version numbers so we
273 dnl define a function here for later use
274 dnl
275 AC_DEFUN([VERSION_TO_NUMBER],
276 [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
277
278 dnl
279 dnl Perl is just needed for generating some data for XSLtmark
280 dnl
281
282 AC_CHECK_PROG(PERL, perl, perl, false)
283 AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
284
285 dnl
286 dnl check for python
287 dnl
288
289 PYTHON_VERSION=
290 PYTHON_INCLUDES=
291 PYTHON_SITE_PACKAGES=
292 pythondir=
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"
296     then
297         echo Found python in $with_python/bin/python
298         PYTHON="$with_python/bin/python"
299     else
300         if test -x "$with_python"
301         then
302             echo Found python in $with_python
303             PYTHON="$with_python"
304         else
305             if test -x "$PYTHON"
306             then
307                 echo Found python in environment PYTHON=$PYTHON
308                 with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
309             else
310                 AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
311             fi
312         fi
313     fi
314     if test "$PYTHON" != ""
315     then
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
320 except: print 0"`
321         if test "$LIBXML2_PYTHON" = "1"
322         then
323             echo Found libxml2-python module
324         else
325             echo Warning: Missing libxml2-python
326         fi
327     fi
328     if test "$PYTHON_VERSION" != ""
329     then
330         if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
331            -d $with_python/lib/python$PYTHON_VERSION/site-packages
332         then
333             PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
334             PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
335         else
336             if test -r $prefix/include/python$PYTHON_VERSION/Python.h
337             then
338                 PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
339                 PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
340             else
341                 if test -r /usr/include/python$PYTHON_VERSION/Python.h
342                 then
343                     PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
344                     PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
345                 else
346                     echo could not find python$PYTHON_VERSION/Python.h
347                 fi
348             fi
349             if test ! -d "$PYTHON_SITE_PACKAGES"
350             then
351                     PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
352             fi
353         fi
354         PYTHON_LIBS=`python$PYTHON_VERSION-config --libs`
355     fi
356     if test "$with_python" != ""
357     then
358         pythondir='$(PYTHON_SITE_PACKAGES)'
359     else
360         pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
361     fi
362 fi
363 AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
364 if test "$PYTHON_INCLUDES" != ""
365 then
366     PYTHON_SUBDIR=python
367 else
368     PYTHON_SUBDIR=
369 fi
370 AC_SUBST(pythondir)
371 AC_SUBST(PYTHON_SUBDIR)
372 AC_SUBST(PYTHON_LIBS)
373
374 AC_ARG_WITH(crypto, [  --with-crypto           Add crypto support to exslt (on)])
375 WITH_CRYPTO=0
376 if test "$with_crypto" = "no" ; then
377     echo Disabling crypto support
378     LIBGCRYPT_CFLAGS=""
379     LIBGCRYPT_LIBS=""
380 else
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")
385       then
386         LIBGCRYPT_CFLAGS=""
387         LIBGCRYPT_LIBS=""
388         echo 'gcrypt library version < 1.1.42 - Crypto extensions will not be available.'
389       else
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.'
394                 WITH_CRYPTO=1
395       fi
396     else
397       LIBGCRYPT_CFLAGS=""
398       LIBGCRYPT_LIBS=""
399       echo 'Crypto extensions will not be available. Install libgcrypt and reconfigure to make available.'
400     fi
401 fi
402 AC_SUBST(WITH_CRYPTO)
403 AC_SUBST(LIBGCRYPT_CFLAGS)
404 AC_SUBST(LIBGCRYPT_LIBS)
405
406 dnl
407 dnl Debug for DV (-Wunreachable-code)
408 dnl
409 if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
410    [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxslt" ]]
411    then
412     if test "${with_mem_debug}" = "" ;
413     then
414         with_mem_debug="yes"
415     fi
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 "
417 fi
418
419 AC_ARG_WITH(debug, [  --with-debug            Add the debugging code (on)])
420 if test "$with_debug" = "no" ; then
421     echo Disabling debug support
422     WITH_XSLT_DEBUG=0
423 else    
424     WITH_XSLT_DEBUG=1
425 fi
426 AC_SUBST(WITH_XSLT_DEBUG)
427
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
431     WITH_MEM_DEBUG=1
432 else    
433     WITH_MEM_DEBUG=0
434 fi
435 AC_SUBST(WITH_MEM_DEBUG)
436
437 dnl 
438 dnl Is debugger support requested
439 dnl
440 AC_ARG_WITH(debugger, [  --with-debugger        Add the debugging support (on)])
441 if test "$with_debugger" = "no" ; then
442     echo Disabling debugger
443     WITH_DEBUGGER=0
444 else
445     echo Enabling debugger
446     WITH_DEBUGGER=1
447     AC_DEFINE(WITH_DEBUGGER)
448 fi
449 AC_SUBST(WITH_DEBUGGER)
450
451 dnl
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.
455 dnl
456 dnl original work - Mathieu Lacage 30/03/2000
457 dnl some tweaking - David Härdeman 30/10/2001
458 dnl
459
460 LIBXML_CONFIG_PREFIX=""
461 LIBXML_SRC=""
462
463 AC_ARG_WITH(libxml-prefix,
464         [  --with-libxml-prefix=[PFX]           Specify location of libxml config],
465         LIBXML_CONFIG_PREFIX=$withval
466 )
467         
468 AC_ARG_WITH(libxml-include-prefix,
469         [  --with-libxml-include-prefix=[PFX]   Specify location of libxml headers],
470         LIBXML_CFLAGS="-I$withval"
471 )
472
473 AC_ARG_WITH(libxml-libs-prefix,
474         [  --with-libxml-libs-prefix=[PFX]      Specify location of libxml libs],
475         LIBXML_LIBS="-L$withval"
476 )
477
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"
481 )
482 AC_SUBST(LIBXML_SRC)
483
484 dnl
485 dnl where is xml2-config
486 dnl
487
488 AC_SUBST(LIBXML_REQUIRED_VERSION)
489 AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION) 
490 if test "x$LIBXML_CONFIG_PREFIX" != "x"
491 then
492         XML_CONFIG=${LIBXML_CONFIG_PREFIX}/bin/xml2-config
493 else
494         XML_CONFIG=xml2-config
495 fi
496
497 dnl
498 dnl imported from libxml2, c.f. #77827 
499 dnl
500 if test "${GCC}" != "yes" ; then
501     case "${host}" in
502           *-*-hpux* )
503                CFLAGS="${CFLAGS} -Wp,-H30000"
504                ;;
505           *-dec-osf* )
506                CFLAGS="${CFLAGS} -ieee"
507                ;;
508     esac
509 else
510     CFLAGS="${CFLAGS} -Wall"
511     case "${host}" in
512           alpha*-*-linux* )
513                CFLAGS="${CFLAGS} -mieee"
514                ;;
515           alpha*-*-osf* )
516                CFLAGS="${CFLAGS} -mieee"
517                ;;
518     esac
519 fi
520
521 dnl
522 dnl Override other variables if LIBXML_SRC is set
523 dnl
524
525 if test "x$LIBXML_SRC" != "x"
526 then
527         CWD=`pwd`
528         if cd $LIBXML_SRC
529         then
530                 SRC_DIR=`pwd`
531                 XML_CONFIG=${SRC_DIR}/xml2-config
532                 LIBXML_CFLAGS="-I${SRC_DIR}/include"
533                 LIBXML_LIBS="-L${SRC_DIR}"
534                 cd $CWD
535         else
536                 AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
537         fi
538 fi
539
540 dnl
541 dnl make sure xml2-config is executable,
542 dnl test version and init our variables
543 dnl
544
545 if ${XML_CONFIG} --libs print > /dev/null 2>&1
546 then
547         XMLVERS=`$XML_CONFIG --version`
548         if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION)
549         then
550                 LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`"
551                 LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`"
552                 AC_MSG_RESULT($XMLVERS found)
553         else
554                 AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
555         fi
556 else
557         AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
558 fi
559
560
561 AC_SUBST(CFLAGS)
562 AC_SUBST(CPPFLAGS)
563 AC_SUBST(LDFLAGS)
564
565 AC_ARG_WITH(plugins,
566 [  --with-plugins          Add plugin extension support (on)])
567 if test "$with_plugins" = ""
568 then
569     with_plugins=yes
570 fi
571
572 AC_MSG_CHECKING([whether shared libraries will be built (required for plugins)])
573 if test "$enable_shared" = "no" -a "$with_plugins" = "yes"; then
574          AC_MSG_RESULT(no)
575          AC_MSG_WARN([Disabling plugin support.])
576          AC_MSG_WARN([Plugins require that shared libraries be built.])
577          with_plugins=no
578 else
579          AC_MSG_RESULT(yes)
580 fi
581
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
586     AC_MSG_RESULT(yes)
587   else
588     AC_MSG_RESULT(no)
589     WITH_MODULES="0"
590   fi
591 else
592   WITH_MODULES="0"
593 fi
594
595 AC_SUBST(WITH_MODULES)
596 AM_CONDITIONAL(WITH_MODULES, test "$WITH_MODULES" = "1")
597
598 dnl
599 dnl setup default module path
600 dnl
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)
605
606 WIN32_EXTRA_LIBADD=
607 WIN32_EXTRA_LDFLAGS=
608 case "$host" in
609  *-*-cygwin*)
610  WIN32_EXTRA_LDFLAGS="-no-undefined"
611  ;;
612  *-*-mingw*)
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])
618  ;;
619 esac
620 AC_SUBST(WIN32_EXTRA_LIBADD)
621 AC_SUBST(WIN32_EXTRA_LDFLAGS)
622
623
624 AC_SUBST(XSLTPROCDV)
625 AC_SUBST(PYTHONSODV)
626 AC_SUBST(XML_CONFIG)
627 AC_SUBST(LIBXML_LIBS)
628 AC_SUBST(LIBXML_CFLAGS)
629 AC_SUBST(PYTHON)
630 AC_SUBST(PYTHON_VERSION)
631 AC_SUBST(PYTHON_INCLUDES)
632 AC_SUBST(PYTHON_SITE_PACKAGES)
633
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)
639 AC_SUBST(XSLT_LIBS)
640
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)
646 AC_SUBST(EXSLT_LIBS)
647
648 EXTRA_LIBS="$EXTRA_LIBS $LIBXML_LIBS $M_LIBS"
649 AC_SUBST(EXTRA_LIBS)
650
651 AC_SUBST(M_LIBS)
652
653 dnl for the spec file
654 RELDATE=`date +'%a %b %e %Y'`
655 AC_SUBST(RELDATE)
656
657 ( cd $srcdir
658 rm -f COPYING.LIB COPYING
659 $LN_S Copyright COPYING
660 )
661
662
663 AC_OUTPUT([
664 Makefile
665 libxslt.pc
666 libexslt.pc
667 libxslt/Makefile
668 libxslt/xsltconfig.h
669 libxslt/xsltwin32config.h
670 libexslt/Makefile
671 libexslt/exsltconfig.h
672 xsltproc/Makefile
673 python/Makefile
674 python/tests/Makefile
675 tests/Makefile
676 tests/docs/Makefile
677 tests/REC1/Makefile
678 tests/REC2/Makefile
679 tests/REC/Makefile
680 tests/general/Makefile
681 tests/reports/Makefile
682 tests/extensions/Makefile
683 tests/namespaces/Makefile
684 tests/keys/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
692 tests/exslt/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
701 doc/Makefile
702 xslt-config
703 libxslt.spec
704 ])