configure.in   [plain text]


#! /bin/bash -norc
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_REVISION($Id: configure.in,v 1.15 2003/03/09 11:30:34 balls Exp $)

#--------------------------------------------------------------------
# Configure script for package 'TclXSLT', as distributed at November 20, 2001.
# TEA compliant.
#--------------------------------------------------------------------

#--------------------------------------------------------------------
# This very first macro is used to verify that the configure script can 
# find the sources.  The argument to AC_INIT is a unique filename for
# this package.
#--------------------------------------------------------------------

AC_INIT([Tclxslt], [2.6])

AC_CONFIG_AUX_DIR(tclconfig)
CONFIGDIR=${srcdir}/tclconfig
AC_SUBST(CONFIGDIR)

#--------------------------------------------------------------------
# Setting our package name and version numbers.  The NODOT_VERSION is
# required for constructing the library name on systems that don't like
# dots in library names (Windows).  The VERSION variable is used on the
# other systems.
#--------------------------------------------------------------------

PACKAGE=Tclxslt

MAJOR_VERSION=2
MINOR_VERSION=6
#MAJOR_VERSION=10
#MINOR_VERSION=0
PATCHLEVEL=

VERSION=${MAJOR_VERSION}.${MINOR_VERSION}${PATCHLEVEL}
NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION}
TCLXSLT_VERSION=${VERSION}

AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(TCLXSLT_VERSION)

# This package name must be replaced statically for AC_SUBST to work
AC_SUBST(Tclxslt_LIB_FILE)
# Substitute stub_LIB_FILE if your package creates a stub library too.
AC_SUBST(Tclxsltstub_LIB_FILE)

#--------------------------------------------------------------------
# This was placed here so that we can compile with -DVERSION="1.2" to
# encode the package version directly into the source files.
#--------------------------------------------------------------------

eval AC_DEFINE_UNQUOTED(VERSION, "${VERSION}")
eval AC_DEFINE_UNQUOTED(TCLXSLT_VERSION, "${TCLXSLT_VERSION}")

#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows".
#--------------------------------------------------------------------

TEA_INIT([3.9])

#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------

TEA_PATH_TCLCONFIG
TEA_LOAD_TCLCONFIG

#-----------------------------------------------------------------------
# Handle the --prefix=... option by defaulting to what Tcl gave.
# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
#-----------------------------------------------------------------------

TEA_PREFIX

#-----------------------------------------------------------------------
# Standard compiler checks.
# This sets up CC by using the CC env var, or looks for gcc otherwise.
# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
# the basic setup necessary to compile executables.
#-----------------------------------------------------------------------

TEA_SETUP_COMPILER

TEA_PATH_CONFIG(tcldomxml)
TEA_LOAD_CONFIG(tcldomxml)
AC_SUBST(tcldomxml_VERSION)

#--------------------------------------------------------------------
# __CHANGE__
# Choose which headers you need.  Extension authors should try very
# hard to only rely on the Tcl public header files.  Internal headers
# contain private data structures and are subject to change without
# notice.
# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
#--------------------------------------------------------------------

TEA_PUBLIC_TCL_HEADERS
#TEA_PRIVATE_TCL_HEADERS

#--------------------------------------------------------------------
# A few miscellaneous platform-specific items:
#
# We have to define a special symbol for Windows (BUILD_Tclxslt in this
# case) so that we create the export library with the dll.
#
# Windows creates a few extra files that need to be cleaned up.
# We can add more files to clean if our extension creates any extra
# files in the future.
#
# Define any extra compiler flags in the PACKAGE_CFLAGS variable.
# These will be appended to the current set of compiler flags for
# your system.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" ; then
    AC_DEFINE(BUILD_Tclxslt)
    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
    EXTRA_SOURCES='$(WIN_SOURCES)'
else
    CLEANFILES="pkgIndex.tcl"
    EXTRA_SOURCES='$(UNIX_SOURCES)'
fi
AC_SUBST(CLEANFILES)
AC_SUBST(EXTRA_SOURCES)

#--------------------------------------------------------------------
# Check whether --enable-threads or --disable-threads was given.
# So far only Tcl responds to this one.
#--------------------------------------------------------------------

TEA_ENABLE_THREADS

#--------------------------------------------------------------------
# The statement below defines a collection of symbols related to
# building as a shared library instead of a static library.
#--------------------------------------------------------------------

TEA_ENABLE_SHARED

#--------------------------------------------------------------------
# This macro figures out what flags to use with the compiler/linker
# when building shared/static debug/optimized objects.  This information
# can be taken from the tclConfig.sh file, but this figures it all out.
#--------------------------------------------------------------------

TEA_CONFIG_CFLAGS

#--------------------------------------------------------------------
# Set the default compiler switches based on the --enable-symbols option.
#--------------------------------------------------------------------

TEA_ENABLE_SYMBOLS

#--------------------------------------------------------------------
# Everyone should be linking against the Tcl stub library.  If you
# can't for some reason, remove this definition.  If you aren't using
# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
# link against the non-stubbed Tcl library.
#--------------------------------------------------------------------

AC_DEFINE(USE_TCL_STUBS)
AC_DEFINE(USE_TCLDOMXML_STUBS)

#--------------------------------------------------------------------
# This macro generates a line to use when building a library.  It
# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
# and TEA_LOAD_TCLCONFIG macros above.
#--------------------------------------------------------------------

TEA_MAKE_LIB

#--------------------------------------------------------------------
# On Mac OS X we may want to build as a framework.
# This affects the location and naming of headers and libaries.
#--------------------------------------------------------------------

AC_ARG_ENABLE(framework, [  --enable-framework      build as a Mac OS X framework],
	[tcl_ok=$enableval], [tcl_ok=$1])

#--------------------------------------------------------------------
# libxml2 ----------------------------------------------------------
#--------------------------------------------------------------------
# Ask the user where to find the headers and libraries of libxml2.
# Remember this information for the generated files.
#--------------------------------------------------------------------

AC_MSG_CHECKING([for libxml2 headers])

with_xml2include=NONE
AC_ARG_WITH(libxml2-include,
    [  --with-libxml2-include      directory containing the libxml2 header files],
    with_xml2include=${withval})

LIBXML2_INCLUDEDIR=""
for d in 			\
    $with_xml2include		\
    $with_xml2include/libxml2	\
    $prefix/include		\
    $prefix/include/libxml2	\
    usr/include			\
    usr/include/libxml2		\
    usr/local/include		\
    usr/local/include/libxml2
do
    if test -f "$d/xpath.h" ; then
	LIBXML2_INCLUDEDIR="$d"
	break
    fi
    if test -f "$d/libxml/xpath.h" ; then
	LIBXML2_INCLUDEDIR="$d"
	break
    fi
done
if test "x$LIBXML2_INCLUDEDIR" = "x"; then
    AC_MSG_ERROR([not found, please use --with-libxml2-include])
else
    AC_MSG_RESULT([${LIBXML2_INCLUDEDIR}])
fi
if test "${TEA_PLATFORM}" = "windows"; then
    LIBXML2_INCLUDEDIR=\"`${CYGPATH} ${LIBXML2_INCLUDEDIR} 2>/dev/null`\"
fi
AC_SUBST(LIBXML2_INCLUDEDIR)

#--------------------------------------------------------------------

AC_MSG_CHECKING([for libxml2 library])

with_xml2lib=NONE
AC_ARG_WITH(libxml2-lib,
    [  --with-libxml2-lib      directory containing the libxml2 library],
    with_xml2lib=${withval})

LIBXML2_LIBDIR=""
for d in 		\
    $with_xml2lib	\
    $exec_prefix/lib	\
    usr/lib		\
    usr/local/lib
do
    if test -f "$d/libxml2.so" ; then
	LIBXML2_LIBDIR="$d"
	break
    fi
    if test -f "$d/libxml2.sl" ; then
	LIBXML2_LIBDIR="$d"
	break
    fi
    if test -f "$d/libxml2.dll" ; then
	LIBXML2_LIBDIR="$d"
	break
    fi
    if test "${enable_framework}" = "yes" -a -f "$d/libxml" ;  then
	LIBXML2_LIBDIR="$d"
	break
    fi
    if test -f "$d/libxml2.dylib" ; then
	LIBXML2_LIBDIR="$d"
	break
    fi
    if test -f "$d/libxml2.a" ; then
	LIBXML2_LIBDIR="$d"
	break
    fi
done
if test "x$LIBXML2_LIBDIR" = "x"; then
    AC_MSG_ERROR([not found, please use --with-libxml2-lib])
else
    AC_MSG_RESULT([${LIBXML2_LIBDIR}])
fi
AC_SUBST(LIBXML2_LIBDIR)

#--------------------------------------------------------------------
# libxslt ----------------------------------------------------------
#--------------------------------------------------------------------
# Ask the user where to find the headers and libraries of libxml2.
# Remember this information for the generated files.
#--------------------------------------------------------------------

AC_MSG_CHECKING([for libxslt headers])

with_xsltinclude=NONE
AC_ARG_WITH(libxslt-include,
    [  --with-libxslt-include     directory containing the libxslt header files],
    with_xsltinclude=${withval})

LIBXSLT=""
for d in                        \
    $with_xsltinclude           \
    $with_xsltinclude/libxslt   \
    $prefix/include             \
    $prefix/include/libxslt     \
    usr/include                 \
    usr/include/libxslt         \
    usr/local/include           \
    usr/local/include/libxslt
do
    if test -f "$d/xslt.h" ; then
        LIBXSLT_INCLUDEDIR="$d"
        break
    fi
    if test -f "$d/libxslt/xslt.h" ; then
        LIBXSLT_INCLUDEDIR="$d"
        break
    fi
done

if test "x$LIBXSLT_INCLUDEDIR" = "x"; then
    AC_MSG_ERROR([not found, please use --with-libxslt-include])
else
    AC_MSG_RESULT([${LIBXSLT_INCLUDEDIR}])
fi
if test "${TEA_PLATFORM}" = "windows"; then
    LIBXSLT_INCLUDEDIR=\"`${CYGPATH} ${LIBXSLT_INCLUDEDIR} 2>/dev/null`\"
fi
AC_SUBST(LIBXSLT_INCLUDEDIR)

#--------------------------------------------------------------------

AC_MSG_CHECKING([for libxslt library])

with_xsltlib=NONE
AC_ARG_WITH(libxslt-lib, [  --with-libxslt-lib         directory containing the libxslt library],
    with_xsltlib=${withval})

LIBXSLT_LIBDIR=""
for d in                \
    $with_xsltlib       \
    $exec_prefix/lib    \
    usr/lib             \
    usr/local/lib
do
    if test -f "$d/libxslt.so" ; then
        LIBXSLT_LIBDIR="$d"
        break
    fi
    if test -f "$d/libxslt.sl" ; then
        LIBXSLT_LIBDIR="$d"
        break
    fi
    if test -f "$d/libxslt.dll" ; then
        LIBXSLT_LIBDIR="$d"
        break
    fi
    if test "${enable_framework}" = "yes" -a -f "$d/libxslt" ;  then
	LIBXSLT_LIBDIR="$d"
	break
    fi
    if test -f "$d/libxslt.dylib" ; then
        LIBXSLT_LIBDIR="$d"
        break
    fi
    if test -f "$d/libxslt.a" ; then
        LIBXSLT_LIBDIR="$d"
        break
    fi
done
if test "x$LIBXSLT_LIBDIR" = "x"; then
    AC_MSG_ERROR([not found, please use --with-libxslt-lib])
else
    AC_MSG_RESULT([${LIBXSLT_LIBDIR}])
fi
AC_SUBST(LIBXSLT_LIBDIR)

#--------------------------------------------------------------------
# libexslt ----------------------------------------------------------
#--------------------------------------------------------------------
# Ask the user where to find the headers and libraries of libxml2.
# Remember this information for the generated files.
#--------------------------------------------------------------------

AC_MSG_CHECKING([for libexslt headers])

with_exsltinclude=NONE
AC_ARG_WITH(libexslt-include,
    [  --with-libexslt-include    directory containing the libexslt header files],
    with_exsltinclude=${withval})

LIBEXSLT=""
for d in                        \
    $with_exsltinclude           \
    $with_exsltinclude/libexslt   \
    $prefix/include             \
    $prefix/include/libexslt     \
    usr/include                 \
    usr/include/libexslt         \
    usr/local/include           \
    usr/local/include/libexslt
do
    if test -f "$d/exslt.h" ; then
        LIBEXSLT_INCLUDEDIR="$d"
        break
    fi
    if test -f "$d/libexslt/exslt.h" ; then
        LIBEXSLT_INCLUDEDIR="$d"
        break
    fi
done

if test "x$LIBEXSLT_INCLUDEDIR" = "x"; then
    AC_MSG_ERROR([not found, please use --with-libexslt-include])
else
    AC_MSG_RESULT([${LIBEXSLT_INCLUDEDIR}])
fi
if test "${TEA_PLATFORM}" = "windows"; then
    LIBEXSLT_INCLUDEDIR=\"`${CYGPATH} ${LIBEXSLT_INCLUDEDIR} 2>/dev/null`\"
fi
AC_SUBST(LIBEXSLT_INCLUDEDIR)

#--------------------------------------------------------------------

AC_MSG_CHECKING([for libexslt library])

with_exsltlib=NONE
AC_ARG_WITH(libexslt-lib, [  --with-libexslt-lib        directory containing the libexslt library],
    with_exsltlib=${withval})

LIBEXSLT_LIBDIR=""
for d in                \
    $with_exsltlib       \
    $exec_prefix/lib    \
    usr/lib             \
    usr/local/lib
do
    if test -f "$d/libexslt.so" ; then
        LIBEXSLT_LIBDIR="$d"
        break
    fi
    if test -f "$d/libexslt.sl" ; then
        LIBEXSLT_LIBDIR="$d"
        break
    fi
    if test -f "$d/libexslt.dll" ; then
        LIBEXSLT_LIBDIR="$d"
        break
    fi
    if test "${enable_framework}" = "yes" -a -f "$d/libexslt" ;  then
	LIBEXSLT_LIBDIR="$d"
	break
    fi
    if test -f "$d/libexslt.dylib" ; then
        LIBEXSLT_LIBDIR="$d"
        break
    fi
    if test -f "$d/libexslt.a" ; then
        LIBEXSLT_LIBDIR="$d"
        break
    fi
done
if test "x$LIBEXSLT_LIBDIR" = "x"; then
    AC_MSG_ERROR([not found, please use --with-libexslt-lib])
else
    AC_MSG_RESULT([${LIBEXSLT_LIBDIR}])
fi
AC_SUBST(LIBEXSLT_LIBDIR)

#--------------------------------------------------------------------
if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
    AC_MSG_CHECKING([for iconv library])

    with_iconvlib=NONE
    AC_ARG_WITH(iconv-lib,
	[  --with-iconv-lib      directory containing the iconv library],
	with_iconvlib=${withval})

    ICONV_LIBDIR=""
    for d in 		\
	$with_iconvlib	\
	$exec_prefix/lib	\
	usr/lib		\
	usr/local/lib
    do
	if test -f "$d/libiconv.so" ; then
	    ICONV_LIBDIR="$d"
	    break
	fi
	if test -f "$d/libiconv.sl" ; then
	    ICONV_LIBDIR="$d"
	    break
	fi
	if test -f "$d/iconv.dll" ; then
	    ICONV_LIBDIR="$d"
	    break
	fi
    done
    if test "x$ICONV_LIBDIR" = "x"; then
	AC_MSG_ERROR([not found, please use --with-iconv-lib])
    else
	AC_MSG_RESULT([${ICONV_LIBDIR}])
    fi
    AC_SUBST(ICONV_LIBDIR)
fi

#--------------------------------------------------------------------
# __CHANGE__
# Add platform libs to LIBS or SHLIB_LD_LIBS as necessary.
#--------------------------------------------------------------------

if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${LIBXSLT_LIBDIR}/libxslt.lib`\""
    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${LIBEXSLT_LIBDIR}/libexslt.lib`\""
    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${LIBXML2_LIBDIR}/libxml2.lib`\""
    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${ICONV_LIBDIR}/iconv.lib`\""
    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${tcldomxml_STUB_LIB_PATH}`\""
else
    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -L\${LIBXSLT_LIBDIR} -lxslt"
    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -L\${LIBEXSLT_LIBDIR} -lexslt"
    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -L\${LIBXML2_LIBDIR} -lxml2"
    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${tcldomxml_STUB_LIB_SPEC}"
fi

#--------------------------------------------------------------------
# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
# file during the install process.  Don't run the TCLSH_PROG through
# ${CYGPATH} because it's being used directly by make.
# Require that we use a tclsh shell version 8.2 or later since earlier
# versions have bugs in the pkg_mkIndex routine.
# Add WISH as well if this is a Tk extension.
#--------------------------------------------------------------------

TEA_PROG_TCLSH

eval "${PACKAGE}_LIB_FILE=${PKG_LIB_FILE}"
eval "${PACKAGE}stub_LIB_FILE=${PKG_STUB_LIB_FILE}"

#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
# You may alternatively have a special pkgIndex.tcl.in or other files
# which require substituting th AC variables in.  Include these here.
#--------------------------------------------------------------------

AC_OUTPUT([Makefile library/pkgIndex.tcl])

#--------------------------------------------------------------------