1#! /bin/bash -norc
2# This file is an input file used by the GNU "autoconf" program to
3# generate the file "configure", which is run during Tcl installation
4# to configure the system for the local environment.
5
6AC_INIT([tcl],[8.6])
7AC_CONFIG_SRCDIR([../generic/tcl.h])
8AC_PREREQ([2.59])
9
10# The following define is needed when building with Cygwin since newer
11# versions of autoconf incorrectly set SHELL to /bin/bash instead of
12# /bin/sh. The bash shell seems to suffer from some strange failures.
13SHELL=/bin/sh
14
15TCL_VERSION=8.6
16TCL_MAJOR_VERSION=8
17TCL_MINOR_VERSION=6
18TCL_PATCH_LEVEL=".12"
19VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION
20
21TCL_DDE_VERSION=1.4
22TCL_DDE_MAJOR_VERSION=1
23TCL_DDE_MINOR_VERSION=4
24DDEVER=$TCL_DDE_MAJOR_VERSION$TCL_DDE_MINOR_VERSION
25
26TCL_REG_VERSION=1.3
27TCL_REG_MAJOR_VERSION=1
28TCL_REG_MINOR_VERSION=3
29REGVER=$TCL_REG_MAJOR_VERSION$TCL_REG_MINOR_VERSION
30
31PKG_CFG_ARGS=$@
32
33#------------------------------------------------------------------------
34# Empty slate for bundled packages, to avoid stale configuration
35#------------------------------------------------------------------------
36rm -Rf pkgs
37
38#------------------------------------------------------------------------
39# Handle the --prefix=... option
40#------------------------------------------------------------------------
41
42if test "${prefix}" = "NONE"; then
43    prefix=/usr/local
44fi
45if test "${exec_prefix}" = "NONE"; then
46    exec_prefix=$prefix
47fi
48# libdir must be a fully qualified path (not ${exec_prefix}/lib)
49eval libdir="$libdir"
50
51#------------------------------------------------------------------------
52# Standard compiler checks
53#------------------------------------------------------------------------
54
55# If the user did not set CFLAGS, set it now to keep
56# the AC_PROG_CC macro from adding "-g -O2".
57if test "${CFLAGS+set}" != "set" ; then
58    CFLAGS=""
59fi
60
61AC_PROG_CC
62AC_C_INLINE
63AC_HEADER_STDC
64
65AC_CHECK_TOOL(AR, ar)
66AC_CHECK_TOOL(RANLIB, ranlib)
67AC_CHECK_TOOL(RC, windres)
68
69#--------------------------------------------------------------------
70# Checks to see if the make program sets the $MAKE variable.
71#--------------------------------------------------------------------
72
73AC_PROG_MAKE_SET
74
75#--------------------------------------------------------------------
76# Determines the correct binary file extension (.o, .obj, .exe etc.)
77#--------------------------------------------------------------------
78
79AC_OBJEXT
80AC_EXEEXT
81
82#--------------------------------------------------------------------
83# Check whether --enable-threads or --disable-threads was given.
84#--------------------------------------------------------------------
85
86SC_ENABLE_THREADS
87
88#------------------------------------------------------------------------
89# Embedded configuration information, encoding to use for the values, TIP #59
90#------------------------------------------------------------------------
91
92SC_TCL_CFG_ENCODING
93
94#--------------------------------------------------------------------
95# The statements below define a collection of symbols related to
96# building libtcl as a shared library instead of a static library.
97#--------------------------------------------------------------------
98
99SC_ENABLE_SHARED
100
101#--------------------------------------------------------------------
102# Check whether --enable-time64bit was given.
103#--------------------------------------------------------------------
104
105AC_MSG_CHECKING([force of 64-bit time_t])
106AC_ARG_ENABLE(time64bit,
107    AS_HELP_STRING([--enable-time64bit],
108	[force 64-bit time_t for 32-bit build (default: off)]),
109    [tcl_ok=$enableval], [tcl_ok=no])
110AC_MSG_RESULT("$tcl_ok")
111if test "$tcl_ok" = "yes"; then
112    CFLAGS="${CFLAGS} -D_USE_64BIT_TIME_T"
113fi
114
115#--------------------------------------------------------------------
116# The statements below define a collection of compile flags.  This
117# macro depends on the value of SHARED_BUILD, and should be called
118# after SC_ENABLE_SHARED checks the configure switches.
119#--------------------------------------------------------------------
120
121SC_CONFIG_CFLAGS
122
123# Cross-compiling
124case ${host_alias} in
125*mingw32*)
126    TCL_EXE="tclsh"
127    ;;
128*)
129    TCL_EXE="TCL_LIBRARY=\"\${LIBRARY_DIR}\"; export TCL_LIBRARY; ./\${TCLSH}"
130    ;;
131esac
132
133#------------------------------------------------------------------------
134#	Add stuff for zlib; note that this is mostly done in the makefile now
135#	as we just assume that the platform hasn't got a usable z.lib
136#------------------------------------------------------------------------
137
138AS_IF([test "${enable_shared+set}" = "set"], [
139  enableval="$enable_shared"
140  tcl_ok=$enableval
141], [
142  tcl_ok=yes
143])
144AS_IF([test "$tcl_ok" = "yes"], [
145  AC_SUBST(ZLIB_DLL_FILE,[\${ZLIB_DLL_FILE}])
146  AS_IF([test "$do64bit" != "no"], [
147    AS_IF([test "$GCC" == "yes"],[
148      AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64/libz.dll.a])
149    ], [
150      AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64/zdll.lib])
151    ])
152  ], [
153    AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win32/zdll.lib])
154  ])
155], [
156  AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}])
157])
158AC_DEFINE(HAVE_ZLIB, 1, [Is there an installed zlib?])
159
160AC_CHECK_TYPE([intptr_t], [
161    AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [
162    AC_CACHE_CHECK([for pointer-size signed integer type], tcl_cv_intptr_t, [
163    for tcl_cv_intptr_t in "int" "long" "long long" none; do
164	if test "$tcl_cv_intptr_t" != none; then
165	    AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
166		    [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])],
167		[tcl_ok=yes], [tcl_ok=no])
168	    test "$tcl_ok" = yes && break; fi
169    done])
170    if test "$tcl_cv_intptr_t" != none; then
171	AC_DEFINE_UNQUOTED([intptr_t], [$tcl_cv_intptr_t], [Signed integer
172	   type wide enough to hold a pointer.])
173    fi
174])
175AC_CHECK_TYPE([uintptr_t], [
176    AC_DEFINE([HAVE_UINTPTR_T], 1, [Do we have the uintptr_t type?])], [
177    AC_CACHE_CHECK([for pointer-size unsigned integer type], tcl_cv_uintptr_t, [
178    for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \
179	    none; do
180	if test "$tcl_cv_uintptr_t" != none; then
181	    AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
182		    [[sizeof (void *) <= sizeof ($tcl_cv_uintptr_t)]])],
183		[tcl_ok=yes], [tcl_ok=no])
184	    test "$tcl_ok" = yes && break; fi
185    done])
186    if test "$tcl_cv_uintptr_t" != none; then
187	AC_DEFINE_UNQUOTED([uintptr_t], [$tcl_cv_uintptr_t], [Unsigned integer
188	   type wide enough to hold a pointer.])
189    fi
190])
191
192#--------------------------------------------------------------------
193# Perform additinal compiler tests.
194#--------------------------------------------------------------------
195
196# See if declarations like FINDEX_INFO_LEVELS are
197# missing from winbase.h. This is known to be
198# a problem with VC++ 5.2.
199
200AC_CACHE_CHECK(for FINDEX_INFO_LEVELS in winbase.h,
201    tcl_cv_findex_enums,
202AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
203#define WIN32_LEAN_AND_MEAN
204#include <windows.h>
205#undef WIN32_LEAN_AND_MEAN
206]], [[
207  FINDEX_INFO_LEVELS i;
208  FINDEX_SEARCH_OPS j;
209]])],
210    [tcl_cv_findex_enums=yes],
211    [tcl_cv_findex_enums=no])
212)
213if test "$tcl_cv_findex_enums" = "no"; then
214    AC_DEFINE(HAVE_NO_FINDEX_ENUMS, 1,
215            [Defined when enums are missing from winbase.h])
216fi
217
218# See if the compiler supports intrinsics.
219
220AC_CACHE_CHECK(for intrinsics support in compiler,
221    tcl_cv_intrinsics,
222AC_LINK_IFELSE([AC_LANG_PROGRAM([[
223#define WIN32_LEAN_AND_MEAN
224#include <windows.h>
225#undef WIN32_LEAN_AND_MEAN
226#include <intrin.h>
227]], [[
228  __cpuidex(0,0,0);
229]])],
230    [tcl_cv_intrinsics=yes],
231    [tcl_cv_intrinsics=no])
232)
233if test "$tcl_cv_intrinsics" = "yes"; then
234    AC_DEFINE(HAVE_INTRIN_H, 1,
235            [Defined when the compilers supports intrinsics])
236fi
237
238# See if the <wspiapi.h> header file is present
239
240AC_CACHE_CHECK(for wspiapi.h,
241    tcl_cv_wspiapi_h,
242AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
243#include <wspiapi.h>
244]], [[]])],
245    [tcl_cv_wspiapi_h=yes],
246    [tcl_cv_wspiapi_h=no])
247)
248if test "$tcl_cv_wspiapi_h" = "yes"; then
249    AC_DEFINE(HAVE_WSPIAPI_H, 1,
250            [Defined when wspiapi.h exists])
251fi
252
253# See if declarations like FINDEX_INFO_LEVELS are
254# missing from winbase.h. This is known to be
255# a problem with VC++ 5.2.
256
257AC_CACHE_CHECK(for FINDEX_INFO_LEVELS in winbase.h,
258    tcl_cv_findex_enums,
259AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
260#define WIN32_LEAN_AND_MEAN
261#include <windows.h>
262#undef WIN32_LEAN_AND_MEAN
263]], [[
264  FINDEX_INFO_LEVELS i;
265  FINDEX_SEARCH_OPS j;
266]])],
267    [tcl_cv_findex_enums=yes],
268    [tcl_cv_findex_enums=no])
269)
270if test "$tcl_cv_findex_enums" = "no"; then
271    AC_DEFINE(HAVE_NO_FINDEX_ENUMS, 1,
272            [Defined when enums are missing from winbase.h])
273fi
274
275#--------------------------------------------------------------------
276# Set the default compiler switches based on the --enable-symbols
277# option.  This macro depends on C flags, and should be called
278# after SC_CONFIG_CFLAGS macro is called.
279#--------------------------------------------------------------------
280
281SC_ENABLE_SYMBOLS
282
283TCL_DBGX=${DBGX}
284
285#--------------------------------------------------------------------
286# Embed the manifest if we can determine how
287#--------------------------------------------------------------------
288
289SC_EMBED_MANIFEST
290
291#------------------------------------------------------------------------
292# tclConfig.sh refers to this by a different name
293#------------------------------------------------------------------------
294
295TCL_SHARED_BUILD=${SHARED_BUILD}
296
297#--------------------------------------------------------------------
298# Perform final evaluations of variables with possible substitutions.
299#--------------------------------------------------------------------
300
301eval "TCL_SRC_DIR=\"`cd $srcdir/..; $CYGPATH $(pwd)`\""
302
303eval "TCL_DLL_FILE=tcl${VER}${DLLSUFFIX}"
304
305eval "TCL_STUB_LIB_FILE=\"${LIBPREFIX}tclstub${VER}${LIBSUFFIX}\""
306eval "TCL_STUB_LIB_FLAG=\"-ltclstub${VER}${LIBFLAGSUFFIX}\""
307eval "TCL_BUILD_STUB_LIB_SPEC=\"-L`$CYGPATH $(pwd)` ${TCL_STUB_LIB_FLAG}\""
308eval "TCL_STUB_LIB_SPEC=\"-L${libdir} ${TCL_STUB_LIB_FLAG}\""
309eval "TCL_BUILD_STUB_LIB_PATH=\"`$CYGPATH $(pwd)`/${TCL_STUB_LIB_FILE}\""
310eval "TCL_STUB_LIB_PATH=\"${libdir}/${TCL_STUB_LIB_FILE}\""
311
312if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then
313 eval "TCL_LIB_FILE=\"${LIBPREFIX}tcl${VER}${LIBSUFFIX}\""
314else
315 eval "TCL_LIB_FILE=\"${LIBPREFIX}tcl${VER}${DLLSUFFIX}.a\""
316fi
317eval "TCL_BUILD_LIB_SPEC=\"-L`$CYGPATH $(pwd)` -ltcl${VER}${FLAGSUFFIX}\""
318eval "TCL_LIB_SPEC=\"-L${libdir} -ltcl${VER}${FLAGSUFFIX}\""
319
320# Install time header dir can be set via --includedir
321eval "TCL_INCLUDE_SPEC=\"-I${includedir}\""
322
323eval "DLLSUFFIX=${DLLSUFFIX}"
324eval "LIBPREFIX=${LIBPREFIX}"
325eval "LIBSUFFIX=${LIBSUFFIX}"
326eval "EXESUFFIX=${EXESUFFIX}"
327
328TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}"
329TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
330TCL_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
331
332CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}
333CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}
334CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}
335
336#--------------------------------------------------------------------
337# Adjust the defines for how the resources are built depending
338# on symbols and static vs. shared.
339#--------------------------------------------------------------------
340
341if test ${SHARED_BUILD} = 0 ; then
342    if test "${DBGX}" = "g"; then
343        RC_DEFINES="${RC_DEFINE} STATIC_BUILD ${RC_DEFINE} DEBUG"
344    else
345        RC_DEFINES="${RC_DEFINE} STATIC_BUILD"
346    fi
347else
348    if test "${DBGX}" = "g"; then
349        RC_DEFINES="${RC_DEFINE} DEBUG"
350    else
351        RC_DEFINES=""
352    fi
353fi
354
355#--------------------------------------------------------------------
356#	The statements below define the symbol TCL_PACKAGE_PATH, which
357#	gives a list of directories that may contain packages.  The list
358#	consists of one directory for machine-dependent binaries and
359#	another for platform-independent scripts.
360#--------------------------------------------------------------------
361
362if test "$prefix/lib" != "$libdir"; then
363    TCL_PACKAGE_PATH="{${libdir}} {${prefix}/lib}"
364else
365    TCL_PACKAGE_PATH="{${prefix}/lib}"
366fi
367
368# The tclsh.exe.manifest requires these
369# TCL_WIN_VERSION is the 4 dotted pair Windows version format which needs
370# the release level, and must account for interim release versioning
371case "$TCL_PATCH_LEVEL" in
372     *a*) TCL_RELEASE_LEVEL=0 ;;
373     *b*) TCL_RELEASE_LEVEL=1 ;;
374     *)   TCL_RELEASE_LEVEL=2 ;;
375esac
376TCL_WIN_VERSION="$TCL_VERSION.$TCL_RELEASE_LEVEL.`echo $TCL_PATCH_LEVEL | tr -d ab.`"
377AC_SUBST(TCL_WIN_VERSION)
378# X86|AMD64|IA64 for manifest
379AC_SUBST(MACHINE)
380
381AC_SUBST(TCL_VERSION)
382AC_SUBST(TCL_MAJOR_VERSION)
383AC_SUBST(TCL_MINOR_VERSION)
384AC_SUBST(TCL_PATCH_LEVEL)
385AC_SUBST(PKG_CFG_ARGS)
386AC_SUBST(TCL_EXE)
387
388AC_SUBST(TCL_LIB_FILE)
389AC_SUBST(TCL_LIB_FLAG)
390AC_SUBST(TCL_STATIC_LIB_FILE)
391AC_SUBST(TCL_STATIC_LIB_FLAG)
392AC_SUBST(TCL_IMPORT_LIB_FILE)
393AC_SUBST(TCL_IMPORT_LIB_FLAG)
394# empty on win
395AC_SUBST(TCL_LIB_SPEC)
396AC_SUBST(TCL_STUB_LIB_FILE)
397AC_SUBST(TCL_STUB_LIB_FLAG)
398AC_SUBST(TCL_STUB_LIB_SPEC)
399AC_SUBST(TCL_STUB_LIB_PATH)
400AC_SUBST(TCL_INCLUDE_SPEC)
401AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
402AC_SUBST(TCL_BUILD_STUB_LIB_PATH)
403AC_SUBST(TCL_DLL_FILE)
404
405AC_SUBST(TCL_SRC_DIR)
406AC_SUBST(TCL_BIN_DIR)
407AC_SUBST(TCL_DBGX)
408AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX)
409AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX)
410AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX)
411
412# win/tcl.m4 doesn't set (CFLAGS)
413AC_SUBST(CFLAGS_DEFAULT)
414AC_SUBST(EXTRA_CFLAGS)
415AC_SUBST(CYGPATH)
416AC_SUBST(DEPARG)
417AC_SUBST(CC_OBJNAME)
418AC_SUBST(CC_EXENAME)
419
420# win/tcl.m4 doesn't set (LDFLAGS)
421AC_SUBST(LDFLAGS_DEFAULT)
422AC_SUBST(LDFLAGS_DEBUG)
423AC_SUBST(LDFLAGS_OPTIMIZE)
424AC_SUBST(LDFLAGS_CONSOLE)
425AC_SUBST(LDFLAGS_WINDOW)
426AC_SUBST(AR)
427AC_SUBST(RANLIB)
428
429AC_SUBST(STLIB_LD)
430AC_SUBST(SHLIB_LD)
431AC_SUBST(SHLIB_LD_LIBS)
432AC_SUBST(SHLIB_CFLAGS)
433AC_SUBST(SHLIB_SUFFIX)
434AC_SUBST(TCL_SHARED_BUILD)
435
436AC_SUBST(LIBS)
437AC_SUBST(LIBS_GUI)
438AC_SUBST(DLLSUFFIX)
439AC_SUBST(LIBPREFIX)
440AC_SUBST(LIBSUFFIX)
441AC_SUBST(EXESUFFIX)
442AC_SUBST(LIBRARIES)
443AC_SUBST(MAKE_LIB)
444AC_SUBST(MAKE_STUB_LIB)
445AC_SUBST(POST_MAKE_LIB)
446AC_SUBST(MAKE_DLL)
447AC_SUBST(MAKE_EXE)
448
449# empty on win, but needs sub'ing
450AC_SUBST(TCL_BUILD_LIB_SPEC)
451AC_SUBST(TCL_CC_SEARCH_FLAGS)
452AC_SUBST(TCL_LD_SEARCH_FLAGS)
453AC_SUBST(TCL_NEEDS_EXP_FILE)
454AC_SUBST(TCL_BUILD_EXP_FILE)
455AC_SUBST(TCL_EXP_FILE)
456AC_SUBST(DL_LIBS)
457AC_SUBST(TCL_LIB_VERSIONS_OK)
458AC_SUBST(TCL_PACKAGE_PATH)
459
460# win only
461AC_SUBST(TCL_DDE_VERSION)
462AC_SUBST(TCL_DDE_MAJOR_VERSION)
463AC_SUBST(TCL_DDE_MINOR_VERSION)
464AC_SUBST(TCL_REG_VERSION)
465AC_SUBST(TCL_REG_MAJOR_VERSION)
466AC_SUBST(TCL_REG_MINOR_VERSION)
467
468AC_SUBST(RC)
469AC_SUBST(RC_OUT)
470AC_SUBST(RC_TYPE)
471AC_SUBST(RC_INCLUDE)
472AC_SUBST(RC_DEFINE)
473AC_SUBST(RC_DEFINES)
474AC_SUBST(RES)
475
476AC_CONFIG_FILES(Makefile tclConfig.sh tcl.hpj tclsh.exe.manifest)
477AC_OUTPUT
478
479dnl Local Variables:
480dnl mode: autoconf
481dnl End:
482