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# 6# RCS: @(#) $Id: configure.in,v 1.104.2.11 2010/08/27 00:09:30 hobbs Exp $ 7 8AC_INIT(../generic/tcl.h) 9AC_PREREQ(2.59) 10 11# The following define is needed when building with Cygwin since newer 12# versions of autoconf incorrectly set SHELL to /bin/bash instead of 13# /bin/sh. The bash shell seems to suffer from some strange failures. 14SHELL=/bin/sh 15 16TCL_VERSION=8.5 17TCL_MAJOR_VERSION=8 18TCL_MINOR_VERSION=5 19TCL_PATCH_LEVEL=".9" 20VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION 21 22TCL_DDE_VERSION=1.3 23TCL_DDE_MAJOR_VERSION=1 24TCL_DDE_MINOR_VERSION=3 25TCL_DDE_PATCH_LEVEL="2" 26DDEVER=$TCL_DDE_MAJOR_VERSION$TCL_DDE_MINOR_VERSION 27 28TCL_REG_VERSION=1.2 29TCL_REG_MAJOR_VERSION=1 30TCL_REG_MINOR_VERSION=2 31TCL_REG_PATCH_LEVEL="1" 32REGVER=$TCL_REG_MAJOR_VERSION$TCL_REG_MINOR_VERSION 33 34#------------------------------------------------------------------------ 35# Handle the --prefix=... option 36#------------------------------------------------------------------------ 37 38if test "${prefix}" = "NONE"; then 39 prefix=/usr/local 40fi 41if test "${exec_prefix}" = "NONE"; then 42 exec_prefix=$prefix 43fi 44# libdir must be a fully qualified path (not ${exec_prefix}/lib) 45eval libdir="$libdir" 46 47#------------------------------------------------------------------------ 48# Standard compiler checks 49#------------------------------------------------------------------------ 50 51# If the user did not set CFLAGS, set it now to keep 52# the AC_PROG_CC macro from adding "-g -O2". 53if test "${CFLAGS+set}" != "set" ; then 54 CFLAGS="" 55fi 56 57AC_PROG_CC 58AC_C_INLINE 59AC_HEADER_STDC 60 61# To properly support cross-compilation, one would 62# need to use these tool checks instead of 63# the ones below and reconfigure with 64# autoconf 2.50. You can also just set 65# the CC, AR, RANLIB, and RC environment 66# variables if you want to cross compile. 67dnl AC_CHECK_TOOL(AR, ar) 68dnl AC_CHECK_TOOL(RANLIB, ranlib) 69dnl AC_CHECK_TOOL(RC, windres) 70 71if test "${GCC}" = "yes" ; then 72 AC_CHECK_PROG(AR, ar, ar) 73 AC_CHECK_PROG(RANLIB, ranlib, ranlib) 74 AC_CHECK_PROG(RC, windres, windres) 75 76 if test "${AR}" = "" ; then 77 AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.]) 78 fi 79 if test "${RANLIB}" = "" ; then 80 AC_MSG_ERROR([Required archive index tool 'ranlib' not found on PATH.]) 81 fi 82 if test "${RC}" = "" ; then 83 AC_MSG_ERROR([Required resource tool 'windres' not found on PATH.]) 84 fi 85fi 86 87#-------------------------------------------------------------------- 88# Checks to see if the make program sets the $MAKE variable. 89#-------------------------------------------------------------------- 90 91AC_PROG_MAKE_SET 92 93#-------------------------------------------------------------------- 94# Perform additinal compiler tests. 95#-------------------------------------------------------------------- 96 97dnl Currently AC_CYGWIN is disabled since it invokes AC_CANONICAL_HOST 98dnl under autoconf 2.5X. 99dnl 100dnl AC_CYGWIN 101 102AC_CACHE_CHECK(for Cygwin version of gcc, 103 ac_cv_cygwin, 104AC_TRY_COMPILE([ 105#ifdef __CYGWIN__ 106#error cygwin 107#endif 108], 109[], 110 ac_cv_cygwin=no, 111 ac_cv_cygwin=yes) 112) 113if test "$ac_cv_cygwin" = "yes" ; then 114 AC_MSG_ERROR([Compiling under Cygwin is not currently supported. 115A maintainer for the Cygwin port of Tcl/Tk is needed. See the README 116file for information about building with Mingw.]) 117fi 118 119 120AC_CACHE_CHECK(for SEH support in compiler, 121 tcl_cv_seh, 122AC_TRY_RUN([ 123#define WIN32_LEAN_AND_MEAN 124#include <windows.h> 125#undef WIN32_LEAN_AND_MEAN 126 127int main(int argc, char** argv) { 128 int a, b = 0; 129 __try { 130 a = 666 / b; 131 } 132 __except (EXCEPTION_EXECUTE_HANDLER) { 133 return 0; 134 } 135 return 1; 136} 137], 138 tcl_cv_seh=yes, 139 tcl_cv_seh=no, 140 tcl_cv_seh=no) 141) 142if test "$tcl_cv_seh" = "no" ; then 143 AC_DEFINE(HAVE_NO_SEH, 1, 144 [Defined when mingw does not support SEH]) 145fi 146 147# 148# Check to see if the excpt.h include file provided contains the 149# definition for EXCEPTION_DISPOSITION; if not, which is the case 150# with Cygwin's version as of 2002-04-10, define it to be int, 151# sufficient for getting the current code to work. 152# 153AC_CACHE_CHECK(for EXCEPTION_DISPOSITION support in include files, 154 tcl_cv_eh_disposition, 155AC_TRY_COMPILE([ 156#define WIN32_LEAN_AND_MEAN 157#include <windows.h> 158#undef WIN32_LEAN_AND_MEAN 159], 160[ 161 EXCEPTION_DISPOSITION x; 162], 163 tcl_cv_eh_disposition=yes, 164 tcl_cv_eh_disposition=no) 165) 166if test "$tcl_cv_eh_disposition" = "no" ; then 167 AC_DEFINE(EXCEPTION_DISPOSITION, int, 168 [Defined when cygwin/mingw does not support EXCEPTION DISPOSITION]) 169fi 170 171 172# Check to see if the winsock2.h include file provided contains 173# typedefs like LPFN_ACCEPT and friends. 174# 175AC_CACHE_CHECK(for LPFN_ACCEPT support in winsock2.h, 176 tcl_cv_lpfn_decls, 177AC_TRY_COMPILE([ 178#define WIN32_LEAN_AND_MEAN 179#include <windows.h> 180#undef WIN32_LEAN_AND_MEAN 181#include <winsock2.h> 182], 183[ 184 LPFN_ACCEPT accept; 185], 186 tcl_cv_lpfn_decls=yes, 187 tcl_cv_lpfn_decls=no) 188) 189if test "$tcl_cv_lpfn_decls" = "no" ; then 190 AC_DEFINE(HAVE_NO_LPFN_DECLS, 1, 191 [Defined when cygwin/mingw does not support LPFN_ACCEPT and friends.]) 192fi 193 194# Check to see if winnt.h defines CHAR, SHORT, and LONG 195# even if VOID has already been #defined. The win32api 196# used by mingw and cygwin is known to do this. 197 198AC_CACHE_CHECK(for winnt.h that ignores VOID define, 199 tcl_cv_winnt_ignore_void, 200AC_TRY_COMPILE([ 201#define VOID void 202#define WIN32_LEAN_AND_MEAN 203#include <windows.h> 204#undef WIN32_LEAN_AND_MEAN 205], 206[ 207 CHAR c; 208 SHORT s; 209 LONG l; 210], 211 tcl_cv_winnt_ignore_void=yes, 212 tcl_cv_winnt_ignore_void=no) 213) 214if test "$tcl_cv_winnt_ignore_void" = "yes" ; then 215 AC_DEFINE(HAVE_WINNT_IGNORE_VOID, 1, 216 [Defined when cygwin/mingw ignores VOID define in winnt.h]) 217fi 218 219# Check to see if malloc.h is missing the alloca function 220# declaration. This is known to be a problem with Mingw. 221# If we compiled without the function declaration, it 222# would work but we would get a warning message from gcc. 223# If we add the function declaration ourselves, it 224# would not compile correctly because the _alloca 225# function expects the argument to be passed in a 226# register and not on the stack. Instead, we just 227# call it from inline asm code. 228 229AC_CACHE_CHECK(for alloca declaration in malloc.h, 230 tcl_cv_malloc_decl_alloca, 231AC_TRY_COMPILE([ 232#include <malloc.h> 233], 234[ 235 size_t arg = 0; 236 void* ptr; 237 ptr = alloca; 238 ptr = alloca(arg); 239], 240 tcl_cv_malloc_decl_alloca=yes, 241 tcl_cv_malloc_decl_alloca=no) 242) 243if test "$tcl_cv_malloc_decl_alloca" = "no" && 244 test "${GCC}" = "yes" ; then 245 AC_DEFINE(HAVE_ALLOCA_GCC_INLINE, 1, 246 [Defined when gcc should use inline ASM to call alloca.]) 247fi 248 249# See if the compiler supports casting to a union type. 250# This is used to stop gcc from printing a compiler 251# warning when initializing a union member. 252 253AC_CACHE_CHECK(for cast to union support, 254 tcl_cv_cast_to_union, 255AC_TRY_COMPILE([], 256[ 257 union foo { int i; double d; }; 258 union foo f = (union foo) (int) 0; 259], 260 tcl_cv_cast_to_union=yes, 261 tcl_cv_cast_to_union=no) 262) 263if test "$tcl_cv_cast_to_union" = "yes"; then 264 AC_DEFINE(HAVE_CAST_TO_UNION, 1, 265 [Defined when compiler supports casting to union type.]) 266fi 267 268 269# See if declarations like FINDEX_INFO_LEVELS are 270# missing from winbase.h. This is known to be 271# a problem with VC++ 5.2. 272 273AC_CACHE_CHECK(for FINDEX_INFO_LEVELS in winbase.h, 274 tcl_cv_findex_enums, 275AC_TRY_COMPILE([ 276#define WIN32_LEAN_AND_MEAN 277#include <windows.h> 278#undef WIN32_LEAN_AND_MEAN 279], 280[ 281 FINDEX_INFO_LEVELS i; 282 FINDEX_SEARCH_OPS j; 283], 284 tcl_cv_findex_enums=yes, 285 tcl_cv_findex_enums=no) 286) 287if test "$tcl_cv_findex_enums" = "no"; then 288 AC_DEFINE(HAVE_NO_FINDEX_ENUMS, 1, 289 [Defined when enums are missing from winbase.h]) 290fi 291 292# See if MWMO_ALERTABLE is missing from winuser.h 293# This is known to be a problem with Mingw. 294 295AC_CACHE_CHECK(for MWMO_ALERTABLE in winuser.h, 296 tcl_cv_mwmo_alertable, 297AC_TRY_COMPILE([ 298#define WIN32_LEAN_AND_MEAN 299#include <windows.h> 300#undef WIN32_LEAN_AND_MEAN 301], 302[ 303 int i = MWMO_ALERTABLE; 304], 305 tcl_cv_mwmo_alertable=yes, 306 tcl_cv_mwmo_alertable=no) 307) 308if test "$tcl_cv_mwmo_alertable" = "no"; then 309 AC_DEFINE(HAVE_NO_MWMO_ALERTABLE, 1, 310 [Defined when MWMO_ALERTABLE is missing from winuser.h]) 311fi 312 313#-------------------------------------------------------------------- 314# Determines the correct binary file extension (.o, .obj, .exe etc.) 315#-------------------------------------------------------------------- 316 317AC_OBJEXT 318AC_EXEEXT 319 320#-------------------------------------------------------------------- 321# Check whether --enable-threads or --disable-threads was given. 322#-------------------------------------------------------------------- 323 324SC_ENABLE_THREADS 325 326#------------------------------------------------------------------------ 327# Embedded configuration information, encoding to use for the values, TIP #59 328#------------------------------------------------------------------------ 329 330SC_TCL_CFG_ENCODING 331 332#-------------------------------------------------------------------- 333# The statements below define a collection of symbols related to 334# building libtcl as a shared library instead of a static library. 335#-------------------------------------------------------------------- 336 337SC_ENABLE_SHARED 338 339#-------------------------------------------------------------------- 340# The statements below define a collection of compile flags. This 341# macro depends on the value of SHARED_BUILD, and should be called 342# after SC_ENABLE_SHARED checks the configure switches. 343#-------------------------------------------------------------------- 344 345SC_CONFIG_CFLAGS 346 347#-------------------------------------------------------------------- 348# Set the default compiler switches based on the --enable-symbols 349# option. This macro depends on C flags, and should be called 350# after SC_CONFIG_CFLAGS macro is called. 351#-------------------------------------------------------------------- 352 353SC_ENABLE_SYMBOLS 354 355TCL_DBGX=${DBGX} 356 357#-------------------------------------------------------------------- 358# Embed the manifest if we can determine how 359#-------------------------------------------------------------------- 360 361SC_EMBED_MANIFEST 362 363#------------------------------------------------------------------------ 364# tclConfig.sh refers to this by a different name 365#------------------------------------------------------------------------ 366 367TCL_SHARED_BUILD=${SHARED_BUILD} 368 369#-------------------------------------------------------------------- 370# Perform final evaluations of variables with possible substitutions. 371#-------------------------------------------------------------------- 372 373TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}" 374TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" 375TCL_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" 376 377eval "TCL_SRC_DIR=\"`cd $srcdir/..; pwd`\"" 378 379eval "TCL_DLL_FILE=tcl${VER}${DLLSUFFIX}" 380 381eval "TCL_LIB_FILE=${LIBPREFIX}tcl$VER${LIBSUFFIX}" 382 383eval "TCL_LIB_FLAG=\"-ltcl${VER}${LIBFLAGSUFFIX}\"" 384eval "TCL_BUILD_LIB_SPEC=\"-L`pwd` ${TCL_LIB_FLAG}\"" 385eval "TCL_LIB_SPEC=\"-L${libdir} ${TCL_LIB_FLAG}\"" 386 387eval "TCL_STUB_LIB_FILE=\"${LIBPREFIX}tclstub${VER}${LIBSUFFIX}\"" 388eval "TCL_STUB_LIB_FLAG=\"-ltclstub${VER}${LIBFLAGSUFFIX}\"" 389eval "TCL_BUILD_STUB_LIB_SPEC=\"-L`pwd` ${TCL_STUB_LIB_FLAG}\"" 390eval "TCL_STUB_LIB_SPEC=\"-L${libdir} ${TCL_STUB_LIB_FLAG}\"" 391eval "TCL_BUILD_STUB_LIB_PATH=\"`pwd`/${TCL_STUB_LIB_FILE}\"" 392eval "TCL_STUB_LIB_PATH=\"${libdir}/${TCL_STUB_LIB_FILE}\"" 393 394# Install time header dir can be set via --includedir 395eval "TCL_INCLUDE_SPEC=\"-I${includedir}\"" 396 397 398eval "DLLSUFFIX=${DLLSUFFIX}" 399eval "LIBPREFIX=${LIBPREFIX}" 400eval "LIBSUFFIX=${LIBSUFFIX}" 401eval "EXESUFFIX=${EXESUFFIX}" 402 403CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX} 404CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX} 405CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX} 406 407#-------------------------------------------------------------------- 408# Adjust the defines for how the resources are built depending 409# on symbols and static vs. shared. 410#-------------------------------------------------------------------- 411 412if test ${SHARED_BUILD} = 0 ; then 413 if test "${DBGX}" = "g"; then 414 RC_DEFINES="${RC_DEFINE} STATIC_BUILD ${RC_DEFINE} DEBUG" 415 else 416 RC_DEFINES="${RC_DEFINE} STATIC_BUILD" 417 fi 418else 419 if test "${DBGX}" = "g"; then 420 RC_DEFINES="${RC_DEFINE} DEBUG" 421 else 422 RC_DEFINES="" 423 fi 424fi 425 426#-------------------------------------------------------------------- 427# The statements below define the symbol TCL_PACKAGE_PATH, which 428# gives a list of directories that may contain packages. The list 429# consists of one directory for machine-dependent binaries and 430# another for platform-independent scripts. 431#-------------------------------------------------------------------- 432 433if test "$prefix/lib" != "$libdir"; then 434 TCL_PACKAGE_PATH="${libdir} ${prefix}/lib" 435else 436 TCL_PACKAGE_PATH="${prefix}/lib" 437fi 438 439AC_SUBST(TCL_VERSION) 440AC_SUBST(TCL_MAJOR_VERSION) 441AC_SUBST(TCL_MINOR_VERSION) 442AC_SUBST(TCL_PATCH_LEVEL) 443 444AC_SUBST(TCL_LIB_FILE) 445AC_SUBST(TCL_LIB_FLAG) 446# empty on win 447AC_SUBST(TCL_LIB_SPEC) 448AC_SUBST(TCL_STUB_LIB_FILE) 449AC_SUBST(TCL_STUB_LIB_FLAG) 450AC_SUBST(TCL_STUB_LIB_SPEC) 451AC_SUBST(TCL_STUB_LIB_PATH) 452AC_SUBST(TCL_INCLUDE_SPEC) 453AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) 454AC_SUBST(TCL_BUILD_STUB_LIB_PATH) 455AC_SUBST(TCL_DLL_FILE) 456 457AC_SUBST(TCL_SRC_DIR) 458AC_SUBST(TCL_BIN_DIR) 459AC_SUBST(TCL_DBGX) 460AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX) 461AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX) 462AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX) 463 464# win/tcl.m4 doesn't set (CFLAGS) 465AC_SUBST(CFLAGS_DEFAULT) 466AC_SUBST(EXTRA_CFLAGS) 467AC_SUBST(CYGPATH) 468AC_SUBST(DEPARG) 469AC_SUBST(CC_OBJNAME) 470AC_SUBST(CC_EXENAME) 471 472# win/tcl.m4 doesn't set (LDFLAGS) 473AC_SUBST(LDFLAGS_DEFAULT) 474AC_SUBST(LDFLAGS_DEBUG) 475AC_SUBST(LDFLAGS_OPTIMIZE) 476AC_SUBST(LDFLAGS_CONSOLE) 477AC_SUBST(LDFLAGS_WINDOW) 478AC_SUBST(AR) 479AC_SUBST(RANLIB) 480 481AC_SUBST(STLIB_LD) 482AC_SUBST(SHLIB_LD) 483AC_SUBST(SHLIB_LD_LIBS) 484AC_SUBST(SHLIB_CFLAGS) 485AC_SUBST(SHLIB_SUFFIX) 486AC_SUBST(TCL_SHARED_BUILD) 487 488AC_SUBST(LIBS) 489AC_SUBST(LIBS_GUI) 490AC_SUBST(DLLSUFFIX) 491AC_SUBST(LIBPREFIX) 492AC_SUBST(LIBSUFFIX) 493AC_SUBST(EXESUFFIX) 494AC_SUBST(LIBRARIES) 495AC_SUBST(MAKE_LIB) 496AC_SUBST(POST_MAKE_LIB) 497AC_SUBST(MAKE_DLL) 498AC_SUBST(MAKE_EXE) 499 500# empty on win, but needs sub'ing 501AC_SUBST(TCL_BUILD_LIB_SPEC) 502AC_SUBST(TCL_LD_SEARCH_FLAGS) 503AC_SUBST(TCL_NEEDS_EXP_FILE) 504AC_SUBST(TCL_BUILD_EXP_FILE) 505AC_SUBST(TCL_EXP_FILE) 506AC_SUBST(DL_LIBS) 507AC_SUBST(TCL_LIB_VERSIONS_OK) 508AC_SUBST(TCL_PACKAGE_PATH) 509 510# win only 511AC_SUBST(TCL_DDE_VERSION) 512AC_SUBST(TCL_DDE_MAJOR_VERSION) 513AC_SUBST(TCL_DDE_MINOR_VERSION) 514AC_SUBST(TCL_DDE_PATCH_LEVEL) 515AC_SUBST(TCL_REG_VERSION) 516AC_SUBST(TCL_REG_MAJOR_VERSION) 517AC_SUBST(TCL_REG_MINOR_VERSION) 518AC_SUBST(TCL_REG_PATCH_LEVEL) 519 520AC_SUBST(RC) 521AC_SUBST(RC_OUT) 522AC_SUBST(RC_TYPE) 523AC_SUBST(RC_INCLUDE) 524AC_SUBST(RC_DEFINE) 525AC_SUBST(RC_DEFINES) 526AC_SUBST(RES) 527 528AC_OUTPUT(Makefile tclConfig.sh tcl.hpj) 529