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