1dnl This file is an input file used by the GNU "autoconf" program to 2dnl generate the file "configure", which is run during Tcl installation 3dnl to configure the system for the local environment. 4AC_INIT(../generic/tcl.h) 5# SCCS: @(#) configure.in 1.130 96/12/19 11:53:49 6 7TCL_VERSION=8.0 8TCL_MAJOR_VERSION=8 9TCL_MINOR_VERSION=0 10TCL_PATCH_LEVEL=a1 11VERSION=${TCL_VERSION} 12 13if test "${prefix}" = "NONE"; then 14 prefix=/usr/local 15fi 16if test "${exec_prefix}" = "NONE"; then 17 exec_prefix=$prefix 18fi 19TCL_SRC_DIR=`cd $srcdir/..; pwd` 20 21AC_PROG_RANLIB 22AC_ARG_ENABLE(gcc, [ --enable-gcc allow use of gcc if available], 23 [tcl_ok=$enableval], [tcl_ok=no]) 24if test "$tcl_ok" = "yes"; then 25 AC_PROG_CC 26else 27 CC=${CC-cc} 28AC_SUBST(CC) 29fi 30AC_C_CROSS 31 32#-------------------------------------------------------------------- 33# Supply substitutes for missing POSIX library procedures, or 34# set flags so Tcl uses alternate procedures. 35#-------------------------------------------------------------------- 36 37AC_REPLACE_FUNCS(getcwd opendir strstr) 38AC_REPLACE_FUNCS(strtol tmpnam waitpid) 39AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR)) 40AC_CHECK_FUNC(getwd, , AC_DEFINE(NO_GETWD)) 41AC_CHECK_FUNC(wait3, , AC_DEFINE(NO_WAIT3)) 42AC_CHECK_FUNC(uname, , AC_DEFINE(NO_UNAME)) 43 44#-------------------------------------------------------------------- 45# On a few very rare systems, all of the libm.a stuff is 46# already in libc.a. Set compiler flags accordingly. 47# Also, Linux requires the "ieee" library for math to work 48# right (and it must appear before "-lm"). 49#-------------------------------------------------------------------- 50 51AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm") 52AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"]) 53 54#-------------------------------------------------------------------- 55# Supply substitutes for missing POSIX header files. Special 56# notes: 57# - stdlib.h doesn't define strtol, strtoul, or 58# strtod insome versions of SunOS 59# - some versions of string.h don't declare procedures such 60# as strstr 61#-------------------------------------------------------------------- 62 63AC_MSG_CHECKING(dirent.h) 64AC_TRY_LINK([#include <sys/types.h> 65#include <dirent.h>], [ 66#ifndef _POSIX_SOURCE 67# ifdef __Lynx__ 68 /* 69 * Generate compilation error to make the test fail: Lynx headers 70 * are only valid if really in the POSIX environment. 71 */ 72 73 missing_procedure(); 74# endif 75#endif 76DIR *d; 77struct dirent *entryPtr; 78char *p; 79d = opendir("foobar"); 80entryPtr = readdir(d); 81p = entryPtr->d_name; 82closedir(d); 83], tcl_ok=yes, tcl_ok=no) 84if test $tcl_ok = no; then 85 AC_DEFINE(NO_DIRENT_H) 86fi 87AC_MSG_RESULT($tcl_ok) 88AC_CHECK_HEADER(errno.h, , AC_DEFINE(NO_ERRNO_H)) 89AC_CHECK_HEADER(float.h, , AC_DEFINE(NO_FLOAT_H)) 90AC_CHECK_HEADER(limits.h, , AC_DEFINE(NO_LIMITS_H)) 91AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) 92AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) 93AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) 94AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0) 95if test $tcl_ok = 0; then 96 AC_DEFINE(NO_STDLIB_H) 97fi 98AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0) 99AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0) 100AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0) 101if test $tcl_ok = 0; then 102 AC_DEFINE(NO_STRING_H) 103fi 104AC_CHECK_HEADER(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H)) 105AC_CHECK_HEADER(dlfcn.h, , AC_DEFINE(NO_DLFCN_H)) 106AC_HAVE_HEADERS(unistd.h) 107 108#-------------------------------------------------------------------- 109# Include sys/select.h if it exists and if it supplies things 110# that appear to be useful and aren't already in sys/types.h. 111# This appears to be true only on the RS/6000 under AIX. Some 112# systems like OSF/1 have a sys/select.h that's of no use, and 113# other systems like SCO UNIX have a sys/select.h that's 114# pernicious. If "fd_set" isn't defined anywhere then set a 115# special flag. 116#-------------------------------------------------------------------- 117 118AC_MSG_CHECKING([fd_set and sys/select]) 119AC_TRY_COMPILE([#include <sys/types.h>], 120 [fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no) 121if test $tk_ok = no; then 122 AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes) 123 if test $tk_ok = yes; then 124 AC_DEFINE(HAVE_SYS_SELECT_H) 125 fi 126fi 127AC_MSG_RESULT($tk_ok) 128if test $tk_ok = no; then 129 AC_DEFINE(NO_FD_SET) 130fi 131 132#------------------------------------------------------------------------------ 133# Find out all about time handling differences. 134#------------------------------------------------------------------------------ 135 136AC_CHECK_HEADERS(sys/time.h) 137AC_HEADER_TIME 138AC_STRUCT_TIMEZONE 139 140AC_MSG_CHECKING([tm_tzadj in struct tm]) 141AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;], 142 [AC_DEFINE(HAVE_TM_TZADJ) 143 AC_MSG_RESULT(yes)], 144 AC_MSG_RESULT(no)) 145 146AC_MSG_CHECKING([tm_gmtoff in struct tm]) 147AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;], 148 [AC_DEFINE(HAVE_TM_GMTOFF) 149 AC_MSG_RESULT(yes)], 150 AC_MSG_RESULT(no)) 151 152# 153# Its important to include time.h in this check, as some systems (like convex) 154# have timezone functions, etc. 155# 156have_timezone=no 157AC_MSG_CHECKING([long timezone variable]) 158AC_TRY_COMPILE([#include <time.h>], 159 [extern long timezone; 160 timezone += 1; 161 exit (0);], 162 [have_timezone=yes 163 AC_DEFINE(HAVE_TIMEZONE_VAR) 164 AC_MSG_RESULT(yes)], 165 AC_MSG_RESULT(no)) 166 167# 168# On some systems (eg IRIX 6.2), timezone is a time_t and not a long. 169# 170if test "$have_timezone" = no; then 171 AC_MSG_CHECKING([time_t timezone variable]) 172 AC_TRY_COMPILE([#include <time.h>], 173 [extern time_t timezone; 174 timezone += 1; 175 exit (0);], 176 [AC_DEFINE(HAVE_TIMEZONE_VAR) 177 AC_MSG_RESULT(yes)], 178 AC_MSG_RESULT(no)) 179fi 180 181#-------------------------------------------------------------------- 182# On some systems strstr is broken: it returns a pointer even 183# even if the original string is empty. 184#-------------------------------------------------------------------- 185 186AC_MSG_CHECKING([proper strstr implementation]) 187AC_TRY_RUN([ 188extern int strstr(); 189int main() 190{ 191 exit(strstr("\0test", "test") ? 1 : 0); 192} 193], tcl_ok=yes, tcl_ok=no, tcl_ok=no) 194if test $tcl_ok = yes; then 195 AC_MSG_RESULT(yes) 196else 197 AC_MSG_RESULT([broken, using substitute]) 198 LIBOBJS="$LIBOBJS strstr.o" 199fi 200 201#-------------------------------------------------------------------- 202# Check for strtoul function. This is tricky because under some 203# versions of AIX strtoul returns an incorrect terminator 204# pointer for the string "0". 205#-------------------------------------------------------------------- 206 207AC_CHECK_FUNC(strtoul, tcl_ok=1, tcl_ok=0) 208AC_TRY_RUN([ 209extern int strtoul(); 210int main() 211{ 212 char *string = "0"; 213 char *term; 214 int value; 215 value = strtoul(string, &term, 0); 216 if ((value != 0) || (term != (string+1))) { 217 exit(1); 218 } 219 exit(0); 220}], , tcl_ok=0, tcl_ok=0) 221if test "$tcl_ok" = 0; then 222 test -n "$verbose" && echo " Adding strtoul.o." 223 LIBOBJS="$LIBOBJS strtoul.o" 224fi 225 226#-------------------------------------------------------------------- 227# Check for the strtod function. This is tricky because in some 228# versions of Linux strtod mis-parses strings starting with "+". 229#-------------------------------------------------------------------- 230 231AC_CHECK_FUNC(strtod, tcl_ok=1, tcl_ok=0) 232AC_TRY_RUN([ 233extern double strtod(); 234int main() 235{ 236 char *string = " +69"; 237 char *term; 238 double value; 239 value = strtod(string, &term); 240 if ((value != 69) || (term != (string+4))) { 241 exit(1); 242 } 243 exit(0); 244}], , tcl_ok=0, tcl_ok=0) 245if test "$tcl_ok" = 0; then 246 test -n "$verbose" && echo " Adding strtod.o." 247 LIBOBJS="$LIBOBJS strtod.o" 248fi 249 250#-------------------------------------------------------------------- 251# Under Solaris 2.4, strtod returns the wrong value for the 252# terminating character under some conditions. Check for this 253# and if the problem exists use a substitute procedure 254# "fixstrtod" that corrects the error. 255#-------------------------------------------------------------------- 256 257AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0) 258if test "$tcl_strtod" = 1; then 259 AC_MSG_CHECKING([for Solaris strtod bug]) 260 AC_TRY_RUN([ 261 extern double strtod(); 262 int main() 263 { 264 char *string = "NaN"; 265 char *term; 266 strtod(string, &term); 267 if ((term != string) && (term[-1] == 0)) { 268 exit(1); 269 } 270 exit(0); 271 }], tcl_ok=1, tcl_ok=0, tcl_ok=0) 272 if test $tcl_ok = 1; then 273 AC_MSG_RESULT(ok) 274 else 275 AC_MSG_RESULT(buggy) 276 LIBOBJS="$LIBOBJS fixstrtod.o" 277 AC_DEFINE(strtod, fixstrtod) 278 fi 279fi 280 281#-------------------------------------------------------------------- 282# Check for various typedefs and provide substitutes if 283# they don't exist. 284#-------------------------------------------------------------------- 285 286AC_TYPE_MODE_T 287AC_TYPE_PID_T 288AC_TYPE_SIZE_T 289AC_TYPE_UID_T 290AC_C_BIGENDIAN 291 292#-------------------------------------------------------------------- 293# If a system doesn't have an opendir function (man, that's old!) 294# then we have to supply a different version of dirent.h which 295# is compatible with the substitute version of opendir that's 296# provided. This version only works with V7-style directories. 297#-------------------------------------------------------------------- 298 299AC_CHECK_FUNC(opendir, , AC_DEFINE(USE_DIRENT2_H)) 300 301#-------------------------------------------------------------------- 302# The check below checks whether <sys/wait.h> defines the type 303# "union wait" correctly. It's needed because of weirdness in 304# HP-UX where "union wait" is defined in both the BSD and SYS-V 305# environments. Checking the usability of WIFEXITED seems to do 306# the trick. 307#-------------------------------------------------------------------- 308 309AC_MSG_CHECKING([union wait]) 310AC_TRY_LINK([#include <sys/types.h> 311#include <sys/wait.h>], [ 312union wait x; 313WIFEXITED(x); /* Generates compiler error if WIFEXITED 314 * uses an int. */ 315], tcl_ok=yes, tcl_ok=no) 316AC_MSG_RESULT($tcl_ok) 317if test $tcl_ok = no; then 318 AC_DEFINE(NO_UNION_WAIT) 319fi 320 321#-------------------------------------------------------------------- 322# Check to see whether the system supports the matherr function 323# and its associated type "struct exception". 324#-------------------------------------------------------------------- 325 326AC_MSG_CHECKING([matherr support]) 327AC_TRY_COMPILE([#include <math.h>], [ 328struct exception x; 329x.type = DOMAIN; 330x.type = SING; 331], tcl_ok=yes, tcl_ok=no) 332AC_MSG_RESULT($tcl_ok) 333if test $tcl_ok = yes; then 334 AC_DEFINE(NEED_MATHERR) 335fi 336 337#-------------------------------------------------------------------- 338# Check to see whether the system provides a vfork kernel call. 339# If not, then use fork instead. Also, check for a problem with 340# vforks and signals that can cause core dumps if a vforked child 341# resets a signal handler. If the problem exists, then use fork 342# instead of vfork. 343#-------------------------------------------------------------------- 344 345AC_CHECK_FUNC(vfork, tcl_ok=1, tcl_ok=0) 346if test "$tcl_ok" = 1; then 347 AC_MSG_CHECKING([vfork/signal bug]); 348 AC_TRY_RUN([ 349 #include <stdio.h> 350 #include <signal.h> 351 #include <sys/wait.h> 352 int gotSignal = 0; 353 sigProc(sig) 354 int sig; 355 { 356 gotSignal = 1; 357 } 358 main() 359 { 360 int pid, sts; 361 (void) signal(SIGCHLD, sigProc); 362 pid = vfork(); 363 if (pid < 0) { 364 exit(1); 365 } else if (pid == 0) { 366 (void) signal(SIGCHLD, SIG_DFL); 367 _exit(0); 368 } else { 369 (void) wait(&sts); 370 } 371 exit((gotSignal) ? 0 : 1); 372 }], tcl_ok=1, tcl_ok=0, tcl_ok=0) 373 if test "$tcl_ok" = 1; then 374 AC_MSG_RESULT(ok) 375 else 376 AC_MSG_RESULT([buggy, using fork instead]) 377 fi 378fi 379rm -f core 380if test "$tcl_ok" = 0; then 381 AC_DEFINE(vfork, fork) 382fi 383 384#-------------------------------------------------------------------- 385# Check whether there is an strncasecmp function on this system. 386# This is a bit tricky because under SCO it's in -lsocket and 387# under Sequent Dynix it's in -linet. 388#-------------------------------------------------------------------- 389 390AC_CHECK_FUNC(strncasecmp, tcl_ok=1, tcl_ok=0) 391if test "$tcl_ok" = 0; then 392 AC_CHECK_LIB(socket, strncasecmp, tcl_ok=1, tcl_ok=0) 393fi 394if test "$tcl_ok" = 0; then 395 AC_CHECK_LIB(inet, strncasecmp, tcl_ok=1, tcl_ok=0) 396fi 397if test "$tcl_ok" = 0; then 398 LIBOBJS="$LIBOBJS strncasecmp.o" 399fi 400 401#-------------------------------------------------------------------- 402# The code below deals with several issues related to gettimeofday: 403# 1. Some systems don't provide a gettimeofday function at all 404# (set NO_GETTOD if this is the case). 405# 2. SGI systems don't use the BSD form of the gettimeofday function, 406# but they have a BSDgettimeofday function that can be used instead. 407# 3. See if gettimeofday is declared in the <sys/time.h> header file. 408# if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can 409# declare it. 410#-------------------------------------------------------------------- 411 412AC_CHECK_FUNC(BSDgettimeofday, AC_DEFINE(HAVE_BSDGETTIMEOFDAY), 413 AC_CHECK_FUNC(gettimeofday, , AC_DEFINE(NO_GETTOD))) 414AC_MSG_CHECKING([for gettimeofday declaration]) 415AC_EGREP_HEADER(gettimeofday, sys/time.h, AC_MSG_RESULT(present), [ 416 AC_MSG_RESULT(missing) 417 AC_DEFINE(GETTOD_NOT_DECLARED) 418]) 419 420#-------------------------------------------------------------------- 421# Interactive UNIX requires -linet instead of -lsocket, plus it 422# needs net/errno.h to define the socket-related error codes. 423#-------------------------------------------------------------------- 424 425AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]) 426AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H)) 427 428#-------------------------------------------------------------------- 429# The following code checks to see whether it is possible to get 430# signed chars on this platform. This is needed in order to 431# properly generate sign-extended ints from character values. 432#-------------------------------------------------------------------- 433 434AC_C_CHAR_UNSIGNED 435AC_MSG_CHECKING([signed char declarations]) 436AC_TRY_COMPILE(, [ 437signed char *p; 438p = 0; 439], tcl_ok=yes, tcl_ok=no) 440AC_MSG_RESULT($tcl_ok) 441if test $tcl_ok = yes; then 442 AC_DEFINE(HAVE_SIGNED_CHAR) 443fi 444 445#-------------------------------------------------------------------- 446# Check for the existence of the -lsocket and -lnsl libraries. 447# The order here is important, so that they end up in the right 448# order in the command line generated by make. Here are some 449# special considerations: 450# 1. Use "connect" and "accept" to check for -lsocket, and 451# "gethostbyname" to check for -lnsl. 452# 2. Use each function name only once: can't redo a check because 453# autoconf caches the results of the last check and won't redo it. 454# 3. Use -lnsl and -lsocket only if they supply procedures that 455# aren't already present in the normal libraries. This is because 456# IRIX 5.2 has libraries, but they aren't needed and they're 457# bogus: they goof up name resolution if used. 458# 4. On some SVR4 systems, can't use -lsocket without -lnsl too. 459# To get around this problem, check for both libraries together 460# if -lsocket doesn't work by itself. 461#-------------------------------------------------------------------- 462 463tcl_checkBoth=0 464AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1) 465if test "$tcl_checkSocket" = 1; then 466 AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tcl_checkBoth=1) 467fi 468if test "$tcl_checkBoth" = 1; then 469 tk_oldLibs=$LIBS 470 LIBS="$LIBS -lsocket -lnsl" 471 AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) 472fi 473AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])) 474 475#-------------------------------------------------------------------- 476# The statements below define a collection of symbols related to 477# dynamic loading and shared libraries: 478# 479# DL_OBJS - Name of the object file that implements dynamic 480# loading for Tcl on this system. 481# DL_LIBS - Library file(s) to include in tclsh and other base 482# applications in order for the "load" command to work. 483# LD_FLAGS - Flags to pass to the compiler when linking object 484# files into an executable application binary such 485# as tclsh. 486# LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib", 487# that tell the run-time dynamic linker where to look 488# for shared libraries such as libtcl.so. Depends on 489# the variable LIB_RUNTIME_DIR in the Makefile. 490# MAKE_LIB - Command to execute to build the Tcl library; 491# differs depending on whether or not Tcl is being 492# compiled as a shared library. 493# SHLIB_CFLAGS - Flags to pass to cc when compiling the components 494# of a shared library (may request position-independent 495# code, among other things). 496# SHLIB_LD - Base command to use for combining object files 497# into a shared library. 498# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when 499# creating shared libraries. This symbol typically 500# goes at the end of the "ld" commands that build 501# shared libraries. The value of the symbol is 502# "${LIBS}" if all of the dependent libraries should 503# be specified when creating a shared library. If 504# dependent libraries should not be specified (as on 505# SunOS 4.x, where they cause the link to fail, or in 506# general if Tcl and Tk aren't themselves shared 507# libraries), then this symbol has an empty string 508# as its value. 509# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable 510# extensions. An empty string means we don't know how 511# to use shared libraries on this platform. 512# TCL_LIB_FILE - Name of the file that contains the Tcl library, such 513# as libtcl7.8.so or libtcl7.8.a. 514# TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl" 515# in the shared library name, using the $VERSION variable 516# to put the version in the right place. This is used 517# by platforms that need non-standard library names. 518# Examples: ${VERSION}.so.1.1 on NetBSD, since it needs 519# to have a version after the .so, and ${VERSION}.a 520# on AIX, since the Tcl shared library needs to have 521# a .a extension whereas shared objects for loadable 522# extensions have a .so extension. Defaults to 523# ${VERSION}${SHLIB_SUFFIX}. 524#-------------------------------------------------------------------- 525 526# Step 1: set the variable "system" to hold the name and version number 527# for the system. This can usually be done via the "uname" command, but 528# there are a few systems, like Next, where this doesn't work. 529 530AC_MSG_CHECKING([system version (for dynamic loading)]) 531if test -f /usr/lib/NextStep/software_version; then 532 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` 533else 534 system=`uname -s`-`uname -r` 535 if test "$?" -ne 0 ; then 536 AC_MSG_RESULT([unknown (can't find uname command)]) 537 system=unknown 538 else 539 # Special check for weird MP-RAS system (uname returns weird 540 # results, and the version is kept in special file). 541 542 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then 543 system=MP-RAS-`awk '{print $3}' /etc/.relid'` 544 fi 545 if test "`uname -s`" = "AIX" ; then 546 system=AIX-`uname -v`.`uname -r` 547 fi 548 AC_MSG_RESULT($system) 549 fi 550fi 551 552# Step 2: check for existence of -ldl library. This is needed because 553# Linux can use either -ldl or -ldld for dynamic loading. 554 555AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no) 556 557# Step 3: set configuration options based on system name and version. 558 559fullSrcDir=`cd $srcdir; pwd` 560AIX=no 561TCL_SHARED_LIB_SUFFIX="" 562TCL_UNSHARED_LIB_SUFFIX="" 563TCL_LIB_VERSIONS_OK=ok 564case $system in 565 AIX-*) 566 SHLIB_CFLAGS="" 567 SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512" 568 SHLIB_LD_LIBS='${LIBS}' 569 SHLIB_SUFFIX=".so" 570 DL_OBJS="tclLoadDl.o tclLoadAix.o" 571 DL_LIBS="-lld" 572 LD_FLAGS="" 573 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 574 AIX=yes 575 TCL_SHARED_LIB_SUFFIX='${VERSION}.a' 576 ;; 577 BSD/OS-2.1*|BSD/OS-3*) 578 SHLIB_CFLAGS="" 579 SHLIB_LD="ld -r" 580 SHLIB_LD_FLAGS="" 581 SHLIB_SUFFIX=".so" 582 DL_OBJS="tclLoadDl.o" 583 DL_LIBS="-ldl" 584 LD_FLAGS="" 585 LD_SEARCH_FLAGS="" 586 ;; 587 HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) 588 AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) 589 if test "$tcl_ok" = yes; then 590 SHLIB_CFLAGS="+z" 591 SHLIB_LD="ld -b" 592 SHLIB_LD_LIBS="" 593 SHLIB_SUFFIX=".sl" 594 DL_OBJS="tclLoadShl.o" 595 DL_LIBS="-ldld" 596 LD_FLAGS="-Wl,-E" 597 LD_SEARCH_FLAGS='-Wl,+b,${LIB_RUNTIME_DIR}:.' 598 fi 599 ;; 600 IRIX-4.*) 601 SHLIB_CFLAGS="-G 0" 602 SHLIB_SUFFIX="..o" 603 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" 604 SHLIB_LD_LIBS='${LIBS}' 605 DL_OBJS="tclLoadAout.o" 606 DL_LIBS="" 607 LD_FLAGS="-Wl,-D,08000000" 608 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 609 TCL_SHARED_LIB_SUFFIX='${VERSION}.a' 610 ;; 611 IRIX-5.*|IRIX-6.*) 612 SHLIB_CFLAGS="" 613 SHLIB_LD="ld -shared -rdata_shared" 614 SHLIB_LD_LIBS="" 615 SHLIB_SUFFIX=".so" 616 DL_OBJS="tclLoadDl.o" 617 DL_LIBS="" 618 LD_FLAGS="" 619 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 620 ;; 621 IRIX64-6.*) 622 SHLIB_CFLAGS="" 623 SHLIB_LD="ld -32 -shared -rdata_shared -rpath /usr/local/lib" 624 SHLIB_LD_LIBS="" 625 SHLIB_SUFFIX=".so" 626 DL_OBJS="tclLoadDl.o" 627 DL_LIBS="" 628 LD_FLAGS="" 629 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 630 ;; 631 Linux*) 632 SHLIB_CFLAGS="-fPIC" 633 SHLIB_LD_LIBS="" 634 SHLIB_SUFFIX=".so" 635 if test "$have_dl" = yes; then 636 SHLIB_LD="${CC} -shared" 637 DL_OBJS="tclLoadDl.o" 638 DL_LIBS="-ldl" 639 LD_FLAGS="-rdynamic" 640 LD_SEARCH_FLAGS="" 641 else 642 AC_CHECK_HEADER(dld.h, [ 643 SHLIB_LD="ld -shared" 644 DL_OBJS="tclLoadDld.o" 645 DL_LIBS="-ldld" 646 LD_FLAGS="" 647 LD_SEARCH_FLAGS=""]) 648 fi 649 ;; 650 MP-RAS-02*) 651 SHLIB_CFLAGS="-K PIC" 652 SHLIB_LD="cc -G" 653 SHLIB_LD_LIBS="" 654 SHLIB_SUFFIX=".so" 655 DL_OBJS="tclLoadDl.o" 656 DL_LIBS="-ldl" 657 LD_FLAGS="" 658 LD_SEARCH_FLAGS="" 659 ;; 660 MP-RAS-*) 661 SHLIB_CFLAGS="-K PIC" 662 SHLIB_LD="cc -G" 663 SHLIB_LD_LIBS="" 664 SHLIB_SUFFIX=".so" 665 DL_OBJS="tclLoadDl.o" 666 DL_LIBS="-ldl" 667 LD_FLAGS="-Wl,-Bexport" 668 LD_SEARCH_FLAGS="" 669 ;; 670 NetBSD-*|FreeBSD-*) 671 # Not available on all versions: check for include file. 672 AC_CHECK_HEADER(dlfcn.h, [ 673 SHLIB_CFLAGS="-fpic" 674 SHLIB_LD="ld -Bshareable -x" 675 SHLIB_LD_LIBS="" 676 SHLIB_SUFFIX=".so" 677 DL_OBJS="tclLoadDl.o" 678 DL_LIBS="" 679 LD_FLAGS="" 680 LD_SEARCH_FLAGS="" 681 TCL_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.so.1.0' 682 ], [ 683 SHLIB_CFLAGS="" 684 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" 685 SHLIB_LD_LIBS='${LIBS}' 686 SHLIB_SUFFIX="..o" 687 DL_OBJS="tclLoadAout.o" 688 DL_LIBS="" 689 LD_FLAGS="" 690 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 691 TCL_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a' 692 ]) 693 694 # FreeBSD doesn't handle version numbers with dots. 695 696 TCL_UNSHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a' 697 TCL_LIB_VERSIONS_OK=nodots 698 ;; 699 NEXTSTEP-*) 700 SHLIB_CFLAGS="" 701 SHLIB_LD="cc -nostdlib -r" 702 SHLIB_LD_LIBS="" 703 SHLIB_SUFFIX=".so" 704 DL_OBJS="tclLoadNext.o" 705 DL_LIBS="" 706 LD_FLAGS="" 707 LD_SEARCH_FLAGS="" 708 ;; 709 OSF1-1.0|OSF1-1.1|OSF1-1.2) 710 # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 711 SHLIB_CFLAGS="" 712 # Hack: make package name same as library name 713 SHLIB_LD='ld -R -export $@:' 714 SHLIB_LD_LIBS="" 715 SHLIB_SUFFIX=".so" 716 DL_OBJS="tclLoadOSF.o" 717 DL_LIBS="" 718 LD_FLAGS="" 719 LD_SEARCH_FLAGS="" 720 ;; 721 OSF1-1.*) 722 # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 723 SHLIB_CFLAGS="-fpic" 724 SHLIB_LD="ld -shared" 725 SHLIB_LD_LIBS="" 726 SHLIB_SUFFIX=".so" 727 DL_OBJS="tclLoadDl.o" 728 DL_LIBS="" 729 LD_FLAGS="" 730 LD_SEARCH_FLAGS="" 731 ;; 732 OSF1-V*) 733 # Digital OSF/1 734 SHLIB_CFLAGS="" 735 SHLIB_LD='ld -shared -expect_unresolved "*"' 736 SHLIB_LD_LIBS="" 737 SHLIB_SUFFIX=".so" 738 DL_OBJS="tclLoadDl.o" 739 DL_LIBS="" 740 LD_FLAGS="" 741 LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' 742 ;; 743 RISCos-*) 744 SHLIB_CFLAGS="-G 0" 745 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" 746 SHLIB_LD_LIBS='${LIBS}' 747 SHLIB_SUFFIX="..o" 748 DL_OBJS="tclLoadAout.o" 749 DL_LIBS="" 750 LD_FLAGS="-Wl,-D,08000000" 751 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 752 TCL_SHARED_LIB_SUFFIX='${VERSION}.a' 753 ;; 754 SCO_SV-3.2*) 755 # Note, dlopen is available only on SCO 3.2.5 and greater. However, 756 # this test works, since "uname -s" was non-standard in 3.2.4 and 757 # below. 758 SHLIB_CFLAGS="-Kpic -belf" 759 SHLIB_LD="ld -G" 760 SHLIB_LD_LIBS="" 761 SHLIB_SUFFIX=".so" 762 DL_OBJS="tclLoadDl.o" 763 DL_LIBS="" 764 LD_FLAGS="-belf -Wl,-Bexport" 765 LD_SEARCH_FLAGS="" 766 ;; 767 SINIX*5.4*) 768 SHLIB_CFLAGS="-K PIC" 769 SHLIB_LD="cc -G" 770 SHLIB_LD_LIBS="" 771 SHLIB_SUFFIX=".so" 772 DL_OBJS="tclLoadDl.o" 773 DL_LIBS="-ldl" 774 LD_FLAGS="" 775 LD_SEARCH_FLAGS="" 776 ;; 777 SunOS-4*) 778 SHLIB_CFLAGS="-PIC" 779 SHLIB_LD="ld" 780 SHLIB_LD_LIBS="" 781 SHLIB_SUFFIX=".so" 782 DL_OBJS="tclLoadDl.o" 783 DL_LIBS="-ldl" 784 LD_FLAGS="" 785 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 786 787 # SunOS can't handle version numbers with dots in them in library 788 # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it 789 # requires an extra version number at the end of .so file names. 790 # So, the library has to have a name like libtcl75.so.1.0 791 792 TCL_SHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.so.1.0' 793 TCL_UNSHARED_LIB_SUFFIX='`echo ${VERSION} | tr -d .`.a' 794 TCL_LIB_VERSIONS_OK=nodots 795 ;; 796 SunOS-5*) 797 SHLIB_CFLAGS="-KPIC" 798 SHLIB_LD="/usr/ccs/bin/ld -G -z text" 799 SHLIB_LD_LIBS="" 800 SHLIB_SUFFIX=".so" 801 DL_OBJS="tclLoadDl.o" 802 DL_LIBS="-ldl" 803 LD_FLAGS="" 804 LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' 805 ;; 806 ULTRIX-4.*) 807 SHLIB_CFLAGS="-G 0" 808 SHLIB_SUFFIX="..o" 809 SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" 810 SHLIB_LD_LIBS='${LIBS}' 811 DL_OBJS="tclLoadAout.o" 812 DL_LIBS="" 813 LD_FLAGS="-Wl,-D,08000000" 814 LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' 815 TCL_SHARED_LIB_SUFFIX='${VERSION}.a' 816 ;; 817 UNIX_SV*) 818 SHLIB_CFLAGS="-KPIC" 819 SHLIB_LD="cc -G" 820 SHLIB_LD_LIBS="" 821 SHLIB_SUFFIX=".so" 822 DL_OBJS="tclLoadDl.o" 823 DL_LIBS="-ldl" 824 # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers 825 # that don't grok the -Bexport option. Test that it does. 826 hold_ldflags=$LDFLAGS 827 AC_MSG_CHECKING(for ld accepts -Bexport flag) 828 LDFLAGS="${LDFLAGS} -Wl,-Bexport" 829 AC_TRY_LINK(, [int i;], found=yes, found=no) 830 LDFLAGS=$hold_ldflags 831 AC_MSG_RESULT($found) 832 if test $found = yes; then 833 LD_FLAGS="-Wl,-Bexport" 834 else 835 LD_FLAGS="" 836 fi 837 LD_SEARCH_FLAGS="" 838 ;; 839esac 840 841# Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic 842# Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop, 843# New Orleans, LA, Computerized Processes Unlimited, 1994), then we need 844# to determine which of several header files defines the a.out file 845# format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we 846# support only a file format that is more or less version-7-compatible. 847# In particular, 848# - a.out files must begin with `struct exec'. 849# - the N_TXTOFF on the `struct exec' must compute the seek address 850# of the text segment 851# - The `struct exec' must contain a_magic, a_text, a_data, a_bss 852# and a_entry fields. 853# The following compilation should succeed if and only if either sys/exec.h 854# or a.out.h is usable for the purpose. 855# 856# Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the 857# `struct exec' includes a second header that contains information that 858# duplicates the v7 fields that are needed. 859 860if test "x$DL_OBJS" = "xtclLoadAout.o" ; then 861 AC_MSG_CHECKING(sys/exec.h) 862 AC_TRY_COMPILE([#include <sys/exec.h>],[ 863 struct exec foo; 864 unsigned long seek; 865 int flag; 866#if defined(__mips) || defined(mips) 867 seek = N_TXTOFF (foo.ex_f, foo.ex_o); 868#else 869 seek = N_TXTOFF (foo); 870#endif 871 flag = (foo.a_magic == OMAGIC); 872 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; 873], tcl_ok=usable, tcl_ok=unusable) 874 AC_MSG_RESULT($tcl_ok) 875 if test $tcl_ok = usable; then 876 AC_DEFINE(USE_SYS_EXEC_H) 877 else 878 AC_MSG_CHECKING(a.out.h) 879 AC_TRY_COMPILE([#include <a.out.h>],[ 880 struct exec foo; 881 unsigned long seek; 882 int flag; 883#if defined(__mips) || defined(mips) 884 seek = N_TXTOFF (foo.ex_f, foo.ex_o); 885#else 886 seek = N_TXTOFF (foo); 887#endif 888 flag = (foo.a_magic == OMAGIC); 889 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; 890 ], tcl_ok=usable, tcl_ok=unusable) 891 AC_MSG_RESULT($tcl_ok) 892 if test $tcl_ok = usable; then 893 AC_DEFINE(USE_A_OUT_H) 894 else 895 AC_MSG_CHECKING(sys/exec_aout.h) 896 AC_TRY_COMPILE([#include <sys/exec_aout.h>],[ 897 struct exec foo; 898 unsigned long seek; 899 int flag; 900#if defined(__mips) || defined(mips) 901 seek = N_TXTOFF (foo.ex_f, foo.ex_o); 902#else 903 seek = N_TXTOFF (foo); 904#endif 905 flag = (foo.a_midmag == OMAGIC); 906 return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry; 907 ], tcl_ok=usable, tcl_ok=unusable) 908 AC_MSG_RESULT($tcl_ok) 909 if test $tcl_ok = usable; then 910 AC_DEFINE(USE_SYS_EXEC_AOUT_H) 911 else 912 DL_OBJS="" 913 fi 914 fi 915 fi 916fi 917 918# Step 5: disable dynamic loading if requested via a command-line switch. 919 920AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command], 921 [tcl_ok=$enableval], [tcl_ok=yes]) 922if test "$tcl_ok" = "no"; then 923 DL_OBJS="" 924fi 925 926if test "x$DL_OBJS" != "x" ; then 927 BUILD_DLTEST="\$(DLTEST_TARGETS)" 928else 929 echo "Can't figure out how to do dynamic loading or shared libraries" 930 echo "on this system." 931 SHLIB_CFLAGS="" 932 SHLIB_LD="" 933 SHLIB_SUFFIX="" 934 DL_OBJS="tclLoadNone.o" 935 DL_LIBS="" 936 LD_FLAGS="" 937 LD_SEARCH_FLAGS="" 938 BUILD_DLTEST="" 939fi 940 941# If we're running gcc, then change the C flags for compiling shared 942# libraries to the right flags for gcc, instead of those for the 943# standard manufacturer compiler. 944 945if test "$DL_OBJS" != "tclLoadNone.o" ; then 946 if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then 947 case $system in 948 AIX-*) 949 ;; 950 BSD/OS*) 951 ;; 952 IRIX*) 953 ;; 954 NetBSD-*|FreeBSD-*) 955 ;; 956 RISCos-*) 957 ;; 958 ULTRIX-4.*) 959 ;; 960 *) 961 SHLIB_CFLAGS="-fPIC" 962 ;; 963 esac 964 fi 965fi 966 967#-------------------------------------------------------------------- 968# The statements below check for systems where POSIX-style 969# non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. 970# On these systems (mostly older ones), use the old BSD-style 971# FIONBIO approach instead. 972#-------------------------------------------------------------------- 973 974AC_CHECK_HEADERS(sys/ioctl.h) 975AC_CHECK_HEADERS(sys/filio.h) 976AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O]) 977if test -f /usr/lib/NextStep/software_version; then 978 system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version` 979else 980 system=`uname -s`-`uname -r` 981 if test "$?" -ne 0 ; then 982 system=unknown 983 else 984 # Special check for weird MP-RAS system (uname returns weird 985 # results, and the version is kept in special file). 986 987 if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then 988 system=MP-RAS-`awk '{print $3}' /etc/.relid'` 989 fi 990 if test "`uname -s`" = "AIX" ; then 991 system=AIX-`uname -v`.`uname -r` 992 fi 993 fi 994fi 995case $system in 996 AIX-*) 997 AC_DEFINE(USE_FIONBIO) 998 AC_MSG_RESULT(FIONBIO) 999 ;; 1000 OSF*) 1001 AC_DEFINE(USE_FIONBIO) 1002 AC_MSG_RESULT(FIONBIO) 1003 ;; 1004 SunOS-4*) 1005 AC_DEFINE(USE_FIONBIO) 1006 AC_MSG_RESULT(FIONBIO) 1007 ;; 1008 ULTRIX-4.*) 1009 AC_DEFINE(USE_FIONBIO) 1010 AC_MSG_RESULT(FIONBIO) 1011 ;; 1012 *) 1013 AC_MSG_RESULT(O_NONBLOCK) 1014 ;; 1015esac 1016 1017#-------------------------------------------------------------------- 1018# The statements below define a collection of symbols related to 1019# building libtcl as a shared library instead of a static library. 1020#-------------------------------------------------------------------- 1021 1022realRanlib=$RANLIB 1023if test "$TCL_SHARED_LIB_SUFFIX" = "" ; then 1024 TCL_SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}' 1025fi 1026if test "$TCL_UNSHARED_LIB_SUFFIX" = "" ; then 1027 TCL_UNSHARED_LIB_SUFFIX='${VERSION}.a' 1028fi 1029AC_ARG_ENABLE(shared, 1030 [ --enable-shared build libtcl as a shared library], 1031 [tcl_ok=$enableval], [tcl_ok=no]) 1032if test "$tcl_ok" = "yes" -a "${SHLIB_SUFFIX}" != "" \ 1033 -a "${DL_OBJS}" != "tclLoadAout.o" ; then 1034 TCL_SHLIB_CFLAGS="${SHLIB_CFLAGS}" 1035 TCL_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}" 1036 eval "TCL_LIB_FILE=libtcl${TCL_SHARED_LIB_SUFFIX}" 1037 MAKE_LIB="\${SHLIB_LD} -o ${TCL_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}" 1038 RANLIB=":" 1039else 1040 if test "$AIX" = "no" ; then 1041 SHLIB_LD_LIBS="" 1042 fi 1043 TCL_SHLIB_CFLAGS="" 1044 TCL_LD_SEARCH_FLAGS="" 1045 eval "TCL_LIB_FILE=libtcl${TCL_UNSHARED_LIB_SUFFIX}" 1046 MAKE_LIB="ar cr ${TCL_LIB_FILE} \${OBJS}" 1047fi 1048 1049# Note: in the following variable, it's important to use the absolute 1050# path name of the Tcl directory rather than "..": this is because 1051# AIX remembers this path and will attempt to use it at run-time to look 1052# up the Tcl library. 1053 1054if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then 1055 TCL_BUILD_LIB_SPEC="-L`pwd` -ltcl${VERSION}" 1056 TCL_LIB_SPEC="-L${exec_prefix}/lib -ltcl${VERSION}" 1057else 1058 TCL_BUILD_LIB_SPEC="-L`pwd` -ltcl`echo ${VERSION} | tr -d .`" 1059 TCL_LIB_SPEC="-L${exec_prefix}/lib -ltcl`echo ${VERSION} | tr -d .`" 1060fi 1061 1062#-------------------------------------------------------------------- 1063# The statements below define the symbol TCL_PACKAGE_PATH, which 1064# gives a list of directories that may contain packages. The list 1065# consists of one directory for machine-dependent binaries and 1066# another for platform-independent scripts. 1067#-------------------------------------------------------------------- 1068 1069if test "$prefix" != "$exec_prefix"; then 1070 TCL_PACKAGE_PATH="${exec_prefix}/lib ${prefix}/lib" 1071else 1072 TCL_PACKAGE_PATH="${prefix}/lib" 1073fi 1074 1075AC_SUBST(BUILD_DLTEST) 1076AC_SUBST(DL_LIBS) 1077AC_SUBST(DL_OBJS) 1078AC_SUBST(LD_FLAGS) 1079AC_SUBST(MAKE_LIB) 1080AC_SUBST(MATH_LIBS) 1081AC_SUBST(SHLIB_CFLAGS) 1082AC_SUBST(SHLIB_LD) 1083AC_SUBST(SHLIB_LD_LIBS) 1084AC_SUBST(SHLIB_SUFFIX) 1085AC_SUBST(TCL_BUILD_LIB_SPEC) 1086AC_SUBST(TCL_LD_SEARCH_FLAGS) 1087AC_SUBST(TCL_LIB_FILE) 1088AC_SUBST(TCL_LIB_SPEC) 1089AC_SUBST(TCL_LIB_VERSIONS_OK) 1090AC_SUBST(TCL_MAJOR_VERSION) 1091AC_SUBST(TCL_MINOR_VERSION) 1092AC_SUBST(TCL_PACKAGE_PATH) 1093AC_SUBST(TCL_PATCH_LEVEL) 1094AC_SUBST(TCL_SHARED_LIB_SUFFIX) 1095AC_SUBST(TCL_SHLIB_CFLAGS) 1096AC_SUBST(TCL_SRC_DIR) 1097AC_SUBST(TCL_UNSHARED_LIB_SUFFIX) 1098AC_SUBST(TCL_VERSION) 1099 1100AC_OUTPUT(Makefile tclConfig.sh) 1101