diff options
Diffstat (limited to 'unix')
-rwxr-xr-x | unix/configure | 19 | ||||
-rw-r--r-- | unix/configure.in | 15 | ||||
-rw-r--r-- | unix/tclUnixCompat.c | 23 |
3 files changed, 42 insertions, 15 deletions
diff --git a/unix/configure b/unix/configure index bf0d085..a4a658c 100755 --- a/unix/configure +++ b/unix/configure @@ -10778,7 +10778,21 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 + if test "`uname -s`" = "Darwin" && \ + test "`uname -r | awk -F. '{print $1}'`" -gt 5; then + # Starting with Darwin 6 (Mac OSX 10.2), gethostbyX + # are actually MT-safe as they always return pointers + # from the TSD instead of the static storage. + cat >>confdefs.h <<\_ACEOF +#define HAVE_MTSAFE_GETHOSTBYNAME 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define HAVE_MTSAFE_GETHOSTBYADDR 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyname_r+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -11091,7 +11105,7 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:$LINENO: checking for gethostbyaddr_r" >&5 + echo "$as_me:$LINENO: checking for gethostbyaddr_r" >&5 echo $ECHO_N "checking for gethostbyaddr_r... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyaddr_r+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -11340,6 +11354,7 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi + fi fi #--------------------------------------------------------------------------- diff --git a/unix/configure.in b/unix/configure.in index 8e248e9..16cf959 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.145 2006/09/06 13:23:37 vasiljevic Exp $ +# RCS: @(#) $Id: configure.in,v 1.146 2006/09/08 20:57:19 vasiljevic Exp $ AC_INIT([tcl],[8.5]) AC_PREREQ(2.59) @@ -171,8 +171,17 @@ if test "${TCL_THREADS}" = 1; then SC_TCL_GETPWNAM_R SC_TCL_GETGRGID_R SC_TCL_GETGRNAM_R - SC_TCL_GETHOSTBYNAME_R - SC_TCL_GETHOSTBYADDR_R + if test "`uname -s`" = "Darwin" && \ + test "`uname -r | awk -F. '{print [$]1}'`" -gt 5; then + # Starting with Darwin 6 (Mac OSX 10.2), gethostbyX + # are actually MT-safe as they always return pointers + # from the TSD instead of the static storage. + AC_DEFINE(HAVE_MTSAFE_GETHOSTBYNAME) + AC_DEFINE(HAVE_MTSAFE_GETHOSTBYADDR) + else + SC_TCL_GETHOSTBYNAME_R + SC_TCL_GETHOSTBYADDR_R + fi fi #--------------------------------------------------------------------------- diff --git a/unix/tclUnixCompat.c b/unix/tclUnixCompat.c index c2ed2ed..e34405e 100644 --- a/unix/tclUnixCompat.c +++ b/unix/tclUnixCompat.c @@ -6,7 +6,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixCompat.c,v 1.5 2006/09/08 19:24:32 andreas_kupries Exp $ + * RCS: @(#) $Id: tclUnixCompat.c,v 1.6 2006/09/08 20:57:19 vasiljevic Exp $ * */ @@ -57,8 +57,9 @@ static Tcl_ThreadDataKey dataKey; Tcl_Mutex compatLock; -#if (!defined(HAVE_GETHOSTBYNAME_R) || !defined(HAVE_GETHOSTBYADDR_R)) || \ - (!defined(HAVE_GETPWUID_R) || !defined(HAVE_GETGRGID_R)) +#if (!defined(HAVE_GETHOSTBYNAME_R) || !defined(HAVE_GETHOSTBYADDR_R) || \ + !defined(HAVE_GETPWUID_R) || !defined(HAVE_GETGRGID_R)) && \ + (!defined(HAVE_MTSAFE_GETHOSTBYNAME) || !defined(HAVE_MTSAFE_GETHOSTBYADDR)) /* @@ -152,11 +153,12 @@ CopyString(char *src, char *buf, int buflen) return len; } -#endif /* !defined(HAVE_GETHOSTBYNAME_R) && !defined(HAVE_GETHOSTBYADDR_R) && \ - !defined(HAVE_GETPWUID_R) && !defined(HAVE_GETGRGID_R) */ +#endif /* (!defined(HAVE_GETHOSTBYNAME_R) || !defined(HAVE_GETHOSTBYADDR_R) || \ + !defined(HAVE_GETPWUID_R) || !defined(HAVE_GETGRGID_R)) && \ + (!defined(HAVE_MTSAFE_GETHOSTBYNAME) || !defined(HAVE_MTSAFE_GETHOSTBYADDR)) */ - -#if !defined(HAVE_GETHOSTBYNAME_R) || !defined(HAVE_GETHOSTBYADDR_R) +#if (!defined(HAVE_GETHOSTBYNAME_R) || !defined(HAVE_GETHOSTBYADDR_R)) && \ + (!defined(HAVE_MTSAFE_GETHOSTBYNAME) || !defined(HAVE_MTSAFE_GETHOSTBYADDR)) /* *--------------------------------------------------------------------------- @@ -209,7 +211,8 @@ CopyHostent(struct hostent *tgtPtr, char *buf, int buflen) return 0; } -#endif /* !defined(HAVE_GETHOSTBYNAME_R) && !defined(HAVE_GETHOSTBYADDR_R) */ +#endif /* (!defined(HAVE_GETHOSTBYNAME_R) || !defined(HAVE_GETHOSTBYADDR_R)) && \ + (!defined(HAVE_MTSAFE_GETHOSTBYNAME) || !defined(HAVE_MTSAFE_GETHOSTBYADDR)) */ #if !defined(HAVE_GETPWUID_R) @@ -561,7 +564,7 @@ TclpGetGrGid(gid_t gid) struct hostent * TclpGetHostByName(const char *name) { -#if !defined(TCL_THREADS) +#if !defined(TCL_THREADS) || defined(HAVE_MTSAFE_GETHOSTBYNAME) return gethostbyname(name); #else ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -622,7 +625,7 @@ TclpGetHostByName(const char *name) struct hostent * TclpGetHostByAddr(const char *addr, int length, int type) { -#if !defined(TCL_THREADS) +#if !defined(TCL_THREADS) || defined(HAVE_MTSAFE_GETHOSTBYADDR) return gethostbyaddr(addr, length, type); #else ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); |