1#! /bin/bash -norc
2dnl
3dnl Process this file with autoconf to produce a configure script.
4dnl
5AC_REVISION($Id: configure.in,v 1.15 2003/03/09 11:30:34 balls Exp $)
6
7#--------------------------------------------------------------------
8# Configure script for package 'TclXSLT', as distributed at November 20, 2001.
9# TEA compliant.
10#--------------------------------------------------------------------
11
12#--------------------------------------------------------------------
13# This very first macro is used to verify that the configure script can 
14# find the sources.  The argument to AC_INIT is a unique filename for
15# this package.
16#--------------------------------------------------------------------
17
18AC_INIT([Tclxslt], [2.6])
19
20AC_CONFIG_AUX_DIR(tclconfig)
21CONFIGDIR=${srcdir}/tclconfig
22AC_SUBST(CONFIGDIR)
23
24#--------------------------------------------------------------------
25# Setting our package name and version numbers.  The NODOT_VERSION is
26# required for constructing the library name on systems that don't like
27# dots in library names (Windows).  The VERSION variable is used on the
28# other systems.
29#--------------------------------------------------------------------
30
31PACKAGE=Tclxslt
32
33MAJOR_VERSION=2
34MINOR_VERSION=6
35#MAJOR_VERSION=10
36#MINOR_VERSION=0
37PATCHLEVEL=
38
39VERSION=${MAJOR_VERSION}.${MINOR_VERSION}${PATCHLEVEL}
40NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION}
41TCLXSLT_VERSION=${VERSION}
42
43AC_SUBST(PACKAGE)
44AC_SUBST(VERSION)
45AC_SUBST(TCLXSLT_VERSION)
46
47# This package name must be replaced statically for AC_SUBST to work
48AC_SUBST(Tclxslt_LIB_FILE)
49# Substitute stub_LIB_FILE if your package creates a stub library too.
50AC_SUBST(Tclxsltstub_LIB_FILE)
51
52#--------------------------------------------------------------------
53# This was placed here so that we can compile with -DVERSION="1.2" to
54# encode the package version directly into the source files.
55#--------------------------------------------------------------------
56
57eval AC_DEFINE_UNQUOTED(VERSION, "${VERSION}")
58eval AC_DEFINE_UNQUOTED(TCLXSLT_VERSION, "${TCLXSLT_VERSION}")
59
60#--------------------------------------------------------------------
61# Call TEA_INIT as the first TEA_ macro to set up initial vars.
62# This will define a ${TEA_PLATFORM} variable == "unix" or "windows".
63#--------------------------------------------------------------------
64
65TEA_INIT([3.9])
66
67#--------------------------------------------------------------------
68# Load the tclConfig.sh file
69#--------------------------------------------------------------------
70
71TEA_PATH_TCLCONFIG
72TEA_LOAD_TCLCONFIG
73
74#-----------------------------------------------------------------------
75# Handle the --prefix=... option by defaulting to what Tcl gave.
76# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
77#-----------------------------------------------------------------------
78
79TEA_PREFIX
80
81#-----------------------------------------------------------------------
82# Standard compiler checks.
83# This sets up CC by using the CC env var, or looks for gcc otherwise.
84# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
85# the basic setup necessary to compile executables.
86#-----------------------------------------------------------------------
87
88TEA_SETUP_COMPILER
89
90TEA_PATH_CONFIG(tcldomxml)
91TEA_LOAD_CONFIG(tcldomxml)
92AC_SUBST(tcldomxml_VERSION)
93
94#--------------------------------------------------------------------
95# __CHANGE__
96# Choose which headers you need.  Extension authors should try very
97# hard to only rely on the Tcl public header files.  Internal headers
98# contain private data structures and are subject to change without
99# notice.
100# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
101#--------------------------------------------------------------------
102
103TEA_PUBLIC_TCL_HEADERS
104#TEA_PRIVATE_TCL_HEADERS
105
106#--------------------------------------------------------------------
107# A few miscellaneous platform-specific items:
108#
109# We have to define a special symbol for Windows (BUILD_Tclxslt in this
110# case) so that we create the export library with the dll.
111#
112# Windows creates a few extra files that need to be cleaned up.
113# We can add more files to clean if our extension creates any extra
114# files in the future.
115#
116# Define any extra compiler flags in the PACKAGE_CFLAGS variable.
117# These will be appended to the current set of compiler flags for
118# your system.
119#--------------------------------------------------------------------
120
121if test "${TEA_PLATFORM}" = "windows" ; then
122    AC_DEFINE(BUILD_Tclxslt)
123    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
124    EXTRA_SOURCES='$(WIN_SOURCES)'
125else
126    CLEANFILES="pkgIndex.tcl"
127    EXTRA_SOURCES='$(UNIX_SOURCES)'
128fi
129AC_SUBST(CLEANFILES)
130AC_SUBST(EXTRA_SOURCES)
131
132#--------------------------------------------------------------------
133# Check whether --enable-threads or --disable-threads was given.
134# So far only Tcl responds to this one.
135#--------------------------------------------------------------------
136
137TEA_ENABLE_THREADS
138
139#--------------------------------------------------------------------
140# The statement below defines a collection of symbols related to
141# building as a shared library instead of a static library.
142#--------------------------------------------------------------------
143
144TEA_ENABLE_SHARED
145
146#--------------------------------------------------------------------
147# This macro figures out what flags to use with the compiler/linker
148# when building shared/static debug/optimized objects.  This information
149# can be taken from the tclConfig.sh file, but this figures it all out.
150#--------------------------------------------------------------------
151
152TEA_CONFIG_CFLAGS
153
154#--------------------------------------------------------------------
155# Set the default compiler switches based on the --enable-symbols option.
156#--------------------------------------------------------------------
157
158TEA_ENABLE_SYMBOLS
159
160#--------------------------------------------------------------------
161# Everyone should be linking against the Tcl stub library.  If you
162# can't for some reason, remove this definition.  If you aren't using
163# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
164# link against the non-stubbed Tcl library.
165#--------------------------------------------------------------------
166
167AC_DEFINE(USE_TCL_STUBS)
168AC_DEFINE(USE_TCLDOMXML_STUBS)
169
170#--------------------------------------------------------------------
171# This macro generates a line to use when building a library.  It
172# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
173# and TEA_LOAD_TCLCONFIG macros above.
174#--------------------------------------------------------------------
175
176TEA_MAKE_LIB
177
178#--------------------------------------------------------------------
179# On Mac OS X we may want to build as a framework.
180# This affects the location and naming of headers and libaries.
181#--------------------------------------------------------------------
182
183AC_ARG_ENABLE(framework, [  --enable-framework      build as a Mac OS X framework],
184	[tcl_ok=$enableval], [tcl_ok=$1])
185
186#--------------------------------------------------------------------
187# libxml2 ----------------------------------------------------------
188#--------------------------------------------------------------------
189# Ask the user where to find the headers and libraries of libxml2.
190# Remember this information for the generated files.
191#--------------------------------------------------------------------
192
193AC_MSG_CHECKING([for libxml2 headers])
194
195with_xml2include=NONE
196AC_ARG_WITH(libxml2-include,
197    [  --with-libxml2-include      directory containing the libxml2 header files],
198    with_xml2include=${withval})
199
200LIBXML2_INCLUDEDIR=""
201for d in 			\
202    $with_xml2include		\
203    $with_xml2include/libxml2	\
204    $prefix/include		\
205    $prefix/include/libxml2	\
206    usr/include			\
207    usr/include/libxml2		\
208    usr/local/include		\
209    usr/local/include/libxml2
210do
211    if test -f "$d/xpath.h" ; then
212	LIBXML2_INCLUDEDIR="$d"
213	break
214    fi
215    if test -f "$d/libxml/xpath.h" ; then
216	LIBXML2_INCLUDEDIR="$d"
217	break
218    fi
219done
220if test "x$LIBXML2_INCLUDEDIR" = "x"; then
221    AC_MSG_ERROR([not found, please use --with-libxml2-include])
222else
223    AC_MSG_RESULT([${LIBXML2_INCLUDEDIR}])
224fi
225if test "${TEA_PLATFORM}" = "windows"; then
226    LIBXML2_INCLUDEDIR=\"`${CYGPATH} ${LIBXML2_INCLUDEDIR} 2>/dev/null`\"
227fi
228AC_SUBST(LIBXML2_INCLUDEDIR)
229
230#--------------------------------------------------------------------
231
232AC_MSG_CHECKING([for libxml2 library])
233
234with_xml2lib=NONE
235AC_ARG_WITH(libxml2-lib,
236    [  --with-libxml2-lib      directory containing the libxml2 library],
237    with_xml2lib=${withval})
238
239LIBXML2_LIBDIR=""
240for d in 		\
241    $with_xml2lib	\
242    $exec_prefix/lib	\
243    usr/lib		\
244    usr/local/lib
245do
246    if test -f "$d/libxml2.so" ; then
247	LIBXML2_LIBDIR="$d"
248	break
249    fi
250    if test -f "$d/libxml2.sl" ; then
251	LIBXML2_LIBDIR="$d"
252	break
253    fi
254    if test -f "$d/libxml2.dll" ; then
255	LIBXML2_LIBDIR="$d"
256	break
257    fi
258    if test "${enable_framework}" = "yes" -a -f "$d/libxml" ;  then
259	LIBXML2_LIBDIR="$d"
260	break
261    fi
262    if test -f "$d/libxml2.dylib" ; then
263	LIBXML2_LIBDIR="$d"
264	break
265    fi
266    if test -f "$d/libxml2.a" ; then
267	LIBXML2_LIBDIR="$d"
268	break
269    fi
270done
271if test "x$LIBXML2_LIBDIR" = "x"; then
272    AC_MSG_ERROR([not found, please use --with-libxml2-lib])
273else
274    AC_MSG_RESULT([${LIBXML2_LIBDIR}])
275fi
276AC_SUBST(LIBXML2_LIBDIR)
277
278#--------------------------------------------------------------------
279# libxslt ----------------------------------------------------------
280#--------------------------------------------------------------------
281# Ask the user where to find the headers and libraries of libxml2.
282# Remember this information for the generated files.
283#--------------------------------------------------------------------
284
285AC_MSG_CHECKING([for libxslt headers])
286
287with_xsltinclude=NONE
288AC_ARG_WITH(libxslt-include,
289    [  --with-libxslt-include     directory containing the libxslt header files],
290    with_xsltinclude=${withval})
291
292LIBXSLT=""
293for d in                        \
294    $with_xsltinclude           \
295    $with_xsltinclude/libxslt   \
296    $prefix/include             \
297    $prefix/include/libxslt     \
298    usr/include                 \
299    usr/include/libxslt         \
300    usr/local/include           \
301    usr/local/include/libxslt
302do
303    if test -f "$d/xslt.h" ; then
304        LIBXSLT_INCLUDEDIR="$d"
305        break
306    fi
307    if test -f "$d/libxslt/xslt.h" ; then
308        LIBXSLT_INCLUDEDIR="$d"
309        break
310    fi
311done
312
313if test "x$LIBXSLT_INCLUDEDIR" = "x"; then
314    AC_MSG_ERROR([not found, please use --with-libxslt-include])
315else
316    AC_MSG_RESULT([${LIBXSLT_INCLUDEDIR}])
317fi
318if test "${TEA_PLATFORM}" = "windows"; then
319    LIBXSLT_INCLUDEDIR=\"`${CYGPATH} ${LIBXSLT_INCLUDEDIR} 2>/dev/null`\"
320fi
321AC_SUBST(LIBXSLT_INCLUDEDIR)
322
323#--------------------------------------------------------------------
324
325AC_MSG_CHECKING([for libxslt library])
326
327with_xsltlib=NONE
328AC_ARG_WITH(libxslt-lib, [  --with-libxslt-lib         directory containing the libxslt library],
329    with_xsltlib=${withval})
330
331LIBXSLT_LIBDIR=""
332for d in                \
333    $with_xsltlib       \
334    $exec_prefix/lib    \
335    usr/lib             \
336    usr/local/lib
337do
338    if test -f "$d/libxslt.so" ; then
339        LIBXSLT_LIBDIR="$d"
340        break
341    fi
342    if test -f "$d/libxslt.sl" ; then
343        LIBXSLT_LIBDIR="$d"
344        break
345    fi
346    if test -f "$d/libxslt.dll" ; then
347        LIBXSLT_LIBDIR="$d"
348        break
349    fi
350    if test "${enable_framework}" = "yes" -a -f "$d/libxslt" ;  then
351	LIBXSLT_LIBDIR="$d"
352	break
353    fi
354    if test -f "$d/libxslt.dylib" ; then
355        LIBXSLT_LIBDIR="$d"
356        break
357    fi
358    if test -f "$d/libxslt.a" ; then
359        LIBXSLT_LIBDIR="$d"
360        break
361    fi
362done
363if test "x$LIBXSLT_LIBDIR" = "x"; then
364    AC_MSG_ERROR([not found, please use --with-libxslt-lib])
365else
366    AC_MSG_RESULT([${LIBXSLT_LIBDIR}])
367fi
368AC_SUBST(LIBXSLT_LIBDIR)
369
370#--------------------------------------------------------------------
371# libexslt ----------------------------------------------------------
372#--------------------------------------------------------------------
373# Ask the user where to find the headers and libraries of libxml2.
374# Remember this information for the generated files.
375#--------------------------------------------------------------------
376
377AC_MSG_CHECKING([for libexslt headers])
378
379with_exsltinclude=NONE
380AC_ARG_WITH(libexslt-include,
381    [  --with-libexslt-include    directory containing the libexslt header files],
382    with_exsltinclude=${withval})
383
384LIBEXSLT=""
385for d in                        \
386    $with_exsltinclude           \
387    $with_exsltinclude/libexslt   \
388    $prefix/include             \
389    $prefix/include/libexslt     \
390    usr/include                 \
391    usr/include/libexslt         \
392    usr/local/include           \
393    usr/local/include/libexslt
394do
395    if test -f "$d/exslt.h" ; then
396        LIBEXSLT_INCLUDEDIR="$d"
397        break
398    fi
399    if test -f "$d/libexslt/exslt.h" ; then
400        LIBEXSLT_INCLUDEDIR="$d"
401        break
402    fi
403done
404
405if test "x$LIBEXSLT_INCLUDEDIR" = "x"; then
406    AC_MSG_ERROR([not found, please use --with-libexslt-include])
407else
408    AC_MSG_RESULT([${LIBEXSLT_INCLUDEDIR}])
409fi
410if test "${TEA_PLATFORM}" = "windows"; then
411    LIBEXSLT_INCLUDEDIR=\"`${CYGPATH} ${LIBEXSLT_INCLUDEDIR} 2>/dev/null`\"
412fi
413AC_SUBST(LIBEXSLT_INCLUDEDIR)
414
415#--------------------------------------------------------------------
416
417AC_MSG_CHECKING([for libexslt library])
418
419with_exsltlib=NONE
420AC_ARG_WITH(libexslt-lib, [  --with-libexslt-lib        directory containing the libexslt library],
421    with_exsltlib=${withval})
422
423LIBEXSLT_LIBDIR=""
424for d in                \
425    $with_exsltlib       \
426    $exec_prefix/lib    \
427    usr/lib             \
428    usr/local/lib
429do
430    if test -f "$d/libexslt.so" ; then
431        LIBEXSLT_LIBDIR="$d"
432        break
433    fi
434    if test -f "$d/libexslt.sl" ; then
435        LIBEXSLT_LIBDIR="$d"
436        break
437    fi
438    if test -f "$d/libexslt.dll" ; then
439        LIBEXSLT_LIBDIR="$d"
440        break
441    fi
442    if test "${enable_framework}" = "yes" -a -f "$d/libexslt" ;  then
443	LIBEXSLT_LIBDIR="$d"
444	break
445    fi
446    if test -f "$d/libexslt.dylib" ; then
447        LIBEXSLT_LIBDIR="$d"
448        break
449    fi
450    if test -f "$d/libexslt.a" ; then
451        LIBEXSLT_LIBDIR="$d"
452        break
453    fi
454done
455if test "x$LIBEXSLT_LIBDIR" = "x"; then
456    AC_MSG_ERROR([not found, please use --with-libexslt-lib])
457else
458    AC_MSG_RESULT([${LIBEXSLT_LIBDIR}])
459fi
460AC_SUBST(LIBEXSLT_LIBDIR)
461
462#--------------------------------------------------------------------
463if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
464    AC_MSG_CHECKING([for iconv library])
465
466    with_iconvlib=NONE
467    AC_ARG_WITH(iconv-lib,
468	[  --with-iconv-lib      directory containing the iconv library],
469	with_iconvlib=${withval})
470
471    ICONV_LIBDIR=""
472    for d in 		\
473	$with_iconvlib	\
474	$exec_prefix/lib	\
475	usr/lib		\
476	usr/local/lib
477    do
478	if test -f "$d/libiconv.so" ; then
479	    ICONV_LIBDIR="$d"
480	    break
481	fi
482	if test -f "$d/libiconv.sl" ; then
483	    ICONV_LIBDIR="$d"
484	    break
485	fi
486	if test -f "$d/iconv.dll" ; then
487	    ICONV_LIBDIR="$d"
488	    break
489	fi
490    done
491    if test "x$ICONV_LIBDIR" = "x"; then
492	AC_MSG_ERROR([not found, please use --with-iconv-lib])
493    else
494	AC_MSG_RESULT([${ICONV_LIBDIR}])
495    fi
496    AC_SUBST(ICONV_LIBDIR)
497fi
498
499#--------------------------------------------------------------------
500# __CHANGE__
501# Add platform libs to LIBS or SHLIB_LD_LIBS as necessary.
502#--------------------------------------------------------------------
503
504if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
505    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${LIBXSLT_LIBDIR}/libxslt.lib`\""
506    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${LIBEXSLT_LIBDIR}/libexslt.lib`\""
507    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${LIBXML2_LIBDIR}/libxml2.lib`\""
508    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${ICONV_LIBDIR}/iconv.lib`\""
509    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${tcldomxml_STUB_LIB_PATH}`\""
510else
511    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -L\${LIBXSLT_LIBDIR} -lxslt"
512    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -L\${LIBEXSLT_LIBDIR} -lexslt"
513    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -L\${LIBXML2_LIBDIR} -lxml2"
514    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${tcldomxml_STUB_LIB_SPEC}"
515fi
516
517#--------------------------------------------------------------------
518# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
519# file during the install process.  Don't run the TCLSH_PROG through
520# ${CYGPATH} because it's being used directly by make.
521# Require that we use a tclsh shell version 8.2 or later since earlier
522# versions have bugs in the pkg_mkIndex routine.
523# Add WISH as well if this is a Tk extension.
524#--------------------------------------------------------------------
525
526TEA_PROG_TCLSH
527
528eval "${PACKAGE}_LIB_FILE=${PKG_LIB_FILE}"
529eval "${PACKAGE}stub_LIB_FILE=${PKG_STUB_LIB_FILE}"
530
531#--------------------------------------------------------------------
532# Finally, substitute all of the various values into the Makefile.
533# You may alternatively have a special pkgIndex.tcl.in or other files
534# which require substituting th AC variables in.  Include these here.
535#--------------------------------------------------------------------
536
537AC_OUTPUT([Makefile library/pkgIndex.tcl])
538
539#--------------------------------------------------------------------
540