From 34a3970c39dead78485d1bd7b7f4b858922c8f69 Mon Sep 17 00:00:00 2001 From: das Date: Fri, 19 Jan 2007 01:03:58 +0000 Subject: * macosx/tclMacOSXFCmd.c (TclMacOSXSetFileAttribute): on some versions of Mac OS X, truncate() fails on resource forks, in that case use open() with O_TRUNC instead. * macosx/tclMacOSXNotify.c: accommodate changes to prototypes of OSSpinLock(Un)Lock API. * macosx/Tcl.xcodeproj/project.pbxproj: ensure HOME and USER env vars * macosx/Tcl.xcodeproj/default.pbxuser: are defined when running testsuite from Xcode. * tests/env.test: add extra system env vars that need to be preserved on some Mac OS X versions for testsuite to work. * unix/Makefile.in: move libtommath defines into configure.in to avoid * unix/configure.in: replicating them across multiple buildsystems. * macosx/Tcl.xcodeproj/project.pbxproj: * unix/tcl.m4: ensure CPPFLAGS env var is used when set. [Bug 1586861] (Darwin): add -isysroot and -mmacosx-version-min flags to CPPFLAGS when present in CFLAGS to avoid discrepancies between what headers configure sees during preprocessing tests and compiling tests. * unix/configure: autoconf-2.59 * unix/tclConfig.h.in: autoheader-2.59 --- ChangeLog | 28 ++++++++++++++++++++++++++++ macosx/Tcl.xcodeproj/default.pbxuser | 19 ++++++++++++++++++- macosx/Tcl.xcodeproj/project.pbxproj | 10 +--------- macosx/tclMacOSXFCmd.c | 13 ++++++++++++- macosx/tclMacOSXNotify.c | 20 +++++++++++++------- tests/env.test | 13 ++++++++----- unix/Makefile.in | 10 +++++----- unix/configure | 18 ++++++++++++++++++ unix/configure.in | 5 ++++- unix/tcl.m4 | 7 +++++++ unix/tclConfig.h.in | 6 ++++++ 11 files changed, 120 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc89082..695ac2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2006-01-19 Daniel Steffen + + * macosx/tclMacOSXFCmd.c (TclMacOSXSetFileAttribute): on some versions + of Mac OS X, truncate() fails on resource forks, in that case use + open() with O_TRUNC instead. + + * macosx/tclMacOSXNotify.c: accommodate changes to prototypes of + OSSpinLock(Un)Lock API. + + * macosx/Tcl.xcodeproj/project.pbxproj: ensure HOME and USER env vars + * macosx/Tcl.xcodeproj/default.pbxuser: are defined when running + testsuite from Xcode. + + * tests/env.test: add extra system env vars that need to be preserved + on some Mac OS X versions for testsuite to work. + + * unix/Makefile.in: move libtommath defines into configure.in to avoid + * unix/configure.in: replicating them across multiple buildsystems. + * macosx/Tcl.xcodeproj/project.pbxproj: + + * unix/tcl.m4: ensure CPPFLAGS env var is used when set. [Bug 1586861] + (Darwin): add -isysroot and -mmacosx-version-min flags to CPPFLAGS when + present in CFLAGS to avoid discrepancies between what headers configure + sees during preprocessing tests and compiling tests. + + * unix/configure: autoconf-2.59 + * unix/tclConfig.h.in: autoheader-2.59 + 2007-01-18 Donal K. Fellows * generic/tclCompile.c (TclCompileScript): Make sure that when parsing diff --git a/macosx/Tcl.xcodeproj/default.pbxuser b/macosx/Tcl.xcodeproj/default.pbxuser index 4a2e8aa..e425112 100644 --- a/macosx/Tcl.xcodeproj/default.pbxuser +++ b/macosx/Tcl.xcodeproj/default.pbxuser @@ -73,11 +73,26 @@ value = "${SRCROOT}/../../tcl/library"; }, { - active = NO; + active = YES; name = TCLLIBPATH; value = /Library/Tcl; }, { + active = YES; + name = HOME; + value = "/Users/${USER}"; + }, + { + active = YES; + name = USER; + value = "${USER}"; + }, + { + active = YES; + name = MallocBadFreeAbort; + value = 1; + }, + { active = NO; name = DYLD_PRINT_LIBRARIES; }, @@ -90,6 +105,8 @@ }; sourceDirectories = ( ); + variableFormatDictionary = { + }; }; F944EB9C08F798180049FDD4 /* Source Control */ = { isa = PBXSourceControlManager; diff --git a/macosx/Tcl.xcodeproj/project.pbxproj b/macosx/Tcl.xcodeproj/project.pbxproj index 14e3501..75ec251 100644 --- a/macosx/Tcl.xcodeproj/project.pbxproj +++ b/macosx/Tcl.xcodeproj/project.pbxproj @@ -1939,7 +1939,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; - shellScript = "if [ \"${ACTION:-build}\" == \"build\" ]; then\ncd \"${TARGET_TEMP_DIR}\"; rm -rf \"${DERIVED_FILE_DIR}\"; mkdir -p \"${DERIVED_FILE_DIR}\"\nprintf '%s%s%s%s%s' '\npackage require tcltest 2.2\nnamespace import tcltest::*\nconfigure -testdir [file normalize {' \"${TCL_SRCROOT}\" '/tests}]\nconfigure -tmpdir [file normalize {' \"${DERIVED_FILE_DIR}\" '}]\nconfigure -verbose [concat [configure -verbose] line]\n# following test only fails when testsuite is run from inside Xcode, so skip it\nconfigure -skip [concat [configure -skip] stack-3.1]\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"; + shellScript = "if [ \"${ACTION:-build}\" == \"build\" ]; then\nif [ -z \"${HOME}\" ]; then export HOME=\"$(echo ~)\"; fi\ncd \"${TARGET_TEMP_DIR}\"; rm -rf \"${DERIVED_FILE_DIR}\"; mkdir -p \"${DERIVED_FILE_DIR}\"\nprintf '%s%s%s%s%s' '\npackage require tcltest 2.2\nnamespace import tcltest::*\nconfigure -testdir [file normalize {' \"${TCL_SRCROOT}\" '/tests}]\nconfigure -tmpdir [file normalize {' \"${DERIVED_FILE_DIR}\" '}]\nconfigure -verbose [concat [configure -verbose] line]\n# following test only fails when testsuite is run from inside Xcode, so skip it\nconfigure -skip [concat [configure -skip] stack-3.1]\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; @@ -2175,8 +2175,6 @@ GCC_PREFIX_HEADER = "${DERIVED_FILE_DIR}/tcl/tclConfig.h"; GCC_PREPROCESSOR_DEFINITIONS = ( HAVE_TCL_CONFIG_H, - TCL_TOMMATH, - "MP_PREC=4", "${GCC_PREPROCESSOR_DEFINITIONS}", ); GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -2281,8 +2279,6 @@ GCC_PREFIX_HEADER = "${DERIVED_FILE_DIR}/tcl/tclConfig.h"; GCC_PREPROCESSOR_DEFINITIONS = ( HAVE_TCL_CONFIG_H, - TCL_TOMMATH, - "MP_PREC=4", "${GCC_PREPROCESSOR_DEFINITIONS}", ); GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -2331,8 +2327,6 @@ GCC_PREFIX_HEADER = "${DERIVED_FILE_DIR}/tcl/tclConfig.h"; GCC_PREPROCESSOR_DEFINITIONS = ( HAVE_TCL_CONFIG_H, - TCL_TOMMATH, - "MP_PREC=4", "${GCC_PREPROCESSOR_DEFINITIONS}", ); GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; @@ -2381,8 +2375,6 @@ GCC_PREFIX_HEADER = "${DERIVED_FILE_DIR}/tcl/tclConfig.h"; GCC_PREPROCESSOR_DEFINITIONS = ( HAVE_TCL_CONFIG_H, - TCL_TOMMATH, - "MP_PREC=4", "${GCC_PREPROCESSOR_DEFINITIONS}", ); GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c index 65352c2..6b32726 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.10 2006/08/18 07:45:31 das Exp $ + * RCS: @(#) $Id: tclMacOSXFCmd.c,v 1.11 2007/01/19 01:03:59 das Exp $ */ #include "tclInt.h" @@ -333,6 +333,17 @@ TclMacOSXSetFileAttribute( Tcl_DStringAppend(&ds, _PATH_RSRCFORKSPEC, -1); result = truncate(Tcl_DStringValue(&ds), (off_t)0); + if (result != 0) { + /* + * truncate() on a valid resource fork path may fail with + * a permission error in some OS releases, try truncating + * with open() instead: + */ + int fd = open(Tcl_DStringValue(&ds), O_WRONLY | O_TRUNC); + if (fd > 0) { + result = close(fd); + } + } Tcl_DStringFree(&ds); diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c index 23b858b..af2fa65 100644 --- a/macosx/tclMacOSXNotify.c +++ b/macosx/tclMacOSXNotify.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: tclMacOSXNotify.c,v 1.11 2006/08/21 03:50:50 das Exp $ + * RCS: @(#) $Id: tclMacOSXNotify.c,v 1.12 2007/01/19 01:03:59 das Exp $ */ #include "tclInt.h" @@ -168,12 +168,18 @@ static int receivePipe = -1; /* Output end of triggerPipe */ * Support for weakly importing spinlock API. */ #define WEAK_IMPORT_SPINLOCKLOCK -extern void OSSpinLockLock(OSSpinLock *lock) WEAK_IMPORT_ATTRIBUTE; -extern void OSSpinLockUnlock(OSSpinLock *lock) WEAK_IMPORT_ATTRIBUTE; -extern void _spin_lock(OSSpinLock *lock) WEAK_IMPORT_ATTRIBUTE; -extern void _spin_unlock(OSSpinLock *lock) WEAK_IMPORT_ATTRIBUTE; -static void (* lockLock)(OSSpinLock *lock) = NULL; -static void (* lockUnlock)(OSSpinLock *lock) = NULL; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 +#define VOLATILE volatile +#else +#define VOLATILE +#endif +extern void OSSpinLockLock(VOLATILE OSSpinLock *lock) WEAK_IMPORT_ATTRIBUTE; +extern void OSSpinLockUnlock(VOLATILE OSSpinLock *lock) WEAK_IMPORT_ATTRIBUTE; +extern void _spin_lock(VOLATILE OSSpinLock *lock) WEAK_IMPORT_ATTRIBUTE; +extern void _spin_unlock(VOLATILE OSSpinLock *lock) WEAK_IMPORT_ATTRIBUTE; +static void (* lockLock)(VOLATILE OSSpinLock *lock) = NULL; +static void (* lockUnlock)(VOLATILE OSSpinLock *lock) = NULL; +#undef VOLATILE static pthread_once_t spinLockLockInitControl = PTHREAD_ONCE_INIT; static void SpinLockLockInit(void) { lockLock = OSSpinLockLock != NULL ? OSSpinLockLock : _spin_lock; diff --git a/tests/env.test b/tests/env.test index fdcb16d..e417db2 100644 --- a/tests/env.test +++ b/tests/env.test @@ -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: env.test,v 1.27 2006/03/23 18:58:27 dgp Exp $ +# RCS: @(#) $Id: env.test,v 1.28 2007/01/19 01:04:00 das Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -77,9 +77,10 @@ set printenvScript [makeFile { lrem names "" } foreach name { - TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH PURE_PROG_NAME DISPLAY - SHLIB_PATH DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH - __CF_USER_TEXT_ENCODING SYSTEMDRIVE SYSTEMROOT + TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH PURE_PROG_NAME DISPLAY + SHLIB_PATH SYSTEMDRIVE SYSTEMROOT DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH + DYLD_NEW_LOCAL_SHARED_REGIONS DYLD_NO_FIX_PREBINDING + __CF_USER_TEXT_ENCODING SECURITYSESSIONID } { lrem names $name } @@ -109,7 +110,9 @@ foreach name [array names env] { # tcltest package. if {[string toupper $name] ni { TCL_LIBRARY PATH LD_LIBRARY_PATH LIBPATH DISPLAY SHLIB_PATH - DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH SYSTEMDRIVE SYSTEMROOT + SYSTEMDRIVE SYSTEMROOT DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH + DYLD_NEW_LOCAL_SHARED_REGIONS DYLD_NO_FIX_PREBINDING + SECURITYSESSIONID }} { unset env($name) } diff --git a/unix/Makefile.in b/unix/Makefile.in index cd63b0f..76925be 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.200 2006/12/17 03:47:08 das Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.201 2007/01/19 01:04:00 das Exp $ VERSION = @TCL_VERSION@ MAJOR_VERSION = @TCL_MAJOR_VERSION@ @@ -270,13 +270,13 @@ DDD = ddd CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ --I${BUILD_DIR} -I${UNIX_DIR} -I${GENERIC_DIR} -DTCL_TOMMATH -DMP_PREC=4 \ --I${TOMMATH_DIR} ${AC_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} \ +-I${BUILD_DIR} -I${UNIX_DIR} -I${GENERIC_DIR} -I${TOMMATH_DIR} \ +${AC_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} \ ${NO_DEPRECATED_FLAGS} ${ENV_FLAGS} @EXTRA_CC_SWITCHES@ STUB_CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ --I${BUILD_DIR} -I${UNIX_DIR} -I${GENERIC_DIR} -DTCL_TOMMATH -DMP_PREC=4 \ --I${TOMMATH_DIR} ${AC_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} \ +-I${BUILD_DIR} -I${UNIX_DIR} -I${GENERIC_DIR} -I${TOMMATH_DIR} \ +${AC_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} \ ${ENV_FLAGS} @EXTRA_CC_SWITCHES@ LIBS = @TCL_LIBS@ diff --git a/unix/configure b/unix/configure index 4d58946..6a5571c 100755 --- a/unix/configure +++ b/unix/configure @@ -6471,6 +6471,7 @@ fi TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`' ECHO_VERSION='`echo ${VERSION}`' TCL_LIB_VERSIONS_OK=ok + CFLAGS="${CPPFLAGS} ${CFLAGS}" CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE=-O if test "$GCC" = "yes" ; then @@ -7366,6 +7367,12 @@ echo "${ECHO_T}$tcl_cv_ld_elf" >&6 Darwin-*) CFLAGS_OPTIMIZE="-Os" SHLIB_CFLAGS="-fno-common" + # To avoid discrepancies between what headers configure sees during + # preprocessing tests and compiling tests, add any -isysroot and + # -mmacosx-version-min flags present in CFLAGS to CPPFLAGS: + CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \ + awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=1;i<=NF;i++) \ + if ($i~/^(isysroot|mmacosx-version-min)/) print "-"$i}'`" if test $do64bit = yes; then case `arch` in ppc) @@ -8363,6 +8370,17 @@ echo "${ECHO_T}enabled $tcl_ok debugging" >&6 fi + +cat >>confdefs.h <<\_ACEOF +#define TCL_TOMMATH 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define MP_PREC 4 +_ACEOF + + #-------------------------------------------------------------------- # Detect what compiler flags to set for 64-bit support. #-------------------------------------------------------------------- diff --git a/unix/configure.in b/unix/configure.in index a4de014..81fc77b 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 Tcl installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.153 2006/12/17 03:47:09 das Exp $ +# RCS: @(#) $Id: configure.in,v 1.154 2007/01/19 01:04:01 das Exp $ AC_INIT([tcl],[8.5]) AC_PREREQ(2.59) @@ -123,6 +123,9 @@ SC_CONFIG_CFLAGS SC_ENABLE_SYMBOLS(bccdebug) +AC_DEFINE(TCL_TOMMATH, 1, [Build libtommath?]) +AC_DEFINE(MP_PREC, 4, [Default libtommath precision.]) + #-------------------------------------------------------------------- # Detect what compiler flags to set for 64-bit support. #-------------------------------------------------------------------- diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 140d25a..34b9f7a 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1113,6 +1113,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`' ECHO_VERSION='`echo ${VERSION}`' TCL_LIB_VERSIONS_OK=ok + CFLAGS="${CPPFLAGS} ${CFLAGS}" CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE=-O if test "$GCC" = "yes" ; then @@ -1574,6 +1575,12 @@ dnl AC_CHECK_TOOL(AR, ar) Darwin-*) CFLAGS_OPTIMIZE="-Os" SHLIB_CFLAGS="-fno-common" + # To avoid discrepancies between what headers configure sees during + # preprocessing tests and compiling tests, add any -isysroot and + # -mmacosx-version-min flags present in CFLAGS to CPPFLAGS: + CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \ + awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=1;i<=NF;i++) \ + if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`" if test $do64bit = yes; then case `arch` in ppc) diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index 0d3e650..6fc1306 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -268,6 +268,9 @@ /* Linker support for module scope symbols */ #undef MODULE_SCOPE +/* Default libtommath precision. */ +#undef MP_PREC + /* Is Darwin CoreFoundation unavailable for 64-bit? */ #undef NO_COREFOUNDATION_64 @@ -385,6 +388,9 @@ /* Are we building with threads enabled? */ #undef TCL_THREADS +/* Build libtommath? */ +#undef TCL_TOMMATH + /* Do we allow unloading of shared libraries? */ #undef TCL_UNLOAD_DLLS -- cgit v0.12