summaryrefslogtreecommitdiff
path: root/itcl/itcl/configure.in
blob: c33a8ffa9047578969286631ca64546137850bfd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
#--------------------------------------------------------------------
# Sample configure.in for Tcl Extensions.  The only places you should
# need to modify this file are marked by the string __CHANGE__
#--------------------------------------------------------------------

#--------------------------------------------------------------------
# __CHANGE__
# This very first macro is used to verify that the configure script can 
# find the sources.  The argument to AC_INIT should be a unique filename
# for this package, and can be a relative path, such as:
#
# AC_INIT(../generic/tcl.h)
#--------------------------------------------------------------------

AC_INIT(generic/itcl.h)
# CYGNUS LOCAL
AC_CONFIG_AUX_DIR(../..)
# END CYGNUS LOCAL

#--------------------------------------------------------------------
# __CHANGE__
# Set your package name and version numbers here.  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=itcl

MAJOR_VERSION=3
MINOR_VERSION=2
PATCHLEVEL=.0

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


AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

#--------------------------------------------------------------------
# We put this here so that you can compile with -DVERSION="1.2" to
# encode the package version directly into the source files.
#--------------------------------------------------------------------

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

#------------------------------------------------------------------------
# Handle the --prefix=... option
#------------------------------------------------------------------------

if test "${prefix}" = "NONE"; then
    prefix=/usr/local
fi
if test "${exec_prefix}" = "NONE"; then
    exec_prefix=$prefix
fi

#--------------------------------------------------------------------
# Check whether --enable-gcc or --disable-gcc was given.  Do this 
# before AC_CYGWIN is called so the compiler can 
# be fully tested by built-in autoconf tools.
# This macro also calls AC_PROG_CC to set the compiler if --enable-gcc
# was not used.
#--------------------------------------------------------------------

# CYGNUS LOCAL
dnl SC_ENABLE_GCC
AC_PROG_CC
# END CYGNUS LOCAL
AC_PROG_INSTALL

#--------------------------------------------------------------------
# Checks to see if the make program sets the $MAKE variable.
#--------------------------------------------------------------------

AC_PROG_MAKE_SET

#--------------------------------------------------------------------
# Find ranlib
#--------------------------------------------------------------------

AC_PROG_RANLIB

#--------------------------------------------------------------------
# This macro performs additional compiler tests.
#--------------------------------------------------------------------

AC_CYGWIN

#--------------------------------------------------------------------
# Determines the correct binary file extension (.o, .obj, .exe etc.)
#--------------------------------------------------------------------

AC_OBJEXT
AC_EXEEXT

#--------------------------------------------------------------------
# "cygpath" is used on windows to generate native path names for include
# files.
# These variables should only be used with the compiler and linker since
# they generate native path names.
#
# Unix tclConfig.sh points SRC_DIR at the top-level directory of
# the Tcl sources, while the Windows tclConfig.sh points SRC_DIR at
# the win subdirectory.  Hence the different usages of SRC_DIR below.
#
# This must be done before calling SC_PUBLIC_TCL_HEADERS
#
# RELPATH is used to locate binary extensions relative to the lib directory.
# It is only needed if mkIndex.tcl can't generate an installed pkgIndex.tcl
# file for you.
#--------------------------------------------------------------------

case "${host}" in
    *mingw32* | *windows32*)
	AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
	RELPATH=".. .. bin"
    ;;
    *)
	CYGPATH=echo
	RELPATH=..
    ;;
esac

AC_SUBST(CYGPATH)
AC_SUBST(RELPATH)

#--------------------------------------------------------------------
# Includes for this package
#--------------------------------------------------------------------

# CYGNUS LOCAL
srcdir=`cd ${srcdir} ; pwd`
ITCL_SRC_DIR_NATIVE=`${CYGPATH} ${srcdir}`
# END CYGNUS LOCAL
ITCL_GENERIC_DIR_NATIVE=`${CYGPATH} ${srcdir}/generic`
ITCL_WIN_DIR_NATIVE=`${CYGPATH} ${srcdir}/win`
ITCL_UNIX_DIR_NATIVE=`${CYGPATH} ${srcdir}/unix`

case "${host}" in
    *cygwin* | *mingw32* | *windows32*)
	ITCL_PLATFORM_DIR_NATIVE=${ITCL_WIN_DIR_NATIVE}
    ;;
    *)
	ITCL_PLATFORM_DIR_NATIVE=${ITCL_UNIX_DIR_NATIVE}
    ;;
esac

ITCL_INCLUDES="-I\"${ITCL_GENERIC_DIR_NATIVE}\" -I\"${ITCL_PLATFORM_DIR_NATIVE}\""

AC_SUBST(ITCL_GENERIC_DIR_NATIVE)
AC_SUBST(ITCL_WIN_DIR_NATIVE)
AC_SUBST(ITCL_UNIX_DIR_NATIVE)
AC_SUBST(ITCL_INCLUDES)

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

SC_PATH_TCLCONFIG
SC_LOAD_TCLCONFIG

#--------------------------------------------------------------------
# __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 done AFTER calling SC_PATH_TCLCONFIG/SC_LOAD_TCLCONFIG
# so that we can extract TCL_SRC_DIR from the config file (in the case
# of private headers
#--------------------------------------------------------------------

#SC_PUBLIC_TCL_HEADERS
SC_PRIVATE_TCL_HEADERS

#--------------------------------------------------------------------
# __CHANGE__
# A few miscellaneous platform-specific items:
#
# Define a special symbol for Windows (BUILD_itcl in this case) so
# that we create the export library with the dll.  See sha1.h on how
# to use this.
#
# Windows creates a few extra files that need to be cleaned up.
# You can add more files to clean if your extension creates any extra
# files.
#
# Define any extra compiler flags in the PACKAGE_CFLAGS variable.
# These will be appended to the current set of compiler flags for
# your system.
#--------------------------------------------------------------------

case "${host}" in
    *cygwin*| *mingw32* | *windows32*)
	AC_DEFINE(BUILD_itcl)
	CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc50.pch"
	PLATFORM_SOURCES='$(WIN_SOURCES)'
	PLATFORM_OBJECTS='$(WIN_OBJECTS)'
	PLATFORM_DIR='$(WIN_DIR)'
    ;;
    *)
	CLEANFILES=
	PLATFORM_SOURCES='$(UNIX_SOURCES)'
	PLATFORM_OBJECTS='$(UNIX_OBJECTS)'
	PLATFORM_DIR='$(UNIX_DIR)'
    ;;
esac

AC_SUBST(CLEANFILES)
AC_SUBST(PLATFORM_SOURCES)
AC_SUBST(PLATFORM_OBJECTS)
AC_SUBST(PLATFORM_DIR)

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

SC_ENABLE_THREADS

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

SC_ENABLE_SHARED

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

CFLAGS_DEBUG=${TCL_CFLAGS_DEBUG}
CFLAGS_OPTIMIZE=${TCL_CFLAGS_OPTIMIZE}
LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG}
LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE}
SHLIB_LD=${TCL_SHLIB_LD}
STLIB_LD=${TCL_STLIB_LD}
SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS}

AC_SUBST(CFLAGS_DEBUG)
AC_SUBST(CFLAGS_OPTIMIZE)
AC_SUBST(STLIB_LD)
AC_SUBST(SHLIB_LD)
AC_SUBST(SHLIB_CFLAGS)
AC_SUBST(SHLIB_LDFLAGS)

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

SC_ENABLE_SYMBOLS

if test "${SHARED_BUILD}" = "1" ; then
    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}'
else
    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING}'
fi

#--------------------------------------------------------------------
# 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.
#--------------------------------------------------------------------

if test "${SHARED_BUILD}" = "1" ; then
    AC_DEFINE(USE_TCL_STUBS)
fi

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

SC_MAKE_LIB

#--------------------------------------------------------------------
# eval these two values to dereference the ${DBGX} variable.
#--------------------------------------------------------------------

eval "SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
eval "UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"

#--------------------------------------------------------------------
# Shared libraries and static libraries have different names.
#--------------------------------------------------------------------

# CYGNUS LOCAL

if test "${SHARED_BUILD}" = "1" ; then
  # FIXME: Need to devise a TCL_TOOL macro to deal with this!
  case "${host}" in
    *cygwin* | *mingw32* | *windows32*)
        SHLIB_LD_LIBS="${TCL_BUILD_STUB_LIB_SPEC} ${TCL_SHLIB_LD_LIBS}"
        # Need to link to the .a or .lib not the .dll!
        TCL_TOOL_SHARED_LIB_LONGNAME(ITCL_SHLIB_FILE, ${PACKAGE}, ${SHARED_LIB_SUFFIX})
        TCL_TOOL_STATIC_LIB_LONGNAME(ITCL_LIB_FILE, ${PACKAGE}, ${UNSHARED_LIB_SUFFIX})
        ITCL_TARGET_FILE=${ITCL_SHLIB_FILE}
     ;;
    *)
        SHLIB_LD_LIBS="${TCL_BUILD_LIB_SPEC}"
        TCL_TOOL_SHARED_LIB_LONGNAME(ITCL_LIB_FILE, ${PACKAGE}, ${SHARED_LIB_SUFFIX})
        ITCL_TARGET_FILE=${ITCL_LIB_FILE}
     ;;
  esac
else
  TCL_TOOL_STATIC_LIB_LONGNAME(ITCL_LIB_FILE, ${PACKAGE}, ${UNSHARED_LIB_SUFFIX})
  ITCL_TARGET_FILE=${ITCL_LIB_FILE}
fi

TCL_TOOL_STATIC_LIB_LONGNAME(ITCL_STUB_LIB_FILE, ${PACKAGE}stub, ${UNSHARED_LIB_SUFFIX})

AC_SUBST(ITCL_LIB_FILE)
AC_SUBST(ITCL_STUB_LIB_FILE)

TCL_TOOL_LIB_SHORTNAME(ITCL_LIB_FLAG, ${PACKAGE}, ${VERSION})
TCL_TOOL_LIB_SHORTNAME(ITCL_STUB_LIB_FLAG, ${PACKAGE}stub, ${VERSION})

TCL_TOOL_LIB_SPEC(ITCL_BUILD_LIB_SPEC, `pwd`, ${ITCL_LIB_FLAG})
TCL_TOOL_LIB_SPEC(ITCL_BUILD_STUB_LIB_SPEC, `pwd`, ${ITCL_STUB_LIB_FLAG})
AC_SUBST(ITCL_BUILD_LIB_SPEC)
AC_SUBST(ITCL_BUILD_STUB_LIB_SPEC)

TCL_TOOL_LIB_SPEC(ITCL_LIB_SPEC, ${exec_prefix}/lib, ${ITCL_LIB_FLAG})
TCL_TOOL_LIB_SPEC(ITCL_STUB_LIB_SPEC, ${exec_prefix}/lib, ${ITCL_STUB_LIB_FLAG})
AC_SUBST(ITCL_LIB_SPEC)
AC_SUBST(ITCL_STUB_LIB_SPEC)

TCL_TOOL_LIB_PATH(ITCL_LIB_FULL_PATH, `pwd`, ${ITCL_LIB_FILE})
TCL_TOOL_LIB_PATH(ITCL_STUB_LIB_FULL_PATH, `pwd`, ${ITCL_STUB_LIB_FILE})
AC_SUBST(ITCL_LIB_FULL_PATH)
AC_SUBST(ITCL_STUB_LIB_FULL_PATH)

itclstub_LIB_FILE=${ITCL_STUB_LIB_FILE}
itcl_LIB_FILE=${ITCL_TARGET_FILE}

# END CYGNUS LOCAL

#--------------------------------------------------------------------
# __CHANGE__
# Change the name from exampeA_LIB_FILE to match your package name.
# Use the stub_LIB_FILE substitution if your package creates a stub
# library.
#--------------------------------------------------------------------

AC_SUBST(itclstub_LIB_FILE)
AC_SUBST(itcl_LIB_FILE)
AC_SUBST(SHLIB_LD_LIBS)

#--------------------------------------------------------------------
# Cache the stub library name so that the itk configure script can pick
# it up.
#--------------------------------------------------------------------

AC_CACHE_VAL(ac_cv_itclstub_LIB_FILE, ac_cv_itclstub_LIB_FILE=${itclstub_LIB_FILE})

#--------------------------------------------------------------------
# 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.
#--------------------------------------------------------------------

# CYGNUS LOCAL
# A Tcl shell is not available when bootstrapping!
dnl SC_PROG_TCLSH
# END CYGNUS LOCAL

#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
#--------------------------------------------------------------------

# CYGNUS LOCAL

# Note: The itclConfig.sh file below is not included in the net release.
# We subst these variables to retain compatibility with the previous
# version of itclConfig.sh.

ITCL_VERSION=${VERSION}
AC_SUBST(ITCL_VERSION)

ITCL_MAJOR_VERSION=${MAJOR_VERSION}
AC_SUBST(ITCL_MAJOR_VERSION)

ITCL_MINOR_VERSION=${MINOR_VERSION}
AC_SUBST(ITCL_MINOR_VERSION)

ITCL_RELEASE_LEVEL=${PATCHLEVEL}
AC_SUBST(ITCL_RELEASE_LEVEL)

ITCL_SRC_DIR=${ITCL_SRC_DIR_NATIVE}
AC_SUBST(ITCL_SRC_DIR)

ITCL_SH=NONE
AC_SUBST(ITCL_SH)


AC_OUTPUT([Makefile \
	itclConfig.sh \
	pkgIndex.tcl])

# END CYGNUS LOCAL