From d611f8ccf5688872f01270a2c0479177e70a3334 Mon Sep 17 00:00:00 2001 From: das Date: Fri, 18 Aug 2006 07:47:10 +0000 Subject: * unix/tcl.m4 (Darwin): add support for --enable-64bit on x86_64, for universal builds including x86_64, for 64-bit CoreFoundation on Leopard and for use of -mmacosx-version-min instead of MACOSX_DEPLOYMENT_TARGET. * unix/configure.in (Darwin): remove 64-bit arch flags from CFLAGS for combined 32-bit and 64-bit universal builds, as neither TkAqua nor TkX11 can be built for 64-bit at present. * unix/configure: autoconf-2.59 * unix/tkConfig.h.in: autoheader-2.59 * macosx/Wish.xcodeproj/project.pbxproj: switch native release targets to use DWARF with dSYM, Xcode 3.0 changes. * macosx/README: updates for x86_64 and Xcode 2.3. * macosx/tkMacOSXInit.c (TkpInit): when available, use public TransformProcessType() API instead of CPSEnableForegroundOperation() SPI to notify the window server that we are a GUI application. * macosx/tkMacOSXWm.c (WmAttrGetTitlePath): use HIWindow API on >=Tiger. * macosx/tkMacOSXMouseEvent.c (GenerateToolbarButtonEvent): * macosx/tkMacOSXMenus.c (GenerateEditEvent): * macosx/tkMacOSXMenu.c (MenuSelectEvent): bzero XVirtualEvent structure before use to ensure all fields are initialized. [Bug 1542205] --- ChangeLog | 28 ++++++++- macosx/README | 22 +++---- macosx/Wish.xcodeproj/project.pbxproj | 7 ++- macosx/tkMacOSXInit.c | 42 +++++++++----- macosx/tkMacOSXMenu.c | 4 +- macosx/tkMacOSXMenus.c | 4 +- macosx/tkMacOSXMouseEvent.c | 8 +-- macosx/tkMacOSXWm.c | 19 ++++-- unix/configure | 106 +++++++++++++++++++++++++++++----- unix/configure.in | 11 ++-- unix/tcl.m4 | 42 +++++++++++--- unix/tkConfig.h.in | 3 + 12 files changed, 225 insertions(+), 71 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce8e2a5..d5e1126 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2006-08-18 Daniel Steffen + + * unix/tcl.m4 (Darwin): add support for --enable-64bit on x86_64, for + universal builds including x86_64, for 64-bit CoreFoundation on Leopard + and for use of -mmacosx-version-min instead of MACOSX_DEPLOYMENT_TARGET. + * unix/configure.in (Darwin): remove 64-bit arch flags from CFLAGS for + combined 32-bit and 64-bit universal builds, as neither TkAqua nor TkX11 + can be built for 64-bit at present. + * unix/configure: autoconf-2.59 + * unix/tkConfig.h.in: autoheader-2.59 + + * macosx/Wish.xcodeproj/project.pbxproj: switch native release targets + to use DWARF with dSYM, Xcode 3.0 changes. + * macosx/README: updates for x86_64 and Xcode 2.3. + + * macosx/tkMacOSXInit.c (TkpInit): when available, use public + TransformProcessType() API instead of CPSEnableForegroundOperation() SPI + to notify the window server that we are a GUI application. + + * macosx/tkMacOSXWm.c (WmAttrGetTitlePath): use HIWindow API on >=Tiger. + + * macosx/tkMacOSXMouseEvent.c (GenerateToolbarButtonEvent): + * macosx/tkMacOSXMenus.c (GenerateEditEvent): + * macosx/tkMacOSXMenu.c (MenuSelectEvent): bzero XVirtualEvent structure + before use to ensure all fields are initialized. [Bug 1542205] + 2006-08-16 Jeff Hobbs * macosx/tkMacOSXWm.c (WmAttributesCmd): correct OS X result for @@ -13,7 +39,7 @@ * macosx/tkMacOSXWm.c (TkWmMapWindow): fix incorrect values of wmInfo parentWidth/Height for toplevels by recalculating them once the window - is mapped (i.e. once the window&structure sizes are known). [Bug 1358663] + is mapped (i.e once the window&structure sizes are known). [Bug 1358663] (ParseGeometry): sync with ParseGeometry in tkUnixWm.c/tkWinWm.c. 2006-07-21 Daniel Steffen diff --git a/macosx/README b/macosx/README index bb94bbb..95cca5b 100644 --- a/macosx/README +++ b/macosx/README @@ -1,7 +1,7 @@ Tcl/Tk Mac OS X README ---------------------- -RCS: @(#) $Id: README,v 1.19 2006/07/21 06:03:20 das Exp $ +RCS: @(#) $Id: README,v 1.20 2006/08/18 07:47:10 das Exp $ This is the README file for the Mac OS X/Darwin version of Tcl/Tk. @@ -200,19 +200,19 @@ Notes about the native targets of the Xcode projects: - To build universal binaries outside of Wish.xcodeproj, set CFLAGS as follows: export CFLAGS="-arch ppc -arch i386 \ -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" -This requires Mac OS X 10.4 and Xcode 2.2 (_not_ Xcode 2.1) and will work on -any of the architectures (on intel Macs, the -isysroot is not required). -Note that it is not possible to configure correctly if the current architecture -is not present in CFLAGS (i.e. -arch `arch` must always be there). +This requires Mac OS X 10.4 and Xcode 2.2 (_not_ Xcode 2.1) and will work on any +of the architectures (on intel Macs, the -isysroot may not be required). Note +that it is not possible to configure universal builds correctly if the current +architecture is not present in CFLAGS (i.e. -arch `arch` must be there). Universal builds of Tk TEA extensions are also possible with CFLAGS set as above, they will be [load]able by universal as well as thin binaries of Tk. -Note that while Tcl can be built for the ppc64 architecture, neither TkAqua nor -TkX11 can be built with -arch ppc64 as the corresponding GUI libraries are not +Note that while Tcl can be built for 64-bit architectures, neither TkAqua nor +TkX11 can be built for 64-bit as the corresponding GUI libraries are not available for 64bit at present. However, linking a universal 'ppc i386' Tk -binary against a universal 'ppc ppc64 i386' Tcl binary works just fine. -The Tk configure script automatically removes '-arch ppc64' from CFLAGS to -facilitate universal building of both Tcl and Tk with the same CFLAGS setting; -the same happens with configure in Tk extensions based on TEA 3.5 or later. +binary against a universal 'ppc ppc64 i386 x86_64' Tcl binary works just fine. +The Tk configure script automatically removes the 64-bit -arch flags from CFLAGS +to facilitate universal building of both Tcl and Tk with the same CFLAGS; the +same happens with configure in Tk extensions based on TEA 3.5 or later. - To enable weak-linking, set the MACOSX_DEPLOYMENT_TARGET environment variable to the minimal OS version (>= 10.2) the binaries should be able to run on, e.g: diff --git a/macosx/Wish.xcodeproj/project.pbxproj b/macosx/Wish.xcodeproj/project.pbxproj index 1e0e2bd..31ae02d 100644 --- a/macosx/Wish.xcodeproj/project.pbxproj +++ b/macosx/Wish.xcodeproj/project.pbxproj @@ -3298,6 +3298,7 @@ hasScannedForEncodings = 1; mainGroup = 08FB7794FE84155DC02AAC07 /* Wish */; projectDirPath = ""; + projectRoot = ""; targets = ( F9E61D16090A3E94002B3151 /* Tk */, 8DD76FA90486AB0100D96B5E /* tktest */, @@ -3354,7 +3355,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; - shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-/usr/bin/autoconf} && ${AUTOHEADER:-/usr/bin/autoheader}\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring tcl\"\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n"; + shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-/usr/bin/autoconf} && ${AUTOHEADER:-/usr/bin/autoheader}\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n"; }; F9A5C5F608F651AB008AE941 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -3373,7 +3374,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; - shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-/usr/bin/autoconf} && ${AUTOHEADER:-/usr/bin/autoheader}\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring tk\"\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi"; + shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-/usr/bin/autoconf} && ${AUTOHEADER:-/usr/bin/autoheader}\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi"; }; /* End PBXShellScriptBuildPhase section */ @@ -3682,6 +3683,7 @@ BINDIR = "${PREFIX}/bin"; CONFIGURE_ARGS = "--enable-threads ${CONFIGURE_ARGS}"; DEAD_CODE_STRIPPING = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; GCC_DEBUGGING_SYMBOLS = full; GCC_DYNAMIC_NO_PIC = YES; @@ -3890,6 +3892,7 @@ BINDIR = "${PREFIX}/bin"; CONFIGURE_ARGS = "--enable-threads ${CONFIGURE_ARGS}"; DEAD_CODE_STRIPPING = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; GCC_DEBUGGING_SYMBOLS = full; GCC_DYNAMIC_NO_PIC = YES; diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index a0c2de9..9024697 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXInit.c,v 1.22 2006/07/20 06:24:16 das Exp $ + * RCS: @(#) $Id: tkMacOSXInit.c,v 1.23 2006/08/18 07:47:10 das Exp $ */ #include "tkMacOSXInt.h" @@ -255,12 +255,12 @@ TkpInit(interp) } } } -#if MAC_OSX_TK_USE_CPS_SPI + /* * If we are loaded into an executable that is not a bundled application, * the window server does not let us come to the foreground. - * For such an executable, we attempt to use an undocumented SPI to - * notify the window server that we are now a full GUI application. + * For such an executable, notify the window server that we are now a + * full GUI application. */ { /* Check whether we are a bundled executable: */ @@ -294,24 +294,34 @@ TkpInit(interp) CFRelease(bundleUrl); } - /* If we are not a bundled executable, attempt to use the CPS SPI: */ + /* If we are not a bundled executable, notify the window server that + * we are a foregroundable app. */ if (!bundledExecutable) { - /* - * Load the CPS SPI symbol dynamically, so that we don't break - * if it every disappears or changes its name. - */ - TkMacOSXInitNamedSymbol(CoreGraphics, OSErr, \ - CPSEnableForegroundOperation, ProcessSerialNumberPtr); - if (CPSEnableForegroundOperation) { - ProcessSerialNumber psn = { 0, kCurrentProcess }; + OSStatus err = procNotFound; + ProcessSerialNumber psn = { 0, kCurrentProcess }; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 + if (TransformProcessType != NULL) { + err = TransformProcessType(&psn, + kProcessTransformToForegroundApplication); + } +#endif +#if MAC_OSX_TK_USE_CPS_SPI + if (err != noErr) { /* - * Let the window server know that we are a foregroundable app + * When building or running on 10.2 or when the above fails, + * attempt to use undocumented CPS SPI to notify the window + * server. Load the SPI symbol dynamically, so that we don't + * break if it ever disappears or changes its name. */ - CPSEnableForegroundOperation(&psn); + TkMacOSXInitNamedSymbol(CoreGraphics, OSErr, + CPSEnableForegroundOperation, ProcessSerialNumberPtr); + if (CPSEnableForegroundOperation) { + CPSEnableForegroundOperation(&psn); + } } +#endif /* MAC_OSX_TK_USE_CPS_SPI */ } } -#endif /* MAC_OSX_TK_USE_CPS_SPI */ } if (tkLibPath[0] != '\0') { diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 758d107..8ac888d 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.30 2006/07/20 06:25:19 das Exp $ + * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.31 2006/08/18 07:47:10 das Exp $ */ #include "tkMacOSXInt.h" @@ -3695,6 +3695,7 @@ MenuSelectEvent( { XVirtualEvent event; + bzero(&event, sizeof(XVirtualEvent)); event.type = VirtualEvent; event.serial = menuPtr->display->request; event.send_event = false; @@ -3709,7 +3710,6 @@ MenuSelectEvent( &event.x_root, &event.y_root, NULL, NULL, &event.state); event.same_screen = true; event.name = Tk_GetUid("MenuSelect"); - event.user_data = NULL; Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); } diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c index 1810f97..22d75d0 100644 --- a/macosx/tkMacOSXMenus.c +++ b/macosx/tkMacOSXMenus.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXMenus.c,v 1.14 2006/07/20 06:25:19 das Exp $ + * RCS: @(#) $Id: tkMacOSXMenus.c,v 1.15 2006/08/18 07:47:11 das Exp $ */ #include "tkMacOSXInt.h" @@ -241,6 +241,7 @@ GenerateEditEvent( return; } + bzero(&event, sizeof(XVirtualEvent)); event.type = VirtualEvent; event.serial = Tk_Display(tkwin)->request; event.send_event = false; @@ -254,7 +255,6 @@ GenerateEditEvent( &event.x_root, &event.y_root, &x, &y, &event.state); tkwin = Tk_TopCoordsToWindow(tkwin, x, y, &event.x, &event.y); event.same_screen = true; - event.user_data = NULL; switch (flag) { case EDIT_CUT: diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 59a03a8..2f9e4ba 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -54,7 +54,7 @@ * software in accordance with the terms specified in this * license. * - * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.23 2006/07/20 06:25:19 das Exp $ + * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.24 2006/08/18 07:47:11 das Exp $ */ #include "tkMacOSXInt.h" @@ -1009,8 +1009,9 @@ GenerateToolbarButtonEvent(MouseEventData * medPtr) if (!tkwin) { return true; } - winPtr = (TkWindow *)tkwin; + + bzero(&event, sizeof(XVirtualEvent)); event.type = VirtualEvent; event.serial = LastKnownRequestProcessed(winPtr->display); event.send_event = false; @@ -1019,13 +1020,12 @@ GenerateToolbarButtonEvent(MouseEventData * medPtr) event.root = XRootWindow(winPtr->display, 0); event.subwindow = None; event.time = TkpGetMS(); - event.x_root = medPtr->global.h; event.y_root = medPtr->global.v; event.state = medPtr->state; event.same_screen = true; event.name = Tk_GetUid("ToolbarButton"); - Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); + Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); return true; } diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index a9b5b47..34f23b0 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXWm.c,v 1.39 2006/08/17 01:10:21 hobbs Exp $ + * RCS: @(#) $Id: tkMacOSXWm.c,v 1.40 2006/08/18 07:47:11 das Exp $ */ #include "tkMacOSXInt.h" @@ -986,14 +986,21 @@ static Tcl_Obj * WmAttrGetTitlePath(WindowRef macWindow) { FSRef ref; - AliasHandle alias; Boolean wasChanged; UInt8 path[2048]; - OSStatus err; + OSStatus err = fnfErr; - err = GetWindowProxyAlias(macWindow, &alias); - if (err == noErr) { - err = FSResolveAlias(NULL, alias, &ref, &wasChanged); +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 + if (HIWindowGetProxyFSRef != NULL) { + err = HIWindowGetProxyFSRef(macWindow, &ref); + } +#endif + if (err != noErr) { + AliasHandle alias; + err = GetWindowProxyAlias(macWindow, &alias); + if (err == noErr) { + err = FSResolveAlias(NULL, alias, &ref, &wasChanged); + } } if (err == noErr) { err = FSRefMakePath(&ref, path, 2048); diff --git a/unix/configure b/unix/configure index d8997e9..93e19e5 100755 --- a/unix/configure +++ b/unix/configure @@ -5474,7 +5474,21 @@ echo "${ECHO_T}$tcl_cv_ld_elf" >&6 SHLIB_CFLAGS="-fno-common" if test $do64bit = yes; then do64bit_ok=yes - CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" + case `arch` in + ppc) + CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5";; + i386) + CFLAGS="$CFLAGS -arch x86_64";; + *) + { echo "$as_me:$LINENO: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5 +echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;} + do64bit_ok=no;; + esac + else + # Check for combined 32-bit and 64-bit fat build + echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \ + echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \ + fat_32_64=yes fi SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}' echo "$as_me:$LINENO: checking if ld accepts -single_module flag" >&5 @@ -5543,8 +5557,8 @@ echo "${ECHO_T}$tcl_cv_ld_single_module" >&6 DL_OBJS="tclLoadDyld.o" DL_LIBS="" # Don't use -prebind when building for Mac OS X 10.4 or later only: - test -z "${MACOSX_DEPLOYMENT_TARGET}" || \ - test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F. '{print $2}'`" -lt 4 && \ + test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \ + "`echo "${CFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4 && \ LDFLAGS="$LDFLAGS -prebind" LDFLAGS="$LDFLAGS -headerpad_max_install_names" echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5 @@ -5632,11 +5646,11 @@ if test "${tcl_cv_lib_corefoundation+set}" = set; then else hold_libs=$LIBS; hold_cflags=$CFLAGS - if test $do64bit_ok = no ; then - # remove -arch ppc64 from CFLAGS while testing presence - # of CF, otherwise all archs will have CF disabled. - # CF for ppc64 is disabled in tclUnixPort.h instead. - CFLAGS="`echo "$CFLAGS" | sed -e 's/-arch ppc64/-arch ppc/'`" + if test "$fat_32_64" = yes; then + # On Tiger there is no 64-bit CF, so remove 64-bit archs + # from CFLAGS while testing for presence of CF. + # 64-bit CF is disabled in tclUnixPort.h if necessary. + CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc64 / /g' -e 's/-arch x86_64 / /g'`" fi LIBS="$LIBS -framework CoreFoundation" cat >conftest.$ac_ext <<_ACEOF @@ -5699,6 +5713,73 @@ _ACEOF else tcl_corefoundation=no fi + if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then + echo "$as_me:$LINENO: checking for 64-bit CoreFoundation" >&5 +echo $ECHO_N "checking for 64-bit CoreFoundation... $ECHO_C" >&6 +if test "${tcl_cv_lib_corefoundation_64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + hold_cflags=$CFLAGS + CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc / /g' -e 's/-arch i386 / /g'`" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +CFBundleRef b = CFBundleGetMainBundle(); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + tcl_cv_lib_corefoundation_64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_lib_corefoundation_64=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$hold_cflags +fi +echo "$as_me:$LINENO: result: $tcl_cv_lib_corefoundation_64" >&5 +echo "${ECHO_T}$tcl_cv_lib_corefoundation_64" >&6 + if test $tcl_cv_lib_corefoundation_64 = no; then + +cat >>confdefs.h <<\_ACEOF +#define NO_COREFOUNDATION_64 1 +_ACEOF + + fi + fi fi cat >>confdefs.h <<\_ACEOF @@ -8121,11 +8202,10 @@ echo "$as_me: WARNING: Aqua requires Mac OS X 10.2 or later" >&2;} fi echo "$as_me:$LINENO: result: $tk_aqua" >&5 echo "${ECHO_T}$tk_aqua" >&6 - if test $do64bit_ok = no ; then - # remove -arch ppc64 from CFLAGS for fat builds as neither Aqua nor X11 - # can be built for 64bit at present (no 64bit GUI libraries). - CFLAGS="`echo "$CFLAGS" | sed -e 's/-arch ppc64/-arch ppc/g'`" - fi + # remove 64-bit arch flags from CFLAGS for combined 32-bit and 64-bit fat + # builds as neither TkAqua nor TkX11 can be built for 64-bit at present. + test "$fat_32_64" = yes && \ + CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc64 / /g' -e 's/-arch x86_64 / /g'`" if test $tk_aqua = no; then # check if weak linking whole libraries is possible. echo "$as_me:$LINENO: checking if ld accepts -weak-l flag" >&5 diff --git a/unix/configure.in b/unix/configure.in index 8182d93..590b70d 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ 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.120 2006/07/20 06:25:20 das Exp $ +# RCS: @(#) $Id: configure.in,v 1.121 2006/08/18 07:47:11 das Exp $ AC_INIT([tk],[8.5]) AC_PREREQ(2.59) @@ -257,11 +257,10 @@ if test "`uname -s`" = "Darwin" ; then fi fi AC_MSG_RESULT([$tk_aqua]) - if test $do64bit_ok = no ; then - # remove -arch ppc64 from CFLAGS for fat builds as neither Aqua nor X11 - # can be built for 64bit at present (no 64bit GUI libraries). - CFLAGS="`echo "$CFLAGS" | sed -e 's/-arch ppc64/-arch ppc/g'`" - fi + # remove 64-bit arch flags from CFLAGS for combined 32-bit and 64-bit fat + # builds, as neither TkAqua nor TkX11 can be built for 64-bit at present. + test "$fat_32_64" = yes && \ + CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc64 / /g' -e 's/-arch x86_64 / /g'`" 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, [ diff --git a/unix/tcl.m4 b/unix/tcl.m4 index b4374a9..e1ef439 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1560,7 +1560,20 @@ dnl AC_CHECK_TOOL(AR, ar) SHLIB_CFLAGS="-fno-common" if test $do64bit = yes; then do64bit_ok=yes - CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" + case `arch` in + ppc) + CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5";; + i386) + CFLAGS="$CFLAGS -arch x86_64";; + *) + AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]) + do64bit_ok=no;; + esac + else + # Check for combined 32-bit and 64-bit fat build + echo "$CFLAGS " | grep -E -q -- '-arch (ppc64|x86_64) ' && \ + echo "$CFLAGS " | grep -E -q -- '-arch (ppc|i386) ' && \ + fat_32_64=yes fi SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}' AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [ @@ -1576,8 +1589,8 @@ dnl AC_CHECK_TOOL(AR, ar) DL_OBJS="tclLoadDyld.o" DL_LIBS="" # Don't use -prebind when building for Mac OS X 10.4 or later only: - test -z "${MACOSX_DEPLOYMENT_TARGET}" || \ - test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F. '{print [$]2}'`" -lt 4 && \ + test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \ + "`echo "${CFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4 && \ LDFLAGS="$LDFLAGS -prebind" LDFLAGS="$LDFLAGS -headerpad_max_install_names" AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [ @@ -1602,11 +1615,11 @@ dnl AC_CHECK_TOOL(AR, ar) if test $tcl_corefoundation = yes; then AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [ hold_libs=$LIBS; hold_cflags=$CFLAGS - if test $do64bit_ok = no ; then - # remove -arch ppc64 from CFLAGS while testing presence - # of CF, otherwise all archs will have CF disabled. - # CF for ppc64 is disabled in tclUnixPort.h instead. - CFLAGS="`echo "$CFLAGS" | sed -e 's/-arch ppc64/-arch ppc/'`" + if test "$fat_32_64" = yes; then + # On Tiger there is no 64-bit CF, so remove 64-bit archs + # from CFLAGS while testing for presence of CF. + # 64-bit CF is disabled in tclUnixPort.h if necessary. + CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc64 / /g' -e 's/-arch x86_64 / /g'`" fi LIBS="$LIBS -framework CoreFoundation" AC_TRY_LINK([#include ], @@ -1620,6 +1633,19 @@ dnl AC_CHECK_TOOL(AR, ar) else tcl_corefoundation=no fi + if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then + AC_CACHE_CHECK([for 64-bit CoreFoundation], tcl_cv_lib_corefoundation_64, [ + hold_cflags=$CFLAGS + CFLAGS="`echo "$CFLAGS " | sed -e 's/-arch ppc / /g' -e 's/-arch i386 / /g'`" + AC_TRY_LINK([#include ], + [CFBundleRef b = CFBundleGetMainBundle();], + tcl_cv_lib_corefoundation_64=yes, tcl_cv_lib_corefoundation_64=no) + CFLAGS=$hold_cflags]) + if test $tcl_cv_lib_corefoundation_64 = no; then + AC_DEFINE(NO_COREFOUNDATION_64, 1, + [Is Darwin CoreFoundation unavailable for 64-bit?]) + fi + fi fi AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?]) AC_DEFINE(MODULE_SCOPE, __private_extern__, diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in index 7c36c14..79389ff 100644 --- a/unix/tkConfig.h.in +++ b/unix/tkConfig.h.in @@ -91,6 +91,9 @@ /* Linker support for module scope symbols */ #undef MODULE_SCOPE +/* Is Darwin CoreFoundation unavailable for 64-bit? */ +#undef NO_COREFOUNDATION_64 + /* Do we have fd_set? */ #undef NO_FD_SET -- cgit v0.12