diff options
author | das <das> | 2006-07-20 06:18:37 (GMT) |
---|---|---|
committer | das <das> | 2006-07-20 06:18:37 (GMT) |
commit | 012ac88ab78de5f4b8f0e7b196e1746bb75bdf9b (patch) | |
tree | d0364276ac6c8c4168a1e2ff1c15ccf01d284585 /unix/tclUnixInit.c | |
parent | f2a1ea5dbae4b3440723227e75a0c9da1d88ff93 (diff) | |
download | tcl-012ac88ab78de5f4b8f0e7b196e1746bb75bdf9b.zip tcl-012ac88ab78de5f4b8f0e7b196e1746bb75bdf9b.tar.gz tcl-012ac88ab78de5f4b8f0e7b196e1746bb75bdf9b.tar.bz2 |
* macosx/tclMacOSXNotify.c (Tcl_InitNotifier, Tcl_WaitForEvent): create
notifier thread lazily upon first call to Tcl_WaitForEvent() rather than
in Tcl_InitNotifier(). Allows calling exeve() in processes where the
event loop has not yet been run (Darwin's execve() fails in processes
with more than one thread), in particular allows embedders to call
fork() followed by execve(), previously the pthread_atfork() child
handler's call to Tcl_InitNotifier() would immediately recreate the
notifier thread in the child after a fork.
* macosx/tclMacOSXFCmd.c (TclMacOSXCopyFileAttributes): add support
* macosx/tclMacOSXNotify.c (Tcl_InitNotifier): for weakly
* unix/tclUnixInit.c (Tcl_GetEncodingNameFromEnvironment): importing
symbols not available on OSX 10.2 or 10.3, enables binaires built on
later OSX versions to run on earlier ones.
* macosx/Tcl.xcodeproj/project.pbxproj: enable weak-linking; turn on
extra warnings.
* macosx/README: document how to enable weak-linking; cleanup.
* unix/tclUnixPort.h: add support for weak-linking; conditionalize
AvailabilityMacros.h inclusion; only disable realpath on 10.2 or earlier
when threads are enabled.
* unix/tclLoadDyld.c (TclpLoadMemoryGetBuffer): change runtime Darwin
* unix/tclUnixInit.c (TclpInitPlatform): release check to use
global initialized once.
* unix/tclUnixFCmd.c (DoRenameFile, TclpObjNormalizePath): add runtime
Darwin release check to determine if realpath is threadsafe.
* unix/configure.in: add check on Darwin for compiler support of weak
* unix/tcl.m4: import and for AvailabilityMacros.h header;
move Darwin specific checks & defines that are only relevant to the tcl
build out of tcl.m4; restrict framework option to Darwin; cleanup
quoting and help messages.
* unix/configure: autoconf-2.59
* unix/tclConfig.h.in: autoheader-2.59
* unix/tclLoadDyld.c (TclpLoadMemory): fix signed-with-unsigned
comparison and other warnings from gcc4 -Wextra.
Diffstat (limited to 'unix/tclUnixInit.c')
-rw-r--r-- | unix/tclUnixInit.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 71bd1bb..cffcc6c 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -7,14 +7,21 @@ * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclUnixInit.c,v 1.63 2006/02/08 21:41:28 dgp Exp $ + * RCS: @(#) $Id: tclUnixInit.c,v 1.64 2006/07/20 06:18:38 das Exp $ */ #include "tclInt.h" #include <stddef.h> #include <locale.h> #ifdef HAVE_LANGINFO -#include <langinfo.h> +# include <langinfo.h> +# ifdef __APPLE__ +# if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1030 + /* Support for weakly importing nl_langinfo on Darwin. */ +# define WEAK_IMPORT_NL_LANGINFO + extern char *nl_langinfo(nl_item) WEAK_IMPORT_ATTRIBUTE; +# endif +# endif #endif #include <sys/resource.h> #if defined(__FreeBSD__) && defined(__GNUC__) @@ -331,6 +338,17 @@ static int GetStackSize(size_t *stackSizePtr); static int MacOSXGetLibraryPath(Tcl_Interp *interp, int maxPathLen, char *tclLibPath); #endif /* HAVE_COREFOUNDATION */ +#if defined(__APPLE__) && (defined(TCL_LOAD_FROM_MEMORY) || ( \ + defined(TCL_THREADS) && defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ + MAC_OS_X_VERSION_MIN_REQUIRED < 1030)) +/* + * Need to check Darwin release at runtime in tclUnixFCmd.c and tclLoadDyld.c: + * initialize release global at startup from uname(). + */ +#define GET_DARWIN_RELEASE 1 +MODULE_SCOPE long tclMacOSXDarwinRelease; +long tclMacOSXDarwinRelease = 0; +#endif /* *--------------------------------------------------------------------------- @@ -425,6 +443,15 @@ TclpInitPlatform(void) */ setlocale(LC_NUMERIC, "C"); + +#ifdef GET_DARWIN_RELEASE + { + struct utsname name; + if (!uname(&name)) { + tclMacOSXDarwinRelease = strtol(name.release, NULL, 10); + } + } +#endif } /* @@ -620,7 +647,11 @@ Tcl_GetEncodingNameFromEnvironment( */ #ifdef HAVE_LANGINFO - if (setlocale(LC_CTYPE, "") != NULL) { + if ( +#ifdef WEAK_IMPORT_NL_LANGINFO + nl_langinfo != NULL && +#endif + setlocale(LC_CTYPE, "") != NULL) { Tcl_DString ds; /* |