From daccfbf9d19d8ffcfd4c6106a608bf441713d5ff Mon Sep 17 00:00:00 2001 From: das Date: Fri, 18 Aug 2006 07:45:31 +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: autoconf-2.59 * unix/tclConfig.h.in: autoheader-2.59 * generic/tcl.h: add fixes for building on Leopard and support * unix/tclUnixPort.h: for 64-bit CoreFoundation on Leopard. * macosx/tclMacOSXFCmd.c: * unix/tclUnixPort.h: on Darwin x86_64, disable use of vfork as it causes execve to fail intermittently. (rdar://4685553) * generic/tclTomMath.h: on Darwin 64-bit, for now disable use of 128-bit arithmetic through __attribute__ ((mode(TI))), as it leads to link errors due to missing fallbacks. (rdar://4685527) * macosx/Tcl.xcodeproj/project.pbxproj: add x86_64 to universal build, switch native release targets to use DWARF with dSYM, Xcode 3.0 changes. * macosx/README: updates for x86_64 and Xcode 2.3. * macosx/Tcl.xcodeproj/default.pbxuser: add test suite target that runs * macosx/Tcl.xcodeproj/project.pbxproj: the tcl test suite at build time and shows clickable test suite errors in the GUI build window. * tests/macOSXFCmd.test: fix use of deprecated resource fork paths. * unix/tclUnixInit.c (TclpInitLibraryPath): move code that is only needed when TCL_LIBRARY is defined to run only in that case. * generic/tclLink.c (LinkTraceProc): fix 64-bit signed-with-unsigned comparison warning from gcc4 -Wextra. --- ChangeLog | 37 +++++++++++- generic/tcl.h | 3 +- generic/tclLink.c | 4 +- generic/tclTomMath.h | 15 ++++- macosx/README | 21 +++---- macosx/Tcl.xcodeproj/default.pbxuser | 7 +++ macosx/Tcl.xcodeproj/project.pbxproj | 106 ++++++++++++++++++++++++++++++++++- macosx/tclMacOSXFCmd.c | 12 +++- tests/macOSXFCmd.test | 6 +- unix/configure | 97 +++++++++++++++++++++++++++++--- unix/tcl.m4 | 42 +++++++++++--- unix/tclConfig.h.in | 3 + unix/tclUnixInit.c | 33 ++++++----- unix/tclUnixPort.h | 20 ++++++- 14 files changed, 348 insertions(+), 58 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1bb8d13..ec82bc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +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: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + + * generic/tcl.h: add fixes for building on Leopard and support + * unix/tclUnixPort.h: for 64-bit CoreFoundation on Leopard. + * macosx/tclMacOSXFCmd.c: + + * unix/tclUnixPort.h: on Darwin x86_64, disable use of vfork as it + causes execve to fail intermittently. (rdar://4685553) + + * generic/tclTomMath.h: on Darwin 64-bit, for now disable use of 128-bit + arithmetic through __attribute__ ((mode(TI))), as it leads to link + errors due to missing fallbacks. (rdar://4685527) + + * macosx/Tcl.xcodeproj/project.pbxproj: add x86_64 to universal build, + switch native release targets to use DWARF with dSYM, Xcode 3.0 changes. + * macosx/README: updates for x86_64 and Xcode 2.3. + + * macosx/Tcl.xcodeproj/default.pbxuser: add test suite target that runs + * macosx/Tcl.xcodeproj/project.pbxproj: the tcl test suite at build time + and shows clickable test suite errors in the GUI build window. + + * tests/macOSXFCmd.test: fix use of deprecated resource fork paths. + + * unix/tclUnixInit.c (TclpInitLibraryPath): move code that is only + needed when TCL_LIBRARY is defined to run only in that case. + + * generic/tclLink.c (LinkTraceProc): fix 64-bit signed-with-unsigned + comparison warning from gcc4 -Wextra. + 2006-08-17 Don Porter * generic/tclCompile.c: Revised the new set of expression @@ -58,7 +93,7 @@ * tests/compExpr.test: that depend on the exact format of the error * tests/compile.test: messages of the pre-2006-07-05 expression * tests/expr-old.test: parser. The constraint is on by default (i.e - * tests/expr.test: those test still fail), but it can be turned + * tests/expr.test: those tests still fail), but can be turned * tests/for.test: off by passing '-constraints newExprParser' * tests/if.test: to tcltest, which will skip the 196 failing * tests/parseExpr.test: tests in the testsuite that are caused by diff --git a/generic/tcl.h b/generic/tcl.h index 8938e4b..c32c063 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -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: tcl.h,v 1.213 2006/05/30 00:30:25 hobbs Exp $ + * RCS: @(#) $Id: tcl.h,v 1.214 2006/08/18 07:45:31 das Exp $ */ #ifndef _TCL @@ -349,6 +349,7 @@ typedef long LONG; # undef TCL_WIDE_INT_IS_LONG # undef TCL_CFG_DO64BIT # endif /* __LP64__ */ +# undef HAVE_STRUCT_STAT64 #endif /* __APPLE__ */ /* diff --git a/generic/tclLink.c b/generic/tclLink.c index 6a4e49e..7bf4fd5 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLink.c,v 1.16 2005/12/13 22:43:18 kennykb Exp $ + * RCS: @(#) $Id: tclLink.c,v 1.17 2006/08/18 07:45:31 das Exp $ */ #include "tclInt.h" @@ -474,7 +474,7 @@ LinkTraceProc( case TCL_LINK_ULONG: if (Tcl_GetWideIntFromObj(interp, valueObj, &valueWide) != TCL_OK - || valueWide < 0 || valueWide > ULONG_MAX) { + || valueWide < 0 || (Tcl_WideUInt) valueWide > ULONG_MAX) { Tcl_ObjSetVar2(interp, linkPtr->varName, NULL, ObjValue(linkPtr), TCL_GLOBAL_ONLY); return "variable must have unsigned long value"; diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 2ecc3c5..90d14df 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -56,6 +56,17 @@ extern "C" { #define MP_64BIT #endif #endif +#if defined(__APPLE__) && defined(__LP64__) +/* + * At present, use of 128-bit arithmetic via __attribute__ ((mode(TI))) + * leads to link errors on Darwin x86_64__ and ppc64. rdar://4685527 + */ +# ifdef HAVE_LP64_MODE_TI +# define MP_64BIT +# else +# undef MP_64BIT +# endif +#endif /* some default configurations. * @@ -839,6 +850,6 @@ MODULE_SCOPE const char *mp_s_rmap; /* $Source: /root/tcl/repos-to-convert/tcl/generic/tclTomMath.h,v $ */ -/* $Revision: 1.5 $ */ -/* $Date: 2005/12/13 22:43:18 $ */ +/* $Revision: 1.6 $ */ +/* $Date: 2006/08/18 07:45:31 $ */ diff --git a/macosx/README b/macosx/README index ed9382f..2917831 100644 --- a/macosx/README +++ b/macosx/README @@ -1,7 +1,7 @@ Tcl Mac OS X README ----------------- -RCS: @(#) $Id: README,v 1.8 2006/07/21 06:02:48 das Exp $ +RCS: @(#) $Id: README,v 1.9 2006/08/18 07:45:31 das Exp $ This is the README file for the Mac OS X/Darwin version of Tcl. @@ -94,9 +94,9 @@ take care to only use the project matching your DevTools and OS version: target useful for debugging, this target's 'Development' buildstyle has ZeroLink and Fix&Continue enabled, use the 'DevelNoFixZL' buildstyle if you need a debug build without these features. - * Tcl.xcodeproj for Xcode 2.2 on 10.4, this additionally has a + * Tcl.xcodeproj for Xcode 2.3 on 10.4, this additionally has a 'ReleaseUniversal'configuration which builds both the 'Tcl' and the - 'tcltest' targets as universal binaries for ppc, ppc64 and i386. + 'tcltest' targets as universal binaries for ppc, ppc64, i386 and x86_64. Notes about the native targets of the Xcode projects: * the Xcode projects refer to the tcl source directory with a relative path of ../../tcl to the project location, if your source directory is named @@ -115,14 +115,15 @@ Notes about the native targets of the Xcode projects: env vars AUTOCONF and AUTOHEADER to their true locations if necessary. - To build universal binaries outside of Tcl.xcodeproj, set CFLAGS as follows: - export CFLAGS="-arch ppc -arch ppc64 -arch i386 \ + export CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 \ -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). Universal builds of -Tcl TEA extensions are also possible with CFLAGS set as above, they will be -[load]able by universal as well as thin binaries of Tcl. +This requires Mac OS X 10.4 and Xcode 2.3 (or Xcode 2.2 if -arch x86_64 is +omitted, but _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 Tcl TEA extensions are also possible with CFLAGS set as +above, they will be [load]able by universal as well as thin binaries of Tcl. - 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/Tcl.xcodeproj/default.pbxuser b/macosx/Tcl.xcodeproj/default.pbxuser index ebbcbec..5444995 100644 --- a/macosx/Tcl.xcodeproj/default.pbxuser +++ b/macosx/Tcl.xcodeproj/default.pbxuser @@ -30,10 +30,12 @@ NO, NO, NO, + NO, ); argumentStrings = ( "${SRCROOT}/../../tcl/tests/all.tcl", "-singleproc 1", + "-constraints newExprParser", "-verbose \"bet\"", ); autoAttachOnCrash = 1; @@ -74,6 +76,11 @@ }, { active = NO; + name = TCLLIBPATH; + value = /Library/Tcl; + }, + { + active = NO; name = DYLD_PRINT_LIBRARIES; }, ); diff --git a/macosx/Tcl.xcodeproj/project.pbxproj b/macosx/Tcl.xcodeproj/project.pbxproj index 9c72230..0028aa5 100644 --- a/macosx/Tcl.xcodeproj/project.pbxproj +++ b/macosx/Tcl.xcodeproj/project.pbxproj @@ -163,6 +163,16 @@ F9E61D32090A48FA002B3151 /* bn_mp_unsigned_bin_size.c in Sources */ = {isa = PBXBuildFile; fileRef = F96D42CC08F272B3004A47F5 /* bn_mp_unsigned_bin_size.c */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + F97258D20A868C6F00096C78 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DD76FA90486AB0100D96B5E; + remoteInfo = tcltest; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ 8DD76FB20486AB0100D96B5E /* tcltest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = tcltest; sourceTree = BUILT_PRODUCTS_DIR; }; F966C07408F2820D005CB29B /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; @@ -1837,6 +1847,21 @@ productReference = 8DD76FB20486AB0100D96B5E /* tcltest */; productType = "com.apple.product-type.tool"; }; + F97258A50A86873C00096C78 /* tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = F97258A80A86873D00096C78 /* Build configuration list for PBXNativeTarget "tests" */; + buildPhases = ( + F97258A40A86873C00096C78 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + F97258D30A868C6F00096C78 /* PBXTargetDependency */, + ); + name = tests; + productName = tests; + productType = "com.apple.product-type.bundle"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -1846,14 +1871,29 @@ hasScannedForEncodings = 1; mainGroup = 08FB7794FE84155DC02AAC07 /* Tcl */; projectDirPath = ""; + projectRoot = ""; targets = ( F9E61D16090A3E94002B3151 /* Tcl */, 8DD76FA90486AB0100D96B5E /* tcltest */, + F97258A50A86873C00096C78 /* tests */, ); }; /* End PBXProject section */ /* Begin PBXShellScriptBuildPhase section */ + F97258A40A86873C00096C78 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/bash; + shellScript = "if [ \"${ACTION:-build}\" == \"build\" ]; then\nprintf '%s%s%s' '\npackage require tcltest 2.2\nnamespace import tcltest::*\nconfigure -testdir [file normalize {' \"${SRCROOT}\" '/../../tcl/tests}]\nconfigure -singleproc 1\nset b [info body ::tcltest::test]; set i [string first {puts [outputChannel] \"\\n====} $b]\nproc ::tcltest::test [info args ::tcltest::test] [string replace $b $i [expr {$i+27}] {set t [uplevel 1 {info script}]; set f [open $t r]; set n [expr {[lsearch -regex [split [read $f] \"\\n\"] \"^test [string map {. \\\\.} $name]\"]+1}]; close $f; puts [outputChannel] \"\\n$t:$n: test failed: $name [string trim $description]\\n====}]\nrunAllTests\n' | \"${TEST_RIG}\"; TEST_RIG_RESULT=$?\n[ ${TEST_RIG_RESULT} -ne 0 ] && echo \"tcltest:0: error: tcltest exited abnormally with code ${TEST_RIG_RESULT}.\"\nexit ${TEST_RIG_RESULT}\nfi"; + }; F9A5C5F508F651A2008AE941 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -1871,7 +1911,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"; }; /* End PBXShellScriptBuildPhase section */ @@ -2038,6 +2078,14 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + F97258D30A868C6F00096C78 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DD76FA90486AB0100D96B5E /* tcltest */; + targetProxy = F97258D20A868C6F00096C78 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin XCBuildConfiguration section */ F91BCC4F093152310042A6BF /* ReleaseUniversal */ = { isa = XCBuildConfiguration; @@ -2060,10 +2108,12 @@ ppc, ppc64, i386, + x86_64, ); BINDIR = "${PREFIX}/bin"; CONFIGURE_ARGS = "--enable-threads ${CONFIGURE_ARGS}"; DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; GCC_DEBUGGING_SYMBOLS = full; GCC_DYNAMIC_NO_PIC = YES; @@ -2110,7 +2160,7 @@ F91BCC51093152310042A6BF /* ReleaseUniversal */ = { isa = XCBuildConfiguration; buildSettings = { - CFLAGS = "-arch ppc -arch ppc64 -arch i386 -isysroot ${SDKROOT} -mmacosx-version-min=10.4"; + CFLAGS = "-arch ppc -arch ppc64 -arch i386 -arch x86_64 -isysroot ${SDKROOT} -mmacosx-version-min=10.4"; CONFIGURE_ARGS = "--disable-symbols"; GCC_PREPROCESSOR_DEFINITIONS = NDEBUG; MACOSX_DEPLOYMENT_TARGET = 10.4; @@ -2216,6 +2266,7 @@ BINDIR = "${PREFIX}/bin"; CONFIGURE_ARGS = "--enable-threads ${CONFIGURE_ARGS}"; DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; GCC_DEBUGGING_SYMBOLS = full; GCC_DYNAMIC_NO_PIC = YES; @@ -2336,6 +2387,46 @@ }; name = DebugNoFixZL; }; + F97258A90A86873D00096C78 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = tests; + TCLTEST_OPTIONS = "-constraints newExprParser -verbose bet"; + TCL_LIBRARY = "${SRCROOT}/../../tcl/library"; + TEST_RIG = "$(OBJROOT)/$(CONFIGURATION)/tcltest"; + }; + name = Debug; + }; + F97258AA0A86873D00096C78 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = tests; + TCLTEST_OPTIONS = "-constraints newExprParser -verbose bet"; + TCL_LIBRARY = "${SRCROOT}/../../tcl/library"; + TEST_RIG = "$(OBJROOT)/$(CONFIGURATION)/tcltest"; + }; + name = Release; + }; + F97258AB0A86873D00096C78 /* DebugNoFixZL */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = tests; + TCLTEST_OPTIONS = "-constraints newExprParser -verbose bet"; + TCL_LIBRARY = "${SRCROOT}/../../tcl/library"; + TEST_RIG = "$(OBJROOT)/$(CONFIGURATION)/tcltest"; + }; + name = DebugNoFixZL; + }; + F97258AC0A86873D00096C78 /* ReleaseUniversal */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = tests; + TCLTEST_OPTIONS = "-constraints newExprParser -verbose bet"; + TCL_LIBRARY = "${SRCROOT}/../../tcl/library"; + TEST_RIG = "$(OBJROOT)/$(CONFIGURATION)/tcltest"; + }; + name = ReleaseUniversal; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -2372,6 +2463,17 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + F97258A80A86873D00096C78 /* Build configuration list for PBXNativeTarget "tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F97258A90A86873D00096C78 /* Debug */, + F97258AA0A86873D00096C78 /* Release */, + F97258AB0A86873D00096C78 /* DebugNoFixZL */, + F97258AC0A86873D00096C78 /* ReleaseUniversal */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; /* End XCConfigurationList section */ }; rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c index 51fe222..65352c2 100644 --- a/macosx/tclMacOSXFCmd.c +++ b/macosx/tclMacOSXFCmd.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: tclMacOSXFCmd.c,v 1.9 2006/07/20 06:18:37 das Exp $ + * RCS: @(#) $Id: tclMacOSXFCmd.c,v 1.10 2006/08/18 07:45:31 das Exp $ */ #include "tclInt.h" @@ -25,18 +25,24 @@ #ifdef HAVE_COPYFILE #ifdef HAVE_COPYFILE_H #include -#else +#if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1040 +/* Support for weakly importing copyfile. */ +#define WEAK_IMPORT_COPYFILE +extern int copyfile(const char *from, const char *to, copyfile_state_t state, + copyfile_flags_t flags) WEAK_IMPORT_ATTRIBUTE; +#endif /* HAVE_WEAK_IMPORT */ +#else /* HAVE_COPYFILE_H */ int copyfile(const char *from, const char *to, void *state, uint32_t flags); #define COPYFILE_ACL (1<<0) #define COPYFILE_XATTR (1<<2) #define COPYFILE_NOFOLLOW_SRC (1<<18) -#endif /* HAVE_COPYFILE_H */ #if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1040 /* Support for weakly importing copyfile. */ #define WEAK_IMPORT_COPYFILE extern int copyfile(const char *from, const char *to, void *state, uint32_t flags) WEAK_IMPORT_ATTRIBUTE; #endif /* HAVE_WEAK_IMPORT */ +#endif /* HAVE_COPYFILE_H */ #endif /* HAVE_COPYFILE */ #include diff --git a/tests/macOSXFCmd.test b/tests/macOSXFCmd.test index 15b3909..5c87bab 100644 --- a/tests/macOSXFCmd.test +++ b/tests/macOSXFCmd.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: macOSXFCmd.test,v 1.4 2006/03/21 11:12:29 dkf Exp $ +# RCS: @(#) $Id: macOSXFCmd.test,v 1.5 2006/08/18 07:45:31 das Exp $ # if {[lsearch [namespace children] ::tcltest] == -1} { @@ -106,7 +106,7 @@ test macOSXFCmd-2.7 {MacOSXSetFileAttribute - rsrclength} {macosxFileAttr notRoo catch {file delete -force -- foo.test} close [open foo.test w] catch { - set f [open foo.test/rsrc w] + set f [open foo.test/..namedfork/rsrc w] fconfigure $f -translation lf -eofchar {} puts -nonewline $f "foo" close $f @@ -123,7 +123,7 @@ test macOSXFCmd-3.1 {MacOSXCopyFileAttributes} {macosxFileAttr notRoot} { close [open foo.test w] catch { file attributes foo.test -creator FOOC -type FOOT -hidden 1 - set f [open foo.test/rsrc w] + set f [open foo.test/..namedfork/rsrc w] fconfigure $f -translation lf -eofchar {} puts -nonewline $f "foo" close $f diff --git a/unix/configure b/unix/configure index 16ee904..6ae76a6 100755 --- a/unix/configure +++ b/unix/configure @@ -7198,7 +7198,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 @@ -7267,8 +7281,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 @@ -7356,11 +7370,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 @@ -7423,6 +7437,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 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/tclConfig.h.in b/unix/tclConfig.h.in index 28962b8..b61ddfb 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -196,6 +196,9 @@ /* Linker support for module scope symbols */ #undef MODULE_SCOPE +/* Is Darwin CoreFoundation unavailable for 64-bit? */ +#undef NO_COREFOUNDATION_64 + /* Do we have ? */ #undef NO_DIRENT_H diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index cffcc6c..4287927 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -7,7 +7,7 @@ * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclUnixInit.c,v 1.64 2006/07/20 06:18:38 das Exp $ + * RCS: @(#) $Id: tclUnixInit.c,v 1.65 2006/08/18 07:45:32 das Exp $ */ #include "tclInt.h" @@ -480,23 +480,11 @@ TclpInitLibraryPath( #define LIBRARY_SIZE 32 Tcl_Obj *pathPtr, *objPtr; CONST char *str; - Tcl_DString buffer, ds; - int pathc; - CONST char **pathv; - char installLib[LIBRARY_SIZE]; + Tcl_DString buffer; - Tcl_DStringInit(&ds); pathPtr = Tcl_NewObj(); /* - * Initialize the substrings used when locating an executable. The - * installLib variable computes the path as though the executable is - * installed. - */ - - sprintf(installLib, "lib/tcl%s", TCL_VERSION); - - /* * Look for the library relative to the TCL_LIBRARY env variable. If the * last dirname in the TCL_LIBRARY path does not match the last dirname in * the installLib variable, use the last dir name of installLib in @@ -508,6 +496,21 @@ TclpInitLibraryPath( str = Tcl_DStringValue(&buffer); if ((str != NULL) && (str[0] != '\0')) { + Tcl_DString ds; + int pathc; + CONST char **pathv; + char installLib[LIBRARY_SIZE]; + + Tcl_DStringInit(&ds); + + /* + * Initialize the substrings used when locating an executable. The + * installLib variable computes the path as though the executable is + * installed. + */ + + sprintf(installLib, "lib/tcl%s", TCL_VERSION); + /* * If TCL_LIBRARY is set, search there. */ @@ -537,7 +540,7 @@ TclpInitLibraryPath( /* * Finally, look for the library relative to the compiled-in path. This is * needed when users install Tcl with an exec-prefix that is different - * from the prtefix. + * from the prefix. */ { diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 652aa83..ed06e1d 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -19,7 +19,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixPort.h,v 1.49 2006/07/20 06:18:38 das Exp $ + * RCS: @(#) $Id: tclUnixPort.h,v 1.50 2006/08/18 07:45:32 das Exp $ */ #ifndef _TCLUNIXPORT @@ -509,9 +509,9 @@ extern double strtod(); /* * Support for fat compiles: configure runs only once for multiple architectures */ -# ifdef __LP64__ +# if defined(__LP64__) && defined (NO_COREFOUNDATION_64) # undef HAVE_COREFOUNDATION -# endif /* __LP64__ */ +# endif /* __LP64__ && NO_COREFOUNDATION_64 */ # include # ifdef __DARWIN_UNIX03 # if __DARWIN_UNIX03 @@ -547,6 +547,9 @@ extern double strtod(); * only use API available in the indicated OS version or earlier. */ # ifdef MAC_OS_X_VERSION_MAX_ALLOWED +# if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 && defined(__LP64__) +# undef HAVE_COREFOUNDATION +# endif # if MAC_OS_X_VERSION_MAX_ALLOWED < 1040 # undef HAVE_OSSPINLOCKLOCK # undef HAVE_PTHREAD_ATFORK @@ -560,6 +563,17 @@ extern double strtod(); # undef HAVE_LANGINFO # endif # endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ +# if defined(HAVE_COREFOUNDATION) && defined(__LP64__) && \ + defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050 +# warning "Weak import of 64-bit CoreFoundation is not supported, will not run on Mac OS X < 10.5." +# endif +/* + * At present, using vfork() instead of fork() causes execve() to fail + * intermittently on Darwin x86_64. rdar://4685553 + */ +# if defined(__x86_64__) && !defined(FIXED_RDAR_4685553) +# undef USE_VFORK +# endif /* __x86_64__ */ #endif /* __APPLE__ */ /* -- cgit v0.12