diff options
author | das <das> | 2006-05-27 05:22:57 (GMT) |
---|---|---|
committer | das <das> | 2006-05-27 05:22:57 (GMT) |
commit | e16b80b8a8a7d7aa69b1e71ed58a73f220641814 (patch) | |
tree | 72d3182ed41bcde90b163221064968579be2632f /unix/tcl.m4 | |
parent | 3596b0e33f208511096398034c60263f6bce862a (diff) | |
download | tcl-e16b80b8a8a7d7aa69b1e71ed58a73f220641814.zip tcl-e16b80b8a8a7d7aa69b1e71ed58a73f220641814.tar.gz tcl-e16b80b8a8a7d7aa69b1e71ed58a73f220641814.tar.bz2 |
* macosx/tclMacOSXNotify.c: implemented pthread_atfork() handler that
* unix/tcl.m4 (Darwin): recreates CoreFoundation state and notifier
thread in the child after a fork(). Note that pthread_atfork() is
available starting with Tiger only. Because vfork() is used by the core
on Darwin, [exec]/[open] are not affected by this fix, only extensions
or embedders that call fork() directly (such as TclX). However, this
only makes fork() safe from corefoundation tcl with --disable-threads;
as on all platforms, forked children may deadlock in threaded tcl due to
the potential for stale locked mutexes in the child. [Patch 923072]
* unix/configure: autoconf-2.59
* unix/tclConfig.h.in: autoheader-2.59
Diffstat (limited to 'unix/tcl.m4')
-rw-r--r-- | unix/tcl.m4 | 87 |
1 files changed, 45 insertions, 42 deletions
diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 11197a9..3b2e228 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1559,17 +1559,17 @@ dnl AC_CHECK_TOOL(AR, ar) CFLAGS_OPTIMIZE="-Os" SHLIB_CFLAGS="-fno-common" if test $do64bit = yes; then - do64bit_ok=yes - CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" + do64bit_ok=yes + CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" fi SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}' AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [ - hold_ldflags=$LDFLAGS - LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module" - AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no) - LDFLAGS=$hold_ldflags]) + hold_ldflags=$LDFLAGS + LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module" + AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no) + LDFLAGS=$hold_ldflags]) if test $tcl_cv_ld_single_module = yes; then - SHLIB_LD="${SHLIB_LD} -Wl,-single_module" + SHLIB_LD="${SHLIB_LD} -Wl,-single_module" fi SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dylib" @@ -1581,60 +1581,63 @@ dnl AC_CHECK_TOOL(AR, ar) 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, [ - hold_ldflags=$LDFLAGS - LDFLAGS="$LDFLAGS -Wl,-search_paths_first" - AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no) - LDFLAGS=$hold_ldflags]) + hold_ldflags=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,-search_paths_first" + AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no) + LDFLAGS=$hold_ldflags]) if test $tcl_cv_ld_search_paths_first = yes; then - LDFLAGS="$LDFLAGS -Wl,-search_paths_first" + LDFLAGS="$LDFLAGS -Wl,-search_paths_first" fi CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" PLAT_OBJS='${MAC_OSX_OBJS}' PLAT_SRCS='${MAC_OSX_SRCS}' - AC_MSG_CHECKING([whether to use CoreFoundation]) - AC_ARG_ENABLE(corefoundation, + AC_MSG_CHECKING([whether to use CoreFoundation]) + AC_ARG_ENABLE(corefoundation, AC_HELP_STRING([--enable-corefoundation], [use CoreFoundation API on MacOSX (default: yes)]), - [tcl_corefoundation=$enableval], [tcl_corefoundation=yes]) - AC_MSG_RESULT([$tcl_corefoundation]) - 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/'`" - fi - LIBS="$LIBS -framework CoreFoundation" - AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>], - [CFBundleRef b = CFBundleGetMainBundle();], - tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no) - LIBS=$hold_libs; CFLAGS=$hold_cflags]) - if test $tcl_cv_lib_corefoundation = yes; then - LIBS="$LIBS -framework CoreFoundation" - AC_DEFINE(HAVE_COREFOUNDATION, 1, - [Do we have access to Darwin CoreFoundation.framework ?]) - fi + [tcl_corefoundation=$enableval], [tcl_corefoundation=yes]) + AC_MSG_RESULT([$tcl_corefoundation]) + 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/'`" + fi + LIBS="$LIBS -framework CoreFoundation" + AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>], + [CFBundleRef b = CFBundleGetMainBundle();], + tcl_cv_lib_corefoundation=yes, tcl_cv_lib_corefoundation=no) + LIBS=$hold_libs; CFLAGS=$hold_cflags]) + if test $tcl_cv_lib_corefoundation = yes; then + LIBS="$LIBS -framework CoreFoundation" + AC_DEFINE(HAVE_COREFOUNDATION, 1, + [Do we have access to Darwin CoreFoundation.framework ?]) + AC_CHECK_HEADERS(libkern/OSAtomic.h) + AC_CHECK_FUNCS(OSSpinLockLock) + AC_CHECK_FUNCS(pthread_atfork) + fi fi - AC_CHECK_HEADERS(libkern/OSAtomic.h) - AC_CHECK_FUNCS(OSSpinLockLock) AC_CHECK_HEADERS(copyfile.h) AC_CHECK_FUNCS(copyfile) AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?]) AC_DEFINE(USE_VFORK, 1, [Should we use vfork() instead of fork()?]) - AC_DEFINE(TCL_DEFAULT_ENCODING,"utf-8", + AC_DEFINE(TCL_DEFAULT_ENCODING, "utf-8", [Are we to override what our default encoding is?]) - AC_DEFINE(MODULE_SCOPE, __private_extern__, [Linker support for module scope symbols]) - AC_DEFINE(TCL_LOAD_FROM_MEMORY, 1, [Can this platform load code from memory?]) + AC_DEFINE(MODULE_SCOPE, __private_extern__, + [Linker support for module scope symbols]) + AC_DEFINE(TCL_LOAD_FROM_MEMORY, 1, + [Can this platform load code from memory?]) # prior to Darwin 7, realpath is not threadsafe, so don't # use it when threads are enabled, c.f. bug # 711232: AC_CHECK_FUNC(realpath) if test $ac_cv_func_realpath = yes -a "${TCL_THREADS}" = 1 \ - -a `uname -r | awk -F. '{print [$]1}'` -lt 7 ; then - ac_cv_func_realpath=no + -a `uname -r | awk -F. '{print [$]1}'` -lt 7 ; then + ac_cv_func_realpath=no fi ;; NEXTSTEP-*) |