OSDN Git Service

0dc9cfb7fc42d270174393b4140a1f29b3e754a9
[pf3gnuchains/pf3gnuchains4x.git] / itcl / itk / configure.ac
1 #!/bin/bash -norc
2 #--------------------------------------------------------------------
3 # Sample configure.in for Tcl Extensions.  The only places you should
4 # need to modify this file are marked by the string __CHANGE__
5 #--------------------------------------------------------------------
6
7 #-----------------------------------------------------------------------
8 # This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
9 # set as provided.  These will also be added as -D defs in your Makefile
10 # so you can encode the package version directly into the source files.
11 #-----------------------------------------------------------------------
12
13 AC_INIT([itk], [3.3])
14
15 #--------------------------------------------------------------------
16 # Call TEA_INIT as the first TEA_ macro to set up initial vars.
17 # This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
18 # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
19 #--------------------------------------------------------------------
20
21 TEA_INIT([3.2])
22
23 AC_PROG_LN_S
24 CONFIG_CLEAN_FILES=
25 if test ! -d $srcdir/tclconfig ; then
26     if test -d $srcdir/../tclconfig ; then
27         $LN_S $srcdir/../tclconfig tclconfig
28         CONFIG_CLEAN_FILES=tclconfig
29     fi
30 fi
31 AC_SUBST(CONFIG_CLEAN_FILES)
32
33 AC_CONFIG_AUX_DIR(tclconfig)
34
35 #--------------------------------------------------------------------
36 # Load the tclConfig.sh file
37 #--------------------------------------------------------------------
38
39 TEA_PATH_TCLCONFIG
40 TEA_LOAD_TCLCONFIG
41
42 #--------------------------------------------------------------------
43 # Load the tkConfig.sh file
44 #--------------------------------------------------------------------
45
46 TEA_PATH_TKCONFIG
47 TEA_LOAD_TKCONFIG
48
49 TEA_PATH_CONFIG(itcl)
50 TEA_LOAD_CONFIG(itcl)
51
52 ITCL_INCLUDES="-I\"`${CYGPATH} ${itcl_SRC_DIR}/generic`\""
53
54 #--------------------------------------------------------------------
55 # Handle the --prefix=... option by defaulting to what Tcl gave.
56 # Must be called after TEA_LOAD_TCLCONFIG and before $prefix is used.
57 #--------------------------------------------------------------------
58
59 TEA_PREFIX
60
61 #------------------------------------------------------------------------
62 # Standard compiler checks.
63 # This sets up CC by using the CC env var, or looks for gcc otherwise.
64 # This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
65 # the basic setup necessary to compile executables.
66 #------------------------------------------------------------------------
67
68 TEA_SETUP_COMPILER
69
70 #-----------------------------------------------------------------------
71 # __CHANGE__
72 # Specify the C source files to compile in TEA_ADD_SOURCES,
73 # public headers that need to be installed in TEA_ADD_HEADERS,
74 # stub library C source files to compile in TEA_ADD_STUB_SOURCES,
75 # and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
76 # This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
77 # and PKG_TCL_SOURCES.
78 #-----------------------------------------------------------------------
79
80 TEA_ADD_SOURCES([itk_cmds.c
81                 itk_option.c
82                 itk_archetype.c
83                 itk_util.c
84                 itkStubInit.c])
85 TEA_ADD_HEADERS([generic/itk.h generic/itkDecls.h])
86 TEA_ADD_INCLUDES([${ITCL_INCLUDES} -I\"`${CYGPATH} ${srcdir}/generic`\"])
87 TEA_ADD_LIBS([])
88 TEA_ADD_CFLAGS([])
89 #TEA_ADD_STUB_SOURCES([itkStubLib.c])
90 TEA_ADD_TCL_SOURCES([library/Archetype.itk
91                 library/Toplevel.itk
92                 library/Widget.itk
93                 library/itk.tcl
94                 library/tclIndex])
95
96 #--------------------------------------------------------------------
97 # __CHANGE__
98 # A few miscellaneous platform-specific items:
99 #
100 # Define a special symbol for Windows (BUILD_itk in this case) so
101 # that we create the export library with the dll.  See sha1.h on how
102 # to use this.
103 #
104 # Windows creates a few extra files that need to be cleaned up.
105 # You can add more files to clean if your extension creates any extra
106 # files.
107 #
108 # Define any extra compiler flags in the PACKAGE_CFLAGS variable.
109 # These will be appended to the current set of compiler flags for
110 # your system.
111 #--------------------------------------------------------------------
112
113 if test "${TEA_PLATFORM}" = "windows" ; then
114     AC_DEFINE(BUILD_itk)
115     CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc*.pch"
116     TEA_ADD_SOURCES([dllEntryPoint.c])
117 else
118     CLEANFILES=
119 fi
120
121 AC_SUBST(CLEANFILES)
122
123 #--------------------------------------------------------------------
124 # __CHANGE__
125 # Choose which headers you need.  Extension authors should try very
126 # hard to only rely on the Tcl public header files.  Internal headers
127 # contain private data structures and are subject to change without
128 # notice.
129 # This must be done AFTER calling TEA_PATH_TCLCONFIG/TEA_LOAD_TCLCONFIG
130 # so that we can extract TCL_SRC_DIR from the config file (in the case
131 # of private headers
132 #--------------------------------------------------------------------
133
134 #TEA_PUBLIC_TCL_HEADERS
135 TEA_PRIVATE_TCL_HEADERS
136
137 #TEA_PUBLIC_TK_HEADERS
138 TEA_PRIVATE_TK_HEADERS
139
140 #--------------------------------------------------------------------
141 # For Unix/Tk builds, make sure that the X libraries/headers are found.
142 #--------------------------------------------------------------------
143
144 TEA_PATH_X
145
146 #--------------------------------------------------------------------
147 # We need to enable the threading macros found in tcl.h and tclInt.h.
148 # The use of the threading features is determined by the core the
149 # extension is loaded into, but we need to compile with these macros
150 # turned on.
151 #--------------------------------------------------------------------
152
153 AC_DEFINE(TCL_THREADS)
154 #--------------------------------------------------------------------
155 # Check whether --enable-threads or --disable-threads was given.
156 # This auto-enables if Tcl was compiled threaded.
157 #--------------------------------------------------------------------
158
159 #TEA_ENABLE_THREADS
160
161 #--------------------------------------------------------------------
162 # The statement below defines a collection of symbols related to
163 # building as a shared library instead of a static library.
164 #--------------------------------------------------------------------
165
166 TEA_ENABLE_SHARED
167
168 #--------------------------------------------------------------------
169 # This macro figures out what flags to use with the compiler/linker
170 # when building shared/static debug/optimized objects.  This information
171 # is all taken from the tclConfig.sh file.
172 #--------------------------------------------------------------------
173
174 TEA_CONFIG_CFLAGS
175
176 #--------------------------------------------------------------------
177 # Set the default compiler switches based on the --enable-symbols 
178 # option.
179 #--------------------------------------------------------------------
180
181 TEA_ENABLE_SYMBOLS
182
183 #--------------------------------------------------------------------
184 # Everyone should be linking against the Tcl stub library.  If you
185 # can't for some reason, remove this definition.  If you aren't using
186 # stubs, you also need to modify the SHLIB_LD_LIBS setting below to
187 # link against the non-stubbed Tcl library.
188 #--------------------------------------------------------------------
189
190 if test "${SHARED_BUILD}" = "1" ; then
191     AC_DEFINE(USE_TCL_STUBS)
192     AC_DEFINE(USE_TK_STUBS)
193     AC_DEFINE(USE_ITCL_STUBS)
194 fi
195
196 #--------------------------------------------------------------------
197 # This macro generates a line to use when building a library.  It
198 # depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
199 # and TEA_LOAD_TCLCONFIG macros above.
200 #--------------------------------------------------------------------
201
202 TEA_MAKE_LIB
203
204 #--------------------------------------------------------------------
205 # __CHANGE__
206 # Add platform libs to LIBS or SHLIB_LD_LIBS as necessary.
207 #--------------------------------------------------------------------
208
209 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
210     SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${itcl_STUB_LIB_PATH}`\""
211 else
212     SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${itcl_STUB_LIB_SPEC}"
213 fi
214
215 #--------------------------------------------------------------------
216 # __CHANGE__
217 # Change the name from exampeA_LIB_FILE to match your package name.
218 # Use the stub_LIB_FILE substitution if your package creates a stub
219 # library.
220 #--------------------------------------------------------------------
221
222 itk_STUB_LIB_FILE=${PKG_STUB_LIB_FILE}
223 itk_LIB_FILE=${PKG_LIB_FILE}
224 AC_SUBST(itk_STUB_LIB_FILE)
225 AC_SUBST(itk_LIB_FILE)
226
227 #--------------------------------------------------------------------
228 # Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
229 # file during the install process.  Don't run the TCLSH_PROG through
230 # ${CYGPATH} because it's being used directly by make.
231 # Require that we use a tclsh shell version 8.2 or later since earlier
232 # versions have bugs in the pkg_mkIndex routine.
233 #--------------------------------------------------------------------
234
235 TEA_PROG_TCLSH
236 TEA_PROG_WISH
237
238 #--------------------------------------------------------------------
239 # These are for itkConfig.sh
240 #--------------------------------------------------------------------
241
242 # pkglibdir must be a fully qualified path and (not ${exec_prefix/lib)
243 eval pkglibdir="${libdir}/${PACKAGE_NAME}${PACKAGE_VERSION}"
244 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
245     eval itk_LIB_FLAG="-litk${PACKAGE_VERSION}${DBGX}"
246     eval itk_STUB_LIB_FLAG="-litclstub${PACKAGE_VERSION}${DBGX}"
247 else
248     eval itk_LIB_FLAG="-litcl`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
249     eval itk_STUB_LIB_FLAG="-litcl`echo ${PACKAGE_VERSION} | tr -d .`${DBGX}"
250 fi
251 itk_BUILD_LIB_SPEC="-L`pwd` ${itk_LIB_FLAG}"
252 itk_LIB_SPEC="-L${pkglibdir} ${itk_LIB_FLAG}"
253
254 itk_BUILD_STUB_LIB_SPEC="-L`pwd` ${itk_STUB_LIB_FLAG}"
255 itk_STUB_LIB_SPEC="-L${pkglibdir} ${itk_STUB_LIB_FLAG}"
256 itk_BUILD_STUB_LIB_PATH="`pwd`/${itk_STUB_LIB_FILE}"
257 itk_STUB_LIB_PATH="${pkglibdir}/${itk_STUB_LIB_FILE}"
258
259 AC_SUBST(itk_BUILD_LIB_SPEC)
260 AC_SUBST(itk_LIB_SPEC)
261 AC_SUBST(itk_BUILD_STUB_LIB_SPEC)
262 AC_SUBST(itk_STUB_LIB_SPEC)
263 AC_SUBST(itk_BUILD_STUB_LIB_PATH)
264 AC_SUBST(itk_STUB_LIB_PATH)
265
266 # itk_SRC_DIR must be a fully qualified path
267 eval itk_SRC_DIR="$srcdir"
268 itk_SRC_DIR=`cd "${itk_SRC_DIR}"; pwd`
269 AC_SUBST(itk_SRC_DIR)
270
271 #--------------------------------------------------------------------
272 # Finally, substitute all of the various values into the Makefile.
273 #--------------------------------------------------------------------
274
275 AC_OUTPUT([Makefile pkgIndex.tcl itkConfig.sh])