#! /bin/bash -norc dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. # # RCS: @(#) $Id: configure.in,v 1.169 2010/02/19 15:02:54 dkf Exp $ AC_INIT([tk],[8.6]) AC_PREREQ(2.59) dnl This is only used when included from macosx/configure.ac m4_ifdef([SC_USE_CONFIG_HEADERS], [ AC_CONFIG_HEADERS([tkConfig.h:../unix/tkConfig.h.in]) AC_CONFIG_COMMANDS_PRE([DEFS="-DHAVE_TK_CONFIG_H -imacros tkConfig.h"]) AH_TOP([ #ifndef _TKCONFIG #define _TKCONFIG]) AH_BOTTOM([ /* Undef unused package specific autoheader defines so that we can * include both tclConfig.h and tkConfig.h at the same time: */ /* override */ #undef PACKAGE_NAME /* override */ #undef PACKAGE_STRING /* override */ #undef PACKAGE_TARNAME #endif /* _TKCONFIG */]) ]) TK_VERSION=8.6 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=6 TK_PATCH_LEVEL="b1.1" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" #-------------------------------------------------------------------- # Find and load the tclConfig.sh file #-------------------------------------------------------------------- SC_PATH_TCLCONFIG SC_LOAD_TCLCONFIG SC_PROG_TCLSH SC_BUILD_TCLSH #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ if test "${prefix}" = "NONE"; then prefix="$TCL_PREFIX" fi if test "${exec_prefix}" = "NONE"; then exec_prefix=$prefix fi # Make sure srcdir is fully qualified! srcdir="`cd "$srcdir" ; pwd`" TK_SRC_DIR="`cd "$srcdir"/..; pwd`" #------------------------------------------------------------------------ # Compress and/or soft link the manpages? #------------------------------------------------------------------------ SC_CONFIG_MANPAGES #------------------------------------------------------------------------ # Standard compiler checks #------------------------------------------------------------------------ # If the user did not set CFLAGS, set it now to keep # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi AC_PROG_CC AC_C_INLINE # limits header checks must come early to prevent # an autoconf bug that throws errors on configure AC_CHECK_HEADER(limits.h, [AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have ?])], [AC_DEFINE(NO_LIMITS_H, 1, [Do we have ?])]) #-------------------------------------------------------------------- # Supply a substitute for stdlib.h if it doesn't define strtol, # strtoul, or strtod (which it doesn't in some versions of SunOS). #-------------------------------------------------------------------- AC_CHECK_HEADER(stdlib.h, tk_ok=1, tk_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tk_ok=0) AC_EGREP_HEADER(strtoul, stdlib.h, , tk_ok=0) AC_EGREP_HEADER(strtod, stdlib.h, , tk_ok=0) if test $tk_ok = 0; then AC_DEFINE(NO_STDLIB_H, 1, [Do we have ?]) fi #------------------------------------------------------------------------ # If we're using GCC, see if the compiler understands -pipe. If so, use it. # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ if test -z "$no_pipe" && test -n "$GCC"; then AC_CACHE_CHECK([if the compiler understands -pipe], tcl_cv_cc_pipe, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_pipe = yes; then CFLAGS="$CFLAGS -pipe" fi fi #------------------------------------------------------------------------ # Threads support - this auto-enables if Tcl was compiled threaded #------------------------------------------------------------------------ SC_ENABLE_THREADS # Add the threads support libraries LIBS="$LIBS$THREADS_LIBS" SC_ENABLE_SHARED #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This # macro depends on the value of SHARED_BUILD, and should be called # after SC_ENABLE_SHARED checks the configure switches. #-------------------------------------------------------------------- SC_CONFIG_CFLAGS SC_ENABLE_SYMBOLS #-------------------------------------------------------------------- # Detect what compiler flags to set for 64-bit support. #-------------------------------------------------------------------- SC_TCL_EARLY_FLAGS SC_TCL_64BIT_FLAGS #-------------------------------------------------------------------- # Check endianness because we can optimize some operations #-------------------------------------------------------------------- AC_C_BIGENDIAN #------------------------------------------------------------------------ # If Tcl and Tk are installed in different places, adjust the library # search path to reflect this. #------------------------------------------------------------------------ LIB_RUNTIME_DIR='$(libdir)' if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib" fi if test "$TCL_PREFIX" != "$prefix"; then AC_MSG_WARN([ Different --prefix selected for Tk and Tcl! [[package require Tk]] may not work correctly in tclsh.]) fi #-------------------------------------------------------------------- # Include sys/select.h if it exists and if it supplies things # that appear to be useful and aren't already in sys/types.h. # This appears to be true only on the RS/6000 under AIX. Some # systems like OSF/1 have a sys/select.h that's of no use, and # other systems like SCO UNIX have a sys/select.h that's # pernicious. If "fd_set" isn't defined anywhere then set a # special flag. #-------------------------------------------------------------------- AC_CACHE_CHECK([for fd_set in sys/types], tcl_cv_type_fd_set, [ AC_TRY_COMPILE([#include ],[fd_set readMask, writeMask;], tcl_cv_type_fd_set=yes, tcl_cv_type_fd_set=no)]) tk_ok=$tcl_cv_type_fd_set if test $tk_ok = no; then AC_CACHE_CHECK([for fd_mask in sys/select], tcl_cv_grep_fd_mask, [ AC_EGREP_HEADER(fd_mask, sys/select.h, tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)]) if test $tcl_cv_grep_fd_mask = present; then AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Should we include ?]) tk_ok=yes fi fi if test $tk_ok = no; then AC_DEFINE(NO_FD_SET, 1, [Do we have fd_set?]) fi #------------------------------------------------------------------------------ # Find out all about time handling differences. #------------------------------------------------------------------------------ AC_CHECK_HEADERS(sys/time.h) AC_HEADER_TIME #-------------------------------------------------------------------- # Under Solaris 2.4, strtod returns the wrong value for the # terminating character under some conditions. Check for this # and if the problem exists use a substitute procedure # "fixstrtod" (provided by Tcl) that corrects the error. #-------------------------------------------------------------------- SC_BUGGY_STRTOD #-------------------------------------------------------------------- # Check for various typedefs and provide substitutes if # they don't exist. #-------------------------------------------------------------------- AC_TYPE_MODE_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UID_T AC_CHECK_TYPE([intptr_t], [ AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [ AC_CACHE_CHECK([for pointer-size signed integer type], tcl_cv_intptr_t, [ for tcl_cv_intptr_t in "int" "long" "long long" none; do if test "$tcl_cv_intptr_t" != none; then AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT], [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])], [tcl_ok=yes], [tcl_ok=no]) test "$tcl_ok" = yes && break; fi done]) if test "$tcl_cv_intptr_t" != none; then AC_DEFINE_UNQUOTED([intptr_t], [$tcl_cv_intptr_t], [Signed integer type wide enough to hold a pointer.]) fi ]) AC_CHECK_TYPE([uintptr_t], [ AC_DEFINE([HAVE_UINTPTR_T], 1, [Do we have the uintptr_t type?])], [ AC_CACHE_CHECK([for pointer-size unsigned integer type], tcl_cv_uintptr_t, [ for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \ none; do if test "$tcl_cv_uintptr_t" != none; then AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT], [[sizeof (void *) <= sizeof ($tcl_cv_uintptr_t)]])], [tcl_ok=yes], [tcl_ok=no]) test "$tcl_ok" = yes && break; fi done]) if test "$tcl_cv_uintptr_t" != none; then AC_DEFINE_UNQUOTED([uintptr_t], [$tcl_cv_uintptr_t], [Unsigned integer type wide enough to hold a pointer.]) fi ]) #------------------------------------------- # In OS/390 struct pwd has no pw_gecos field #------------------------------------------- AC_CACHE_CHECK([pw_gecos in struct pwd], tcl_cv_pwd_pw_gecos, [ AC_TRY_COMPILE([#include ], [struct passwd pwd; pwd.pw_gecos;], tcl_cv_pwd_pw_gecos=yes, tcl_cv_pwd_pw_gecos=no)]) if test $tcl_cv_pwd_pw_gecos = yes; then AC_DEFINE(HAVE_PW_GECOS, 1, [Does struct password have a pw_gecos field?]) fi #-------------------------------------------------------------------- # On Mac OS X, we can build either with X11 or with Aqua #-------------------------------------------------------------------- MACOSX_SRC_DIR=macosx if test "`uname -s`" = "Darwin" ; then AC_MSG_CHECKING([whether to use Aqua]) AC_ARG_ENABLE(aqua, AC_HELP_STRING([--enable-aqua=yes|carbon|no], [use Aqua windowingsystem on Mac OS X (default: no)]), [tk_aqua=$enableval], [tk_aqua=no]) if test $tk_aqua = yes -o $tk_aqua = cocoa; then tk_aqua=yes if test ! -d /System/Library/Frameworks/Cocoa.framework; then AC_MSG_WARN([Aqua can only be used when Cocoa is available]) tk_aqua=no fi if test "`uname -r | awk -F. '{print [$]1}'`" -lt 9; then AC_MSG_WARN([Aqua requires Mac OS X 10.5 or later]) tk_aqua=no fi elif test $tk_aqua = carbon; then if test ! -d /System/Library/Frameworks/Carbon.framework; then AC_MSG_WARN([Aqua can only be used when Carbon is available]) tk_aqua=no fi if test "`uname -r | awk -F. '{print [$]1}'`" -lt 6; then AC_MSG_WARN([Aqua requires Mac OS X 10.2 or later]) tk_aqua=no fi else tk_aqua=no fi if test $tk_aqua != no -a $tcl_corefoundation = no; then AC_MSG_WARN([Aqua can only be used when CoreFoundation is available]) tk_aqua=no fi if test $tk_aqua = carbon; then MACOSX_SRC_DIR=carbon AC_MSG_RESULT([yes (deprecated legacy Carbon implementation)]) else AC_MSG_RESULT([$tk_aqua]) fi if test "$fat_32_64" = yes; then if test $tk_aqua = no; then AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [ for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include" LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" AC_TRY_LINK([#include ], [XrmInitialize();], tcl_cv_lib_x11_64=yes, tcl_cv_lib_x11_64=no) for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done]) fi # remove 64-bit arch flags from CFLAGS et al. for combined 32 & 64 bit # fat builds if configuration does not support 64-bit. if test $tk_aqua = carbon -o "$tcl_cv_lib_x11_64" = no; then AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags]) for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' done fi fi if test $tk_aqua = no; then # check if weak linking whole libraries is possible. AC_CACHE_CHECK([if ld accepts -weak-l flag], tcl_cv_ld_weak_l, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-weak-lm" AC_TRY_LINK([#include ], [double f = sin(1.0);], tcl_cv_ld_weak_l=yes, tcl_cv_ld_weak_l=no) LDFLAGS=$hold_ldflags]) fi AC_CHECK_HEADERS(AvailabilityMacros.h) if test "$ac_cv_header_AvailabilityMacros_h" = yes; then AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" AC_TRY_LINK([ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 #endif #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020 #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020 #endif int rand(void) __attribute__((weak_import)); ], [rand();], tcl_cv_cc_weak_import=yes, tcl_cv_cc_weak_import=no) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_weak_import = yes; then AC_DEFINE(HAVE_WEAK_IMPORT, 1, [Is weak import available?]) fi AC_CACHE_CHECK([if Darwin SUSv3 extensions are available], tcl_cv_cc_darwin_c_source, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" AC_TRY_COMPILE([ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 #endif #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050 #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050 #endif #define _DARWIN_C_SOURCE 1 #include ],,tcl_cv_cc_darwin_c_source=yes, tcl_cv_cc_darwin_c_source=no) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_darwin_c_source = yes; then AC_DEFINE(_DARWIN_C_SOURCE, 1, [Are Darwin SUSv3 extensions available?]) fi fi else tk_aqua=no fi if test $tk_aqua != no; then if test $tk_aqua = yes; then LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit" EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c -fobjc-gc' else LIBS="$LIBS -framework Carbon -framework IOKit" CFLAGS="$CFLAGS -fpascal-strings" fi AC_DEFINE(MAC_OSX_TK, 1, [Are we building TkAqua?]) TK_WINDOWINGSYSTEM=AQUA if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?]) fi else #-------------------------------------------------------------------- # Locate the X11 header files and the X11 library archive. Try # the ac_path_x macro first, but if it doesn't find the X stuff # (e.g. because there's no xmkmf program) then check through # a list of possible directories. Under some conditions the # autoconf macro will return an include directory that contains # no include files, so double-check its result just to be safe. #-------------------------------------------------------------------- SC_PATH_X TK_WINDOWINGSYSTEM=X11 fi #-------------------------------------------------------------------- # Various manipulations on the search path used at runtime to # find shared libraries: # 1. If the X library binaries are in a non-standard directory, # add the X library location into that search path. # 2. On systems such as AIX and Ultrix that use "-L" as the # search path option, colons cannot be used to separate # directories from each other. Change colons to " -L". # 3. Create two sets of search flags, one for use in cc lines # and the other for when the linker is invoked directly. In # the second case, '-Wl,' must be stripped off and commas must # be replaced by spaces. #-------------------------------------------------------------------- if test "x${x_libraries}" != "x"; then LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${x_libraries}" fi if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'` fi #-------------------------------------------------------------------- # Check for the existence of various libraries. The order here # is important, so that then end up in the right order in the # command line generated by make. The -lsocket and -lnsl libraries # require a couple of special tricks: # 1. Use "connect" and "accept" to check for -lsocket, and # "gethostbyname" to check for -lnsl. # 2. Use each function name only once: can't redo a check because # autoconf caches the results of the last check and won't redo it. # 3. Use -lnsl and -lsocket only if they supply procedures that # aren't already present in the normal libraries. This is because # IRIX 5.2 has libraries, but they aren't needed and they're # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- if test $tk_aqua = no; then AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"]) fi #-------------------------------------------------------------------- # One more check related to the X libraries. The standard releases # of Ultrix don't support the "xauth" mechanism, so send won't work # unless TK_NO_SECURITY is defined. However, there are usually copies # of the MIT X server available as well, which do support xauth. # Check for the MIT stuff and use it if it exists. # # Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1) # because it can't deal with the "-" in the library name. #-------------------------------------------------------------------- if test -d /usr/include/mit -a $tk_aqua = no; then AC_MSG_CHECKING([MIT X libraries]) tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS -I/usr/include/mit" tk_oldLibs=$LIBS LIBS="$LIBS -lX11-mit" AC_TRY_LINK([ #include ], [ XOpenDisplay(0); ], [ AC_MSG_RESULT([yes]) XLIBSW="-lX11-mit" XINCLUDES="-I/usr/include/mit" ], AC_MSG_RESULT([no])) CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi #-------------------------------------------------------------------- # Check whether the header and library for the XScreenSaver # extension are available, and set HAVE_XSS if so. # XScreenSaver is needed for Tk_GetUserInactiveTime(). #-------------------------------------------------------------------- if test $tk_aqua = no; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES" tk_oldLibs=$LIBS LIBS="$tk_oldLibs $XLIBSW" xss_header_found=no xss_lib_found=no AC_MSG_CHECKING([whether to try to use XScreenSaver]) AC_ARG_ENABLE(xss, AC_HELP_STRING([--enable-xss], [use XScreenSaver for activity timer (default: on)]), [enable_xss=$enableval], [enable_xss=yes]) if test "$enable_xss" = "no" ; then AC_MSG_RESULT([$enable_xss]) else AC_MSG_RESULT([$enable_xss]) AC_CHECK_HEADER(X11/extensions/scrnsaver.h, [ xss_header_found=yes ],,[#include ]) AC_CHECK_FUNC(XScreenSaverQueryInfo,,[ AC_CHECK_LIB(Xext, XScreenSaverQueryInfo, [ XLIBSW="$XLIBSW -lXext" xss_lib_found=yes ], [ AC_CHECK_LIB(Xss, XScreenSaverQueryInfo, [ if test "$tcl_cv_ld_weak_l" = yes; then # On Darwin, weak link libXss if possible, # as it is only available on Tiger or later. XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext" else XLIBSW="$XLIBSW -lXss -lXext" fi xss_lib_found=yes ],, -lXext) ]) ]) fi if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then AC_DEFINE(HAVE_XSS, 1, [Is XScreenSaver available?]) fi CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi #-------------------------------------------------------------------- # Check for freetype / fontconfig / Xft support. #-------------------------------------------------------------------- if test $tk_aqua = no; then AC_MSG_CHECKING([whether to use xft]) AC_ARG_ENABLE(xft, AC_HELP_STRING([--enable-xft], [use freetype/fontconfig/xft (default: on)]), [enable_xft=$enableval], [enable_xft="default"]) XFT_CFLAGS="" XFT_LIBS="" if test "$enable_xft" = "no" ; then AC_MSG_RESULT([$enable_xft]) else found_xft="yes" dnl make sure package configurator (xft-config or pkg-config dnl says that xft is present. XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no" XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no" if test "$found_xft" = "no" ; then found_xft=yes XFT_CFLAGS=`pkg-config --cflags xft 2>/dev/null` || found_xft="no" XFT_LIBS=`pkg-config --libs xft 2>/dev/null` || found_xft="no" fi AC_MSG_RESULT([$found_xft]) dnl make sure that compiling against Xft header file doesn't bomb if test "$found_xft" = "yes" ; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" tk_oldLibs=$LIBS LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" AC_CHECK_HEADER(X11/Xft/Xft.h, [], [ found_xft=no ],[#include ]) CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi dnl make sure that linking against Xft libraries finds freetype if test "$found_xft" = "yes" ; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" tk_oldLibs=$LIBS LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" AC_CHECK_LIB(Xft, FT_New_Face, [], [ found_xft=no ]) CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi dnl print a warning if xft is unusable and was specifically requested if test "$found_xft" = "no" ; then if test "$enable_xft" = "yes" ; then AC_MSG_WARN([Can't find xft configuration, or xft is unusable]) fi enable_xft=no XFT_CFLAGS="" XFT_LIBS="" else enable_xft=yes fi fi if test $enable_xft = "yes" ; then UNIX_FONT_OBJS=tkUnixRFont.o AC_DEFINE(HAVE_XFT, 1, [Have we turned on XFT (antialiased fonts)?]) else UNIX_FONT_OBJS=tkUnixFont.o fi AC_SUBST(XFT_CFLAGS) AC_SUBST(XFT_LIBS) AC_SUBST(UNIX_FONT_OBJS) fi #-------------------------------------------------------------------- # Figure out whether "char" is unsigned. If so, set a # #define for __CHAR_UNSIGNED__. #-------------------------------------------------------------------- AC_C_CHAR_UNSIGNED #-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtk as a shared library instead of a static library. #-------------------------------------------------------------------- eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}" eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" eval "TK_LIB_FILE=libtk${LIB_SUFFIX}" # tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed # since on some platforms TK_LIB_FILE contains shell escapes. eval "TK_LIB_FILE=${TK_LIB_FILE}" if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \${TCL_STUB_LIB_SPEC}" TCL_STUB_FLAGS="-DUSE_TCL_STUBS" fi TK_LIBRARY='$(prefix)/lib/tk$(VERSION)' PRIVATE_INCLUDE_DIR='$(includedir)' HTML_DIR='$(DISTDIR)/html' TK_PKG_DIR='tk$(VERSION)' TK_RSRC_FILE='tk$(VERSION).rsrc' WISH_RSRC_FILE='wish$(VERSION).rsrc' # Note: in the following variable, it's important to use the absolute # path name of the Tcl directory rather than "..": this is because # AIX remembers this path and will attempt to use it at run-time to look # up the Tcl library. if test "`uname -s`" = "Darwin" ; then SC_ENABLE_FRAMEWORK 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)}']`" TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}"/${TK_LIB_FILE}' if test $tk_aqua = yes; then TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -unexported_symbols_list $$(f=$(TK_LIB_FILE).E && nm -gp tkMacOSX*.o 2>/dev/null | awk "/^[[0-9a-f]]+ . \.objc/ {print \$$3}" > $$f && echo $$f)' fi echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000' TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist' EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist' EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic' AC_CONFIG_FILES([Tk-Info.plist:../${MACOSX_SRC_DIR}/Tk-Info.plist.in Wish-Info.plist:../${MACOSX_SRC_DIR}/Wish-Info.plist.in]) for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}$l"; done TK_YEAR="`date +%Y`" fi if test "$FRAMEWORK_BUILD" = "1" ; then AC_DEFINE(TK_FRAMEWORK, 1, [Is Tk built as a framework?]) # Construct a fake local framework structure to make linking with # '-framework Tk' and running of tktest work AC_CONFIG_COMMANDS([Tk.framework], [n=Tk && f=$n.framework && v=Versions/$VERSION && rm -rf $f && mkdir -p $f/$v/Resources && ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v && ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist && if test $tk_aqua != no; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi && unset n f v ], VERSION=${TK_VERSION} && tk_aqua=${tk_aqua}) LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH" if test "${libdir}" = '${exec_prefix}/lib'; then # override libdir default libdir="/Library/Frameworks" fi TK_LIB_FILE="Tk" TK_LIB_FLAG="-framework Tk" TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk" TK_LIB_SPEC="-F${libdir} -framework Tk" libdir="${libdir}/Tk.framework/Versions/\${VERSION}" TK_LIBRARY="${libdir}/Resources/Scripts" TK_PKG_DIR="Resources/Scripts" TK_RSRC_FILE="Tk.rsrc" WISH_RSRC_FILE="Wish.rsrc" includedir="${libdir}/Headers" PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders" HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk" EXTRA_INSTALL="install-private-headers html-tk" EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html' 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"' 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"' if test $tk_aqua != no; then if test $tk_aqua = yes; then 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' else EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing ${TK_RSRC_FILE} to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "${TK_RSRC_FILE}" "$(LIB_INSTALL_DIR)/Resources"' fi 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)"' bindir="${libdir}/Resources/Wish.app/Contents/MacOS" 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"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && mkdir -p "$(BIN_INSTALL_DIR)/../Resources"' if test $tk_aqua = yes; then EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"' 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"' else EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.icns" "$(BIN_INSTALL_DIR)/../Resources" && echo "Installing ${WISH_RSRC_FILE} to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "${WISH_RSRC_FILE}" "$(BIN_INSTALL_DIR)/../Resources"' fi fi 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)/../.."' # Don't use AC_DEFINE for the following as the framework version define # needs to go into the Makefile even when using autoheader, so that we # can pick up a potential make override of VERSION. Also, don't put this # into CFLAGS as it should not go into tkConfig.sh EXTRA_CC_SWITCHES="$EXTRA_CC_SWITCHES"' -DTK_FRAMEWORK_VERSION=\"$(VERSION)\"' else if test $tk_aqua = yes; then 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' fi # libdir must be a fully qualified path and not ${exec_prefix}/lib eval libdir="$libdir" if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then TK_LIB_FLAG="-ltk${TK_VERSION}" else TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`" fi TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}" TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" else TK_BUILD_EXP_FILE="lib.exp" eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}" if test "$GCC" = "yes" ; then TK_BUILD_LIB_SPEC="-Wl,-bI:`pwd | sed -e 's/ /\\\\ /g'`/${TK_BUILD_EXP_FILE} -L`pwd | sed -e 's/ /\\\\ /g'`" TK_LIB_SPEC="-Wl,-bI:${libdir}/${TK_EXP_FILE} -L${libdir}" else TK_BUILD_LIB_SPEC="-bI:`pwd | sed -e 's/ /\\\\ /g'`/${TK_BUILD_EXP_FILE}" TK_LIB_SPEC="-bI:${libdir}/${TK_EXP_FILE}" fi fi fi # Extra bits for legacy Aqua Carbon build (carbon sources and resource files) if test $tk_aqua = carbon; then EXTRA_AQUA_OBJS='tkMacOSXCarbonEvents.o' EXTRA_AQUA_SRCS='$(TOP_DIR)/carbon/tkMacOSXCarbonEvents.c' LIB_RSRC_FILE='${TK_RSRC_FILE}' APP_RSRC_FILE='${WISH_RSRC_FILE}' REZ=/Developer/Tools/Rez REZ_FLAGS='-d "SystemSevenOrLater=1" -useDF -ro' if test "$SHARED_BUILD" = 0; then EXTRA_INSTALL_BINARIES='@echo "Installing $(TK_RSRC_FILE) to $(LIB_INSTALL_DIR)" && $(INSTALL_DATA) $(TK_RSRC_FILE) "$(LIB_INSTALL_DIR)"' TK_BUILD_LIB_SPEC="$TK_BUILD_LIB_SPEC -sectcreate __TEXT __tk_rsrc `pwd | sed -e 's/ /\\\\ /g'`/\${TK_RSRC_FILE}" TK_LIB_SPEC="$TK_LIB_SPEC -sectcreate __TEXT __tk_rsrc ${libdir}/\${TK_RSRC_FILE}" else TK_SHLIB_LD_EXTRAS="$TK_SHLIB_LD_EXTRAS -sectcreate __TEXT __tk_rsrc \${TK_RSRC_FILE}" fi fi #-------------------------------------------------------------------- # The statements below define various symbols relating to Tk # stub support. #-------------------------------------------------------------------- # Replace ${VERSION} with contents of ${TK_VERSION} eval "TK_STUB_LIB_FILE=libtkstub${TK_UNSHARED_LIB_SUFFIX}" eval "TK_STUB_LIB_DIR=${libdir}" if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}" else TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`" fi TK_BUILD_STUB_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}" TK_STUB_LIB_SPEC="-L${TK_STUB_LIB_DIR} ${TK_STUB_LIB_FLAG}" TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}" TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}" # Install time header dir can be set via --includedir eval "TK_INCLUDE_SPEC=\"-I${includedir}\"" #------------------------------------------------------------------------ # tkConfig.sh refers to this by a different name #------------------------------------------------------------------------ TK_SHARED_BUILD=${SHARED_BUILD} AC_SUBST(TK_VERSION) AC_SUBST(TK_MAJOR_VERSION) AC_SUBST(TK_MINOR_VERSION) AC_SUBST(TK_PATCH_LEVEL) AC_SUBST(TK_YEAR) AC_SUBST(TK_LIB_FILE) AC_SUBST(TK_LIB_FLAG) AC_SUBST(TK_LIB_SPEC) AC_SUBST(TK_STUB_LIB_FILE) AC_SUBST(TK_STUB_LIB_FLAG) AC_SUBST(TK_STUB_LIB_SPEC) AC_SUBST(TK_STUB_LIB_PATH) AC_SUBST(TK_INCLUDE_SPEC) AC_SUBST(TK_BUILD_STUB_LIB_SPEC) AC_SUBST(TK_BUILD_STUB_LIB_PATH) AC_SUBST(TK_SRC_DIR) AC_SUBST(TK_SHARED_BUILD) AC_SUBST(LD_LIBRARY_PATH_VAR) AC_SUBST(TK_BUILD_LIB_SPEC) AC_SUBST(TK_BUILD_EXP_FILE) AC_SUBST(TK_EXP_FILE) AC_SUBST(TCL_STUB_FLAGS) AC_SUBST(XINCLUDES) AC_SUBST(XLIBSW) AC_SUBST(LOCALES) AC_SUBST(TK_WINDOWINGSYSTEM) AC_SUBST(TK_PKG_DIR) AC_SUBST(TK_LIBRARY) AC_SUBST(LIB_RUNTIME_DIR) AC_SUBST(PRIVATE_INCLUDE_DIR) AC_SUBST(HTML_DIR) AC_SUBST(EXTRA_CC_SWITCHES) AC_SUBST(EXTRA_APP_CC_SWITCHES) AC_SUBST(EXTRA_INSTALL) AC_SUBST(EXTRA_INSTALL_BINARIES) AC_SUBST(EXTRA_BUILD_HTML) AC_SUBST(EXTRA_WISH_LIBS) AC_SUBST(EXTRA_AQUA_OBJS) AC_SUBST(EXTRA_AQUA_SRCS) AC_SUBST(CFBUNDLELOCALIZATIONS) AC_SUBST(MACOSX_SRC_DIR) AC_SUBST(TK_RSRC_FILE) AC_SUBST(WISH_RSRC_FILE) AC_SUBST(LIB_RSRC_FILE) AC_SUBST(APP_RSRC_FILE) AC_SUBST(REZ) AC_SUBST(REZ_FLAGS) AC_CONFIG_FILES([ Makefile:../unix/Makefile.in tkConfig.sh:../unix/tkConfig.sh.in tk.pc:../unix/tk.pc.in ]) AC_OUTPUT