1! /bin/bash -norc 2dnl This file is an input file used by the GNU "autoconf" program to 3dnl generate the file "configure", which is run during Tk installation 4dnl to configure the system for the local environment. 5 6AC_INIT([tk],[8.7]) 7AC_PREREQ([2.69]) 8 9dnl This is only used when included from macosx/configure.ac 10m4_ifdef([SC_USE_CONFIG_HEADERS], [ 11 AC_CONFIG_HEADERS([tkConfig.h:../unix/tkConfig.h.in]) 12 AC_CONFIG_COMMANDS_PRE([DEFS="-DHAVE_TK_CONFIG_H -imacros tkConfig.h"]) 13 AH_TOP([ 14 #ifndef _TKCONFIG 15 #define _TKCONFIG]) 16 AH_BOTTOM([ 17 /* Undef unused package specific autoheader defines so that we can 18 * include both tclConfig.h and tkConfig.h at the same time: */ 19 /* override */ #undef PACKAGE_NAME 20 /* override */ #undef PACKAGE_TARNAME 21 /* override */ #undef PACKAGE_VERSION 22 /* override */ #undef PACKAGE_STRING 23 #endif /* _TKCONFIG */]) 24]) 25 26TK_VERSION=8.7 27TK_MAJOR_VERSION=8 28TK_MINOR_VERSION=7 29TK_PATCH_LEVEL="a5" 30VERSION=${TK_VERSION} 31LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" 32 33#-------------------------------------------------------------------- 34# Find and load the tclConfig.sh file 35#-------------------------------------------------------------------- 36 37SC_PATH_TCLCONFIG 38SC_LOAD_TCLCONFIG 39 40if test "${TCL_MAJOR_VERSION}" -lt 9 ; then 41if test "${TCL_MAJOR_VERSION}" -ne 8 ; then 42 AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+ 43Found config for Tcl ${TCL_VERSION}]) 44fi 45if test "${TCL_MINOR_VERSION}" -lt 6 ; then 46 AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+ 47Found config for Tcl ${TCL_VERSION}]) 48fi 49fi 50 51SC_PROG_TCLSH 52SC_BUILD_TCLSH 53 54#------------------------------------------------------------------------ 55# Handle the --prefix=... option 56#------------------------------------------------------------------------ 57 58if test "${prefix}" = "NONE"; then 59 prefix="$TCL_PREFIX" 60fi 61if test "${exec_prefix}" = "NONE"; then 62 exec_prefix=$prefix 63fi 64# Make sure srcdir is fully qualified! 65srcdir="`cd "$srcdir" ; pwd`" 66TK_SRC_DIR="`cd "$srcdir"/..; pwd`" 67 68#------------------------------------------------------------------------ 69# Compress and/or soft link the manpages? 70#------------------------------------------------------------------------ 71 72SC_CONFIG_MANPAGES 73 74#------------------------------------------------------------------------ 75# Standard compiler checks 76#------------------------------------------------------------------------ 77 78# If the user did not set CFLAGS, set it now to keep 79# the AC_PROG_CC macro from adding "-g -O2". 80if test "${CFLAGS+set}" != "set" ; then 81 CFLAGS="" 82fi 83 84AC_PROG_CC 85AC_C_INLINE 86 87#------------------------------------------------------------------------ 88# If we're using GCC, see if the compiler understands -pipe. If so, use it. 89# It makes compiling go faster. (This is only a performance feature.) 90#------------------------------------------------------------------------ 91 92if test -z "$no_pipe" && test -n "$GCC"; then 93 AC_CACHE_CHECK([if the compiler understands -pipe], 94 tcl_cv_cc_pipe, [ 95 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" 96 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_pipe=yes],[tcl_cv_cc_pipe=no]) 97 CFLAGS=$hold_cflags]) 98 if test $tcl_cv_cc_pipe = yes; then 99 CFLAGS="$CFLAGS -pipe" 100 fi 101fi 102 103#------------------------------------------------------------------------ 104# Embedded configuration information, encoding to use for the values, TIP #59 105#------------------------------------------------------------------------ 106 107SC_TCL_CFG_ENCODING 108 109SC_ENABLE_SHARED 110 111#-------------------------------------------------------------------- 112# The statements below define a collection of compile flags. This 113# macro depends on the value of SHARED_BUILD, and should be called 114# after SC_ENABLE_SHARED checks the configure switches. 115#-------------------------------------------------------------------- 116 117SC_CONFIG_CFLAGS 118 119SC_ENABLE_SYMBOLS 120 121#-------------------------------------------------------------------- 122# Detect what compiler flags to set for 64-bit support. 123#-------------------------------------------------------------------- 124 125SC_TCL_EARLY_FLAGS 126 127SC_TCL_64BIT_FLAGS 128 129#-------------------------------------------------------------------- 130# Check endianness because we can optimize some operations 131#-------------------------------------------------------------------- 132 133AC_C_BIGENDIAN 134 135#------------------------------------------------------------------------ 136# If Tcl and Tk are installed in different places, adjust the library 137# search path to reflect this. 138#------------------------------------------------------------------------ 139 140LIB_RUNTIME_DIR='$(libdir)' 141 142if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then 143 LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib" 144fi 145 146if test "$TCL_PREFIX" != "$prefix"; then 147 AC_MSG_WARN([ 148 Different --prefix selected for Tk and Tcl! 149 [[package require tk]] may not work correctly in tclsh.]) 150fi 151 152#-------------------------------------------------------------------- 153# Include sys/select.h if it exists and if it supplies things 154# that appear to be useful and aren't already in sys/types.h. 155# This appears to be true only on the RS/6000 under AIX. Some 156# systems like OSF/1 have a sys/select.h that's of no use, and 157# other systems like SCO UNIX have a sys/select.h that's 158# pernicious. If "fd_set" isn't defined anywhere then set a 159# special flag. 160#-------------------------------------------------------------------- 161 162AC_CACHE_CHECK([for fd_set in sys/types], tcl_cv_type_fd_set, [ 163 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[fd_set readMask, writeMask;]])],[tcl_cv_type_fd_set=yes],[tcl_cv_type_fd_set=no])]) 164tk_ok=$tcl_cv_type_fd_set 165if test $tk_ok = no; then 166 AC_CACHE_CHECK([for fd_mask in sys/select], tcl_cv_grep_fd_mask, [ 167 AC_EGREP_HEADER(fd_mask, sys/select.h, 168 tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)]) 169 if test $tcl_cv_grep_fd_mask = present; then 170 AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Should we include <sys/select.h>?]) 171 tk_ok=yes 172 fi 173fi 174if test $tk_ok = no; then 175 AC_DEFINE(NO_FD_SET, 1, [Do we have fd_set?]) 176fi 177 178#------------------------------------------------------------------------------ 179# Find out all about time handling differences. 180#------------------------------------------------------------------------------ 181 182AC_CHECK_HEADERS_ONCE([sys/time.h]) 183 184#-------------------------------------------------------------------- 185# Check for various typedefs and provide substitutes if 186# they don't exist. 187#-------------------------------------------------------------------- 188 189AC_TYPE_MODE_T 190AC_TYPE_PID_T 191AC_TYPE_SIZE_T 192 193AC_CHECK_TYPES([intptr_t, uintptr_t],,,[[ 194#include <stdint.h> 195]]) 196 197#------------------------------------------- 198# In OS/390 struct pwd has no pw_gecos field 199#------------------------------------------- 200 201AC_CACHE_CHECK([pw_gecos in struct pwd], tcl_cv_pwd_pw_gecos, [ 202 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pwd.h>]], [[struct passwd pwd; (void)pwd.pw_gecos;]])],[tcl_cv_pwd_pw_gecos=yes],[tcl_cv_pwd_pw_gecos=no])]) 203if test $tcl_cv_pwd_pw_gecos = yes; then 204 AC_DEFINE(HAVE_PW_GECOS, 1, [Does struct password have a pw_gecos field?]) 205fi 206 207#-------------------------------------------------------------------- 208# On Mac OS X, we can build either with X11 or with Aqua 209#-------------------------------------------------------------------- 210 211if test "`uname -s`" = "Darwin" ; then 212 AC_MSG_CHECKING([whether to use Aqua]) 213 AC_ARG_ENABLE(aqua, 214 AS_HELP_STRING([--enable-aqua=yes|no],[use Aqua windowingsystem on Mac OS X (default: no)]), 215 [tk_aqua=$enableval], [tk_aqua=no]) 216 if test $tk_aqua = yes -o $tk_aqua = cocoa; then 217 tk_aqua=yes 218 if test $tcl_corefoundation = no; then 219 AC_MSG_WARN([Aqua can only be used when CoreFoundation is available]) 220 tk_aqua=no 221 fi 222 if test ! -d /System/Library/Frameworks/Cocoa.framework; then 223 AC_MSG_WARN([Aqua can only be used when Cocoa is available]) 224 tk_aqua=no 225 fi 226 if test "`uname -r | awk -F. '{print [$]1}'`" -lt 9; then 227 AC_MSG_WARN([Aqua requires Mac OS X 10.5 or later]) 228 tk_aqua=no 229 fi 230 fi 231 AC_MSG_RESULT([$tk_aqua]) 232 if test "$fat_32_64" = yes; then 233 if test $tk_aqua = no; then 234 AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [ 235 for v in CFLAGS CPPFLAGS LDFLAGS; do 236 eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' 237 done 238 CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include" 239 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" 240 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize();]])],[tcl_cv_lib_x11_64=yes],[tcl_cv_lib_x11_64=no]) 241 for v in CFLAGS CPPFLAGS LDFLAGS; do 242 eval $v'="$hold_'$v'"' 243 done]) 244 fi 245 # remove 64-bit arch flags from CFLAGS et al. for combined 32 & 64 bit 246 # fat builds if configuration does not support 64-bit. 247 if test "$tcl_cv_lib_x11_64" = no; then 248 AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags]) 249 for v in CFLAGS CPPFLAGS LDFLAGS; do 250 eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' 251 done 252 fi 253 fi 254 if test $tk_aqua = no; then 255 # check if weak linking whole libraries is possible. 256 AC_CACHE_CHECK([if ld accepts -weak-l flag], tcl_cv_ld_weak_l, [ 257 hold_ldflags=$LDFLAGS 258 LDFLAGS="$LDFLAGS -Wl,-weak-lm" 259 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[double f = sin(1.0);]])],[tcl_cv_ld_weak_l=yes],[tcl_cv_ld_weak_l=no]) 260 LDFLAGS=$hold_ldflags]) 261 fi 262 AC_CHECK_HEADERS(AvailabilityMacros.h) 263 if test "$ac_cv_header_AvailabilityMacros_h" = yes; then 264 AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [ 265 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" 266 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 267 #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 268 #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 269 #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 270 #endif 271 #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020 272 #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020 273 #endif 274 int rand(void) __attribute__((weak_import)); 275 ]], [[rand();]])],[tcl_cv_cc_weak_import=yes],[tcl_cv_cc_weak_import=no]) 276 CFLAGS=$hold_cflags]) 277 if test $tcl_cv_cc_weak_import = yes; then 278 AC_DEFINE(HAVE_WEAK_IMPORT, 1, [Is weak import available?]) 279 fi 280 AC_CACHE_CHECK([if Darwin SUSv3 extensions are available], 281 tcl_cv_cc_darwin_c_source, [ 282 hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" 283 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 284 #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ 285 #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 286 #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 287 #endif 288 #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050 289 #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050 290 #endif 291 #define _DARWIN_C_SOURCE 1 292 #include <sys/cdefs.h> 293 ]], [[]])],[tcl_cv_cc_darwin_c_source=yes],[tcl_cv_cc_darwin_c_source=no]) 294 CFLAGS=$hold_cflags]) 295 if test $tcl_cv_cc_darwin_c_source = yes; then 296 AC_DEFINE(_DARWIN_C_SOURCE, 1, 297 [Are Darwin SUSv3 extensions available?]) 298 fi 299 fi 300else 301 tk_aqua=no 302fi 303 304if test $tk_aqua = yes; then 305 AC_DEFINE(MAC_OSX_TK, 1, [Are we building TkAqua?]) 306 LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore -framework Security" 307 if test -d /System/Library/Frameworks/UserNotifications.framework; then 308 LIBS="$LIBS -framework UserNotifications" 309 fi 310 EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c' 311 TK_WINDOWINGSYSTEM=AQUA 312 if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then 313 AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?]) 314 fi 315else 316 #-------------------------------------------------------------------- 317 # Locate the X11 header files and the X11 library archive. Try 318 # the ac_path_x macro first, but if it doesn't find the X stuff 319 # (e.g. because there's no xmkmf program) then check through 320 # a list of possible directories. Under some conditions the 321 # autoconf macro will return an include directory that contains 322 # no include files, so double-check its result just to be safe. 323 #-------------------------------------------------------------------- 324 325 SC_PATH_X 326 TK_WINDOWINGSYSTEM=X11 327fi 328 329#-------------------------------------------------------------------- 330# Various manipulations on the search path used at runtime to 331# find shared libraries: 332# 1. If the X library binaries are in a non-standard directory, 333# add the X library location into that search path. 334# 2. On systems such as AIX and Ultrix that use "-L" as the 335# search path option, colons cannot be used to separate 336# directories from each other. Change colons to " -L". 337# 3. Create two sets of search flags, one for use in cc lines 338# and the other for when the linker is invoked directly. In 339# the second case, '-Wl,' must be stripped off and commas must 340# be replaced by spaces. 341#-------------------------------------------------------------------- 342 343if test "x${x_libraries}" != "x"; then 344 if test "x${x_libraries}" != "xNONE"; then 345 LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${x_libraries}" 346 fi 347fi 348if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then 349 LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'` 350fi 351 352#-------------------------------------------------------------------- 353# Check for the existence of various libraries. The order here 354# is important, so that then end up in the right order in the 355# command line generated by make. The -lsocket and -lnsl libraries 356# require a couple of special tricks: 357# 1. Use "connect" and "accept" to check for -lsocket, and 358# "gethostbyname" to check for -lnsl. 359# 2. Use each function name only once: can't redo a check because 360# autoconf caches the results of the last check and won't redo it. 361# 3. Use -lnsl and -lsocket only if they supply procedures that 362# aren't already present in the normal libraries. This is because 363# IRIX 5.2 has libraries, but they aren't needed and they're 364# bogus: they goof up name resolution if used. 365# 4. On some SVR4 systems, can't use -lsocket without -lnsl too. 366# To get around this problem, check for both libraries together 367# if -lsocket doesn't work by itself. 368#-------------------------------------------------------------------- 369 370if test $tk_aqua = no; then 371 AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"]) 372fi 373 374#-------------------------------------------------------------------- 375# One more check related to the X libraries. The standard releases 376# of Ultrix don't support the "xauth" mechanism, so send won't work 377# unless TK_NO_SECURITY is defined. However, there are usually copies 378# of the MIT X server available as well, which do support xauth. 379# Check for the MIT stuff and use it if it exists. 380# 381# Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1) 382# because it can't deal with the "-" in the library name. 383#-------------------------------------------------------------------- 384 385if test -d /usr/include/mit -a $tk_aqua = no; then 386 AC_MSG_CHECKING([MIT X libraries]) 387 tk_oldCFlags=$CFLAGS 388 CFLAGS="$CFLAGS -I/usr/include/mit" 389 tk_oldLibs=$LIBS 390 LIBS="$LIBS -lX11-mit" 391 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 392 #include <X11/Xlib.h> 393 ]], [[ 394 XOpenDisplay(0); 395 ]])],[ 396 AC_MSG_RESULT([yes]) 397 XLIBSW="-lX11-mit" 398 XINCLUDES="-I/usr/include/mit" 399 ],[AC_MSG_RESULT(no)]) 400 CFLAGS=$tk_oldCFlags 401 LIBS=$tk_oldLibs 402fi 403 404#-------------------------------------------------------------------- 405# Check for freetype / fontconfig / Xft support. 406#-------------------------------------------------------------------- 407 408if test $tk_aqua = no; then 409 AC_MSG_CHECKING([whether to use xft]) 410 AC_ARG_ENABLE(xft, 411 AS_HELP_STRING([--enable-xft],[use freetype/fontconfig/xft (default: on)]), 412 [enable_xft=$enableval], [enable_xft="default"]) 413 XFT_CFLAGS="" 414 XFT_LIBS="" 415 if test "$enable_xft" = "no" ; then 416 AC_MSG_RESULT([$enable_xft]) 417 else 418 found_xft="yes" 419 dnl make sure package configurator (xft-config or pkg-config 420 dnl says that xft is present. 421 XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no" 422 XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no" 423 if test "$found_xft" = "no" ; then 424 found_xft=yes 425 XFT_CFLAGS=`pkg-config --cflags xft fontconfig 2>/dev/null` || found_xft="no" 426 XFT_LIBS=`pkg-config --libs xft fontconfig 2>/dev/null` || found_xft="no" 427 fi 428 AC_MSG_RESULT([$found_xft]) 429 dnl make sure that compiling against Xft header file doesn't bomb 430 if test "$found_xft" = "yes" ; then 431 tk_oldCFlags=$CFLAGS 432 CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" 433 tk_oldLibs=$LIBS 434 LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" 435 AC_CHECK_HEADER(X11/Xft/Xft.h, [], [ 436 found_xft=no 437 ],[#include <X11/Xlib.h>]) 438 CFLAGS=$tk_oldCFlags 439 LIBS=$tk_oldLibs 440 fi 441 dnl make sure that linking against Xft libraries finds freetype 442 if test "$found_xft" = "yes" ; then 443 tk_oldCFlags=$CFLAGS 444 CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" 445 tk_oldLibs=$LIBS 446 LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" 447 AC_CHECK_LIB(Xft, XftFontOpen, [], [ 448 found_xft=no 449 ]) 450 CFLAGS=$tk_oldCFlags 451 LIBS=$tk_oldLibs 452 fi 453 dnl make sure that linking against fontconfig libraries finds Fc* symbols 454 if test "$found_xft" = "yes" ; then 455 tk_oldCFlags=$CFLAGS 456 CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" 457 tk_oldLibs=$LIBS 458 LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW -lfontconfig" 459 AC_CHECK_LIB(fontconfig, FcFontSort, [ 460 XFT_LIBS="$XFT_LIBS -lfontconfig" 461 ], []) 462 CFLAGS=$tk_oldCFlags 463 LIBS=$tk_oldLibs 464 fi 465 dnl print a warning if xft is unusable and was specifically requested 466 if test "$found_xft" = "no" ; then 467 if test "$enable_xft" = "yes" ; then 468 AC_MSG_WARN([Can't find xft configuration, or xft is unusable]) 469 fi 470 enable_xft=no 471 XFT_CFLAGS="" 472 XFT_LIBS="" 473 else 474 enable_xft=yes 475 fi 476 fi 477 if test $enable_xft = "yes" ; then 478 UNIX_FONT_OBJS=tkUnixRFont.o 479 AC_DEFINE(HAVE_XFT, 1, [Have we turned on XFT (antialiased fonts)?]) 480 else 481 UNIX_FONT_OBJS=tkUnixFont.o 482 fi 483 AC_SUBST(XFT_CFLAGS) 484 AC_SUBST(XFT_LIBS) 485 AC_SUBST(UNIX_FONT_OBJS) 486fi 487 488#-------------------------------------------------------------------- 489# XXX Do this last. 490# It might modify XLIBSW which could affect other tests. 491# 492# Check whether the header and library for the XScreenSaver 493# extension are available, and set HAVE_XSS if so. 494# XScreenSaver is needed for Tk_GetUserInactiveTime(). 495#-------------------------------------------------------------------- 496 497if test $tk_aqua = no; then 498 tk_oldCFlags=$CFLAGS 499 CFLAGS="$CFLAGS $XINCLUDES" 500 tk_oldLibs=$LIBS 501 LIBS="$tk_oldLibs $XLIBSW" 502 xss_header_found=no 503 xss_lib_found=no 504 AC_MSG_CHECKING([whether to try to use XScreenSaver]) 505 AC_ARG_ENABLE(xss, 506 AS_HELP_STRING([--enable-xss],[use XScreenSaver for activity timer (default: on)]), 507 [enable_xss=$enableval], [enable_xss=yes]) 508 if test "$enable_xss" = "no" ; then 509 AC_MSG_RESULT([$enable_xss]) 510 else 511 AC_MSG_RESULT([$enable_xss]) 512 AC_CHECK_HEADER(X11/extensions/scrnsaver.h, [ 513 xss_header_found=yes 514 ],,[#include <X11/Xlib.h>]) 515 AC_CHECK_FUNC(XScreenSaverQueryInfo,,[ 516 AC_CHECK_LIB(Xext, XScreenSaverQueryInfo, [ 517 XLIBSW="$XLIBSW -lXext" 518 xss_lib_found=yes 519 ], [ 520 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo, [ 521 if test "$tcl_cv_ld_weak_l" = yes; then 522 # On Darwin, weak link libXss if possible, 523 # as it is only available on Tiger or later. 524 XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext" 525 else 526 XLIBSW="$XLIBSW -lXss -lXext" 527 fi 528 xss_lib_found=yes 529 ],, -lXext) 530 ]) 531 ]) 532 fi 533 if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then 534 AC_DEFINE(HAVE_XSS, 1, [Is XScreenSaver available?]) 535 fi 536 CFLAGS=$tk_oldCFlags 537 LIBS=$tk_oldLibs 538fi 539 540#-------------------------------------------------------------------- 541# Figure out whether "char" is unsigned. If so, set a 542# #define for __CHAR_UNSIGNED__. 543#-------------------------------------------------------------------- 544 545AC_C_CHAR_UNSIGNED 546 547#-------------------------------------------------------------------- 548# The statements below define a collection of symbols related to 549# building libtk as a shared library instead of a static library. 550#-------------------------------------------------------------------- 551 552eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}" 553eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" 554eval "TK_LIB_FILE_TCL8=libtk${LIB_SUFFIX}" 555if test ${TCL_MAJOR_VERSION} = 8 ; then 556eval "TK_LIB_FILE=libtk${LIB_SUFFIX}" 557else 558eval "TK_LIB_FILE=libtcl9tk${LIB_SUFFIX}" 559fi 560eval "TK_LIB_FILE_TCL9=libtcl9tk${LIB_SUFFIX}" 561 562# tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed 563# since on some platforms TK_LIB_FILE contains shell escapes. 564 565eval "TK_LIB_FILE=${TK_LIB_FILE}" 566 567if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then 568 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \${TCL_STUB_LIB_SPEC}" 569 TCL_STUB_FLAGS="-DUSE_TCL_STUBS" 570fi 571 572test -z "$TK_LIBRARY" && TK_LIBRARY='$(prefix)/lib/tk$(VERSION)' 573PRIVATE_INCLUDE_DIR='$(includedir)' 574HTML_DIR='$(DISTDIR)/html' 575TK_PKG_DIR='tk$(VERSION)' 576TK_RSRC_FILE='tk$(VERSION).rsrc' 577WISH_RSRC_FILE='wish$(VERSION).rsrc' 578 579# Note: in the following variable, it's important to use the absolute 580# path name of the Tcl directory rather than "..": this is because 581# AIX remembers this path and will attempt to use it at run-time to look 582# up the Tcl library. 583 584if test "`uname -s`" = "Darwin" ; then 585 SC_ENABLE_FRAMEWORK 586 TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk ['{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}']`" 587 TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}/${TK_LIB_FILE}" -unexported_symbols_list $$(f=$(TK_LIB_FILE).E && nm -gp tkMacOSX*.o 2>/dev/null | awk "/^[[0-9a-f]]+ . \.objc/ {print \$$3}" > $$f && nm -gjp "$(TCL_BIN_DIR)"/$(TCL_STUB_LIB_FILE) | grep ^_[[^_]] >> $$f && echo $$f)' 588 echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000' 589 TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist' 590 EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist' 591 EXTRA_WISH_LIBS=${EXTRA_WISH_LIBS}' -sectcreate __TEXT __credits_html Credits.html' 592 if test "${SHARED_BUILD}" = "0"; then 593 EXTRA_WISH_LIBS=${EXTRA_WISH_LIBS}' -ObjC' 594 fi 595 EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic' 596 AC_CONFIG_FILES([Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in Credits.html:../macosx/Credits.html.in]) 597 for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done 598 TK_YEAR="`date +%Y`" 599fi 600 601if test "$FRAMEWORK_BUILD" = "1" ; then 602 AC_DEFINE(TK_FRAMEWORK, 1, [Is Tk built as a framework?]) 603 # Construct a fake local framework structure to make linking with 604 # '-framework Tk' and running of tktest work 605 AC_CONFIG_COMMANDS([Tk.framework], [n=Tk && 606 f=$n.framework && v=Versions/$VERSION && 607 rm -rf $f && mkdir -p $f/$v/Resources && 608 ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v && 609 ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist && 610 if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi && 611 unset n f v 612 ], VERSION=${TK_VERSION} && tk_aqua=${tk_aqua}) 613 LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH" 614 if test "${libdir}" = '${exec_prefix}/lib'; then 615 # override libdir default 616 libdir="/Library/Frameworks" 617 fi 618 if test ${TCL_MAJOR_VERSION} = 8 ; then 619 TK_LIB_FILE="Tk" 620 else 621 TK_LIB_FILE="Tk" 622 fi 623 TK_LIB_FILE_TCL8="Tk" 624 TK_LIB_FILE_TCL9="Tk" 625 TK_LIB_FLAG="-framework Tk" 626 TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk" 627 TK_LIB_SPEC="-F${libdir} -framework Tk" 628 libdir="${libdir}/Tk.framework/Versions/\${VERSION}" 629 TK_LIBRARY="${libdir}/Resources/Scripts" 630 TK_PKG_DIR="Resources/Scripts" 631 TK_RSRC_FILE="Tk.rsrc" 632 WISH_RSRC_FILE="Wish.rsrc" 633 includedir="${libdir}/Headers" 634 PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders" 635 HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk" 636 EXTRA_INSTALL="install-private-headers html-tk" 637 EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html' 638 EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"' 639 EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Credits.html to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Credits.html "$(LIB_INSTALL_DIR)/Resources"' 640 EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"' 641 if test $tk_aqua = yes; then 642 EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done' 643 EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'/" && $(INSTALL_DATA_DIR) "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"' 644 bindir="${libdir}/Resources/Wish.app/Contents/MacOS" 645 EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"' 646 EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA_DIR) "$(BIN_INSTALL_DIR)/../Resources"' 647 EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"' 648 EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"' 649 EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Credits.html to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) Credits.html "$(BIN_INSTALL_DIR)/../Resources"' 650 fi 651 EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."' 652 # Don't use AC_DEFINE for the following as the framework version define 653 # needs to go into the Makefile even when using autoheader, so that we 654 # can pick up a potential make override of VERSION. Also, don't put this 655 # into CFLAGS as it should not go into tkConfig.sh 656 EXTRA_CC_SWITCHES="$EXTRA_CC_SWITCHES"' -DTK_FRAMEWORK_VERSION=\"$(VERSION)\"' 657else 658 if test $tk_aqua = yes; then 659 EXTRA_INSTALL_BINARIES='@echo "Installing Images to $(LIB_INSTALL_DIR)/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)"; done' 660 fi 661 # libdir must be a fully qualified path and not ${exec_prefix}/lib 662 eval libdir="$libdir" 663 TK_LIB_FLAG="-l" 664 if test "${TCL_MAJOR_VERSION}" -gt 8 ; then 665 TK_LIB_FLAG="${TK_LIB_FLAG}tcl9" 666 fi 667 if test "${ac_cv_cygwin}" = "yes" -a "$SHARED_BUILD" = "1"; then 668 TK_LIB_FLAG="${TK_LIB_FLAG}tk`echo ${TK_VERSION} | tr -d .`" 669 TK_BUILD_LIB_SPEC="-L\$(TOP_DIR)/win ${TK_LIB_FLAG}" 670 else 671 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then 672 TK_LIB_FLAG="${TK_LIB_FLAG}tk${TK_VERSION}" 673 else 674 TK_LIB_FLAG="${TK_LIB_FLAG}tk`echo ${TK_VERSION} | tr -d .`" 675 fi 676 TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}" 677 fi 678 TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" 679fi 680 681#-------------------------------------------------------------------- 682# Zipfs support - Tip 430 683#-------------------------------------------------------------------- 684AC_ARG_ENABLE(zipfs, 685 AS_HELP_STRING([--enable-zipfs],[build with Zipfs support (default: on)]), 686 [tcl_ok=$enableval], [tcl_ok=yes]) 687if test "$tcl_ok" = "yes" -a "x$enable_framework" != "xyes"; then 688 # 689 # Find a native compiler 690 # 691 AX_CC_FOR_BUILD 692 # 693 # Find a native zip implementation 694 # 695 SC_ZIPFS_SUPPORT 696 ZIPFS_BUILD=1 697 TK_ZIP_FILE=libtk${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_PATCH_LEVEL}.zip 698else 699 ZIPFS_BUILD=0 700 TK_ZIP_FILE= 701fi 702# Do checking message here to not mess up interleaved configure output 703AC_MSG_CHECKING([for building with zipfs]) 704if test "${ZIPFS_BUILD}" = 1; then 705 if test "${SHARED_BUILD}" = 0; then 706 ZIPFS_BUILD=2; 707 AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?]) 708 INSTALL_LIBRARIES=install-demos 709 AC_MSG_RESULT([yes]) 710 else 711 AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\ 712 INSTALL_LIBRARIES=install-demos 713 AC_MSG_RESULT([yes]) 714 fi 715else 716AC_MSG_RESULT([no]) 717INSTALL_LIBRARIES=install-libraries 718INSTALL_MSGS=install-msgs 719fi 720AC_SUBST(ZIPFS_BUILD) 721AC_SUBST(TK_ZIP_FILE) 722AC_SUBST(INSTALL_LIBRARIES) 723AC_SUBST(INSTALL_MSGS) 724 725 726#-------------------------------------------------------------------- 727# The statements below define various symbols relating to Tk 728# stub support. 729#-------------------------------------------------------------------- 730 731# Replace ${VERSION} with contents of ${TK_VERSION} 732eval "TK_STUB_LIB_FILE=libtkstub${TK_UNSHARED_LIB_SUFFIX}" 733eval "TK_STUB_LIB_DIR=${libdir}" 734 735if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then 736 TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}" 737else 738 TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`" 739fi 740 741TK_BUILD_STUB_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}" 742TK_STUB_LIB_SPEC="-L${TK_STUB_LIB_DIR} ${TK_STUB_LIB_FLAG}" 743TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}" 744TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}" 745 746# Install time header dir can be set via --includedir 747eval "TK_INCLUDE_SPEC=\"-I${includedir}\"" 748 749#------------------------------------------------------------------------ 750# Demo dir 751#------------------------------------------------------------------------ 752 753AS_IF([test x"${DEMO_DIR}" = x], [DEMO_DIR='$(TK_LIBRARY)/demos']) 754eval "TK_DEMO_DIR=\"`echo ${DEMO_DIR} | tr '()' '{}'`\"" 755eval "TK_DEMO_DIR=\"`echo ${TK_DEMO_DIR} | tr '()' '{}'`\"" 756AC_SUBST(DEMO_DIR) 757AC_SUBST(TK_DEMO_DIR) 758 759#------------------------------------------------------------------------ 760# tkConfig.sh refers to this by a different name 761#------------------------------------------------------------------------ 762 763TK_SHARED_BUILD=${SHARED_BUILD} 764 765AC_SUBST(TK_VERSION) 766AC_SUBST(TK_MAJOR_VERSION) 767AC_SUBST(TK_MINOR_VERSION) 768AC_SUBST(TK_PATCH_LEVEL) 769AC_SUBST(TK_YEAR) 770 771AC_SUBST(TK_LIB_FILE) 772AC_SUBST(TK_LIB_FILE_TCL8) 773AC_SUBST(TK_LIB_FILE_TCL9) 774AC_SUBST(TK_LIB_FLAG) 775AC_SUBST(TK_LIB_SPEC) 776AC_SUBST(TK_STUB_LIB_FILE) 777AC_SUBST(TK_STUB_LIB_FLAG) 778AC_SUBST(TK_STUB_LIB_SPEC) 779AC_SUBST(TK_STUB_LIB_PATH) 780AC_SUBST(TK_INCLUDE_SPEC) 781AC_SUBST(TK_BUILD_STUB_LIB_SPEC) 782AC_SUBST(TK_BUILD_STUB_LIB_PATH) 783 784AC_SUBST(TK_SRC_DIR) 785 786AC_SUBST(TK_SHARED_BUILD) 787AC_SUBST(LD_LIBRARY_PATH_VAR) 788 789AC_SUBST(TK_BUILD_LIB_SPEC) 790 791AC_SUBST(TCL_STUB_FLAGS) 792AC_SUBST(XINCLUDES) 793AC_SUBST(XLIBSW) 794AC_SUBST(LOCALES) 795 796AC_SUBST(TK_WINDOWINGSYSTEM) 797AC_SUBST(TK_PKG_DIR) 798AC_SUBST(TK_LIBRARY) 799AC_SUBST(LIB_RUNTIME_DIR) 800AC_SUBST(PRIVATE_INCLUDE_DIR) 801AC_SUBST(HTML_DIR) 802 803AC_SUBST(EXTRA_CC_SWITCHES) 804AC_SUBST(EXTRA_APP_CC_SWITCHES) 805AC_SUBST(EXTRA_INSTALL) 806AC_SUBST(EXTRA_INSTALL_BINARIES) 807AC_SUBST(EXTRA_BUILD_HTML) 808AC_SUBST(EXTRA_WISH_LIBS) 809AC_SUBST(CFBUNDLELOCALIZATIONS) 810 811AC_SUBST(TK_RSRC_FILE) 812AC_SUBST(WISH_RSRC_FILE) 813AC_SUBST(LIB_RSRC_FILE) 814AC_SUBST(APP_RSRC_FILE) 815AC_SUBST(REZ) 816AC_SUBST(REZ_FLAGS) 817 818AC_CONFIG_FILES([ 819 Makefile:../unix/Makefile.in 820 tkConfig.sh:../unix/tkConfig.sh.in 821 tk.pc:../unix/tk.pc.in 822]) 823AC_OUTPUT 824 825dnl Local Variables: 826dnl mode: autoconf 827dnl End: 828