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