1#!/bin/bash -norc
2dnl	This file is an input file used by the GNU "autoconf" program to
3dnl	generate the file "configure", which is run during Tcl installation
4dnl	to configure the system for the local environment.
5#
6# RCS: @(#) $Id: configure.in,v 1.2 2002/10/13 00:08:51 rolf Exp $
7
8#-----------------------------------------------------------------------
9# Sample configure.in for Tcl Extensions.  The only places you should
10# need to modify this file are marked by the string __CHANGE__
11#-----------------------------------------------------------------------
12
13#-----------------------------------------------------------------------
14# __CHANGE__
15# This very first macro is used to verify that the configure script can 
16# find the sources.  The argument to AC_INIT should be a unique filename
17# for this package, and can be a relative path, such as:
18#
19# AC_INIT(generic/tcl.h)
20#-----------------------------------------------------------------------
21
22AC_INIT(example.c)
23
24AC_CONFIG_AUX_DIR(../../tclconfig)
25CONFIGDIR=${srcdir}/../../tclconfig
26AC_SUBST(CONFIGDIR)
27
28#----------------------------------------------------------------------
29# __CHANGE__
30# Set your package name and version numbers here.  The NODOT_VERSION is
31# required for constructing the library name on systems that don't like
32# dots in library names (Windows).  The VERSION variable is used on the
33# other systems.
34#----------------------------------------------------------------------
35
36PACKAGE=example
37
38MAJOR_VERSION=1
39MINOR_VERSION=0
40PATCHLEVEL=0
41
42VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCHLEVEL}
43NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION}${PATCHLEVEL}
44
45AC_SUBST(PACKAGE)
46AC_SUBST(VERSION)
47
48# This package name must be replaced statically for AC_SUBST to work
49AC_SUBST(example_LIB_FILE)
50
51#--------------------------------------------------------------------
52# We put this here so that you can compile with -DVERSION="1.2" to
53# encode the package version directly into the source files.
54#--------------------------------------------------------------------
55
56eval AC_DEFINE_UNQUOTED(VERSION, "${VERSION}")
57
58#--------------------------------------------------------------------
59# Call TEA_INIT as the first TEA_ macro to set up initial vars.
60# This will define a ${TEA_PLATFORM} variable == "unix" or "windows".
61#--------------------------------------------------------------------
62
63TEA_INIT
64
65#--------------------------------------------------------------------
66# Load the tclConfig.sh file
67#--------------------------------------------------------------------
68
69TEA_PATH_TCLCONFIG
70TEA_LOAD_TCLCONFIG
71
72#--------------------------------------------------------------------
73# Load the tdomConfig.sh file
74#--------------------------------------------------------------------
75if test "${TEA_PLATFORM}" = "windows" ; then
76    TDOM_BIN_DIR=../../win
77else
78    TDOM_BIN_DIR=../../unix
79fi
80TDOM_LOAD_CONFIG
81
82#--------------------------------------------------------------------
83# Load the tkConfig.sh file if necessary (Tk extension)
84#--------------------------------------------------------------------
85
86#TEA_PATH_TKCONFIG
87#TEA_LOAD_TKCONFIG
88
89#-----------------------------------------------------------------------
90# Handle the --prefix=... option by defaulting to what Tcl gave.
91# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
92#-----------------------------------------------------------------------
93
94TEA_PREFIX
95
96#-----------------------------------------------------------------------
97# Standard compiler checks.
98# This sets up CC by using the CC env var, or looks for gcc otherwise.
99# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
100# the basic setup necessary to compile executables.
101#-----------------------------------------------------------------------
102
103TEA_SETUP_COMPILER
104
105#--------------------------------------------------------------------
106# __CHANGE__
107# Choose which headers you need.  Extension authors should try very
108# hard to only rely on the Tcl public header files.  Internal headers
109# contain private data structures and are subject to change without
110# notice.
111# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
112#--------------------------------------------------------------------
113
114TEA_PUBLIC_TCL_HEADERS
115#TEA_PRIVATE_TCL_HEADERS
116
117#TEA_PUBLIC_TK_HEADERS
118#TEA_PRIVATE_TK_HEADERS
119
120#--------------------------------------------------------------------
121# __CHANGE__
122# A few miscellaneous platform-specific items:
123#
124# Define a special symbol for Windows (BUILD_sample in this case) so
125# that we create the export library with the dll.  See sha1.h on how
126# to use this.
127#
128# Windows creates a few extra files that need to be cleaned up.
129# You can add more files to clean if your extension creates any extra
130# files.
131#
132# Define any extra compiler flags in the PACKAGE_CFLAGS variable.
133# These will be appended to the current set of compiler flags for
134# your system.
135#--------------------------------------------------------------------
136
137if test "${TEA_PLATFORM}" = "windows" ; then
138    AC_DEFINE(BUILD_example)
139    CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch"
140    EXTRA_SOURCES='$(WIN_SOURCES)'
141else
142    CLEANFILES="pkgIndex.tcl"
143    EXTRA_SOURCES='$(UNIX_SOURCES)'
144fi
145AC_SUBST(CLEANFILES)
146AC_SUBST(EXTRA_SOURCES)
147
148#--------------------------------------------------------------------
149# Check whether --enable-threads or --disable-threads was given.
150#--------------------------------------------------------------------
151
152TEA_ENABLE_THREADS
153
154#--------------------------------------------------------------------
155# The statement below defines a collection of symbols related to
156# building as a shared library instead of a static library.
157#--------------------------------------------------------------------
158
159TEA_ENABLE_SHARED
160
161#--------------------------------------------------------------------
162# This macro figures out what flags to use with the compiler/linker
163# when building shared/static debug/optimized objects.  This information
164# can be taken from the tclConfig.sh file, but this figures it all out.
165#--------------------------------------------------------------------
166
167TEA_CONFIG_CFLAGS
168
169#--------------------------------------------------------------------
170# Set the default compiler switches based on the --enable-symbols option.
171#--------------------------------------------------------------------
172
173TEA_ENABLE_SYMBOLS
174
175if test "${SHARED_BUILD}" = "1" ; then
176    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}'
177else
178    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING}'
179fi
180AC_SUBST(SHARED_BUILD)
181
182#--------------------------------------------------------------------
183# Everyone should be linking against the Tcl stub library.  If you
184# can't for some reason, remove this definition.  If you aren't using
185# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
186# link against the non-stubbed Tcl library.  Add Tk too if necessary.
187#--------------------------------------------------------------------
188
189AC_DEFINE(USE_TCL_STUBS)
190#AC_DEFINE(USE_TK_STUBS)
191
192#--------------------------------------------------------------------
193# This macro generates a line to use when building a library.  It
194# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
195# and TEA_LOAD_TCLCONFIG macros above.
196# For tDOM we always build both, static and shared libraries
197#--------------------------------------------------------------------
198
199TEA_MAKE_LIB
200
201#--------------------------------------------------------------------
202# __CHANGE__
203# Add platform libs to LIBS or SHLIB_LD_LIBS as necessary.
204#--------------------------------------------------------------------
205
206#LIBS="${LIBS} --lsuperfly"
207
208#--------------------------------------------------------------------
209# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
210# file during the install process.  Don't run the TCLSH_PROG through
211# ${CYGPATH} because it's being used directly by make.
212# Require that we use a tclsh shell version 8.2 or later since earlier
213# versions have bugs in the pkg_mkIndex routine.
214# Add WISH as well if this is a Tk extension.
215#--------------------------------------------------------------------
216
217TEA_PROG_TCLSH
218#TEA_PROG_WISH
219
220#--------------------------------------------------------------------
221# Add some private include directories
222#--------------------------------------------------------------------
223
224EXAMPLE_INCLUDES="-I${srcdir}/../../generic -I${srcdir}/../../expat"
225AC_SUBST(EXAMPLE_INCLUDES)
226
227#--------------------------------------------------------------------
228# Finally, substitute all of the various values into the Makefile.
229# You may alternatively have a special pkgIndex.tcl.in or other files
230# which require substituting th AC variables in.  Include these here.
231#--------------------------------------------------------------------
232
233AC_OUTPUT([Makefile])
234