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