diff options
author | das <das> | 2006-08-18 07:45:31 (GMT) |
---|---|---|
committer | das <das> | 2006-08-18 07:45:31 (GMT) |
commit | daccfbf9d19d8ffcfd4c6106a608bf441713d5ff (patch) | |
tree | 580a77a48184c84c4261aa7b46888ee7b525fae4 /unix | |
parent | 13abf0c4f482ad0481bb1945ff6451452535f47a (diff) | |
download | tcl-daccfbf9d19d8ffcfd4c6106a608bf441713d5ff.zip tcl-daccfbf9d19d8ffcfd4c6106a608bf441713d5ff.tar.gz tcl-daccfbf9d19d8ffcfd4c6106a608bf441713d5ff.tar.bz2 |
* 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.
Diffstat (limited to 'unix')
-rwxr-xr-x | unix/configure | 97 | ||||
-rw-r--r-- | unix/tcl.m4 | 42 | ||||
-rw-r--r-- | unix/tclConfig.h.in | 3 | ||||
-rw-r--r-- | unix/tclUnixInit.c | 33 | ||||
-rw-r--r-- | unix/tclUnixPort.h | 20 |
5 files changed, 161 insertions, 34 deletions
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 <CoreFoundation/CoreFoundation.h> +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 <CoreFoundation/CoreFoundation.h>], @@ -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 <CoreFoundation/CoreFoundation.h>], + [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 <dirent.h>? */ #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 <sys/cdefs.h> # 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__ */ /* |