From 6e413c43c808774a91f542de590fb533b0fdd1c7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 4 Dec 2024 17:55:36 +0000 Subject: Remove a lot of dead code: macOS < 10.9 is no longer supported --- macosx/tclMacOSXBundle.c | 69 +--------------- macosx/tclMacOSXFCmd.c | 14 ---- macosx/tclMacOSXNotify.c | 207 +---------------------------------------------- unix/configure | 49 +++-------- unix/configure.ac | 57 +++++-------- unix/tclConfig.h.in | 3 - 6 files changed, 35 insertions(+), 364 deletions(-) diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c index 6707ef0..fa95554 100644 --- a/macosx/tclMacOSXBundle.c +++ b/macosx/tclMacOSXBundle.c @@ -17,48 +17,7 @@ #ifdef HAVE_COREFOUNDATION #include -#ifndef TCL_DYLD_USE_DLFCN -/* - * Use preferred dlfcn API on 10.4 and later - */ -# if !defined(NO_DLFCN_H) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 -# define TCL_DYLD_USE_DLFCN 1 -# else -# define TCL_DYLD_USE_DLFCN 0 -# endif -#endif /* TCL_DYLD_USE_DLFCN */ - -#ifndef TCL_DYLD_USE_NSMODULE -/* - * Use deprecated NSModule API only to support 10.3 and earlier: - */ -# if MAC_OS_X_VERSION_MIN_REQUIRED < 1040 -# define TCL_DYLD_USE_NSMODULE 1 -# else -# define TCL_DYLD_USE_NSMODULE 0 -# endif -#endif /* TCL_DYLD_USE_NSMODULE */ - -#if TCL_DYLD_USE_DLFCN #include -#if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1040 -/* - * Support for weakly importing dlfcn API. - */ -extern void * dlsym(void *handle, const char *symbol) - WEAK_IMPORT_ATTRIBUTE; -extern char * dlerror(void) WEAK_IMPORT_ATTRIBUTE; -#endif -#endif /* TCL_DYLD_USE_DLFCN */ - -#if TCL_DYLD_USE_NSMODULE -#include -#endif - -#if (TCL_DYLD_USE_DLFCN && MAC_OS_X_VERSION_MIN_REQUIRED < 1040) || \ - (MAC_OS_X_VERSION_MIN_REQUIRED < 1050) -MODULE_SCOPE long tclMacOSXDarwinRelease; -#endif #ifdef TCL_DEBUG_LOAD #define TclLoadDbgMsg(m, ...) \ @@ -102,10 +61,6 @@ OpenResourceMap( static short (*openresourcemap)(CFBundleRef) = NULL; if (!initialized) { -#if TCL_DYLD_USE_DLFCN -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040 - if (tclMacOSXDarwinRelease >= 8) -#endif { openresourcemap = (short (*)(CFBundleRef))dlsym(RTLD_NEXT, "CFBundleOpenBundleResourceMap"); @@ -117,21 +72,6 @@ OpenResourceMap( } #endif /* TCL_DEBUG_LOAD */ } - if (!openresourcemap) -#endif /* TCL_DYLD_USE_DLFCN */ - { -#if TCL_DYLD_USE_NSMODULE - if (NSIsSymbolNameDefinedWithHint( - "_CFBundleOpenBundleResourceMap", "CoreFoundation")) { - NSSymbol nsSymbol = NSLookupAndBindSymbolWithHint( - "_CFBundleOpenBundleResourceMap", "CoreFoundation"); - - if (nsSymbol) { - openresourcemap = NSAddressOfSymbol(nsSymbol); - } - } -#endif /* TCL_DYLD_USE_NSMODULE */ - } initialized = TRUE; } @@ -205,7 +145,7 @@ Tcl_MacOSXOpenVersionedBundleResources( const char *bundleName, const char *bundleVersion, int hasResourceFile, - int maxPathLen, + Tcl_Size maxPathLen, char *libraryPath) { #ifdef HAVE_COREFOUNDATION @@ -287,13 +227,6 @@ Tcl_MacOSXOpenVersionedBundleResources( CFRelease(libURL); } if (versionedBundleRef) { -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 - /* - * Workaround CFBundle bug in Tiger and earlier. [Bug 2569449] - */ - - if (tclMacOSXDarwinRelease >= 9) -#endif { CFRelease(versionedBundleRef); } diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c index 3ff3d24..42c322b 100644 --- a/macosx/tclMacOSXFCmd.c +++ b/macosx/tclMacOSXFCmd.c @@ -22,26 +22,12 @@ #ifdef HAVE_COPYFILE #ifdef HAVE_COPYFILE_H #include -#if defined(HAVE_WEAK_IMPORT) && (MAC_OS_X_VERSION_MIN_REQUIRED < 1040) -/* Support for weakly importing copyfile. */ -#define WEAK_IMPORT_COPYFILE -extern int copyfile(const char *from, const char *to, - copyfile_state_t state, copyfile_flags_t flags) - WEAK_IMPORT_ATTRIBUTE; -#endif /* HAVE_WEAK_IMPORT */ #else /* HAVE_COPYFILE_H */ int copyfile(const char *from, const char *to, void *state, uint32_t flags); #define COPYFILE_ACL (1<<0) #define COPYFILE_XATTR (1<<2) #define COPYFILE_NOFOLLOW_SRC (1<<18) -#if defined(HAVE_WEAK_IMPORT) && (MAC_OS_X_VERSION_MIN_REQUIRED < 1040) -/* Support for weakly importing copyfile. */ -#define WEAK_IMPORT_COPYFILE -extern int copyfile(const char *from, const char *to, - void *state, uint32_t flags) - WEAK_IMPORT_ATTRIBUTE; -#endif /* HAVE_WEAK_IMPORT */ #endif /* HAVE_COPYFILE_H */ #endif /* HAVE_COPYFILE */ diff --git a/macosx/tclMacOSXNotify.c b/macosx/tclMacOSXNotify.c index 3243757..ae55d61 100644 --- a/macosx/tclMacOSXNotify.c +++ b/macosx/tclMacOSXNotify.c @@ -23,7 +23,6 @@ #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 #define USE_OS_UNFAIR_LOCK #include -#undef TCL_MAC_DEBUG_NOTIFIER #endif #ifdef HAVE_COREFOUNDATION /* Traditional unix select-based notifier is @@ -31,8 +30,6 @@ #include #include -/* #define TCL_MAC_DEBUG_NOTIFIER 1 */ - #if !defined(USE_OS_UNFAIR_LOCK) /* @@ -54,75 +51,6 @@ #include -#if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1040 -/* - * Support for weakly importing spinlock API. - */ -#define WEAK_IMPORT_SPINLOCKLOCK - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 -#define VOLATILE volatile -#else -#define VOLATILE -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 */ - -#ifndef bool -#define bool int -#endif - -extern void OSSpinLockLock(VOLATILE OSSpinLock *lock) - WEAK_IMPORT_ATTRIBUTE; -extern void OSSpinLockUnlock(VOLATILE OSSpinLock *lock) - WEAK_IMPORT_ATTRIBUTE; -extern bool OSSpinLockTry(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; -extern bool _spin_lock_try(VOLATILE OSSpinLock *lock) - WEAK_IMPORT_ATTRIBUTE; -static void (* lockLock)(VOLATILE OSSpinLock *lock) = NULL; -static void (* lockUnlock)(VOLATILE OSSpinLock *lock) = NULL; -static bool (* lockTry)(VOLATILE OSSpinLock *lock) = NULL; -#undef VOLATILE -static pthread_once_t spinLockLockInitControl = PTHREAD_ONCE_INIT; -static void -SpinLockLockInit(void) -{ - lockLock = OSSpinLockLock != NULL ? OSSpinLockLock : _spin_lock; - lockUnlock = OSSpinLockUnlock != NULL ? OSSpinLockUnlock : _spin_unlock; - lockTry = OSSpinLockTry != NULL ? OSSpinLockTry : _spin_lock_try; - if (lockLock == NULL || lockUnlock == NULL) { - Tcl_Panic("SpinLockLockInit: no spinlock API available"); - } -} - -/* - * Wrappers so that we get warnings in just one small part of this file. - */ - -static inline void -SpinLockLock( - VOLATILE OSSpinLock *lock) -{ - lockLock(lock); -} -static inline void -SpinLockUnlock( - VOLATILE OSSpinLock *lock) -{ - lockUnlock(lock); -} -static inline bool -SpinLockTry( - VOLATILE OSSpinLock *lock) -{ - return lockTry(lock); -} - -#else /* !HAVE_WEAK_IMPORT */ - /* * Wrappers so that we get warnings in just one small part of this file. */ @@ -145,7 +73,6 @@ SpinLockTry( { return OSSpinLockTry(lock); } -#endif /* HAVE_WEAK_IMPORT */ #define SPINLOCK_INIT OS_SPINLOCK_INIT #else @@ -221,83 +148,6 @@ static OSSpinLock notifierLock = SPINLOCK_INIT; #endif /* - * The debug version of the Notifier only works if using OSSpinLock. - */ - -#if defined(TCL_MAC_DEBUG_NOTIFIER) && !defined(USE_OS_UNFAIR_LOCK) -#define TclMacOSXNotifierDbgMsg(m, ...) \ - do { \ - fprintf(notifierLog?notifierLog:stderr, "tclMacOSXNotify.c:%d: " \ - "%s() pid %5d thread %10p: " m "\n", __LINE__, __func__, \ - getpid(), pthread_self(), ##__VA_ARGS__); \ - fflush(notifierLog?notifierLog:stderr); \ - } while (0) - -/* - * Debug version of SpinLockLock that logs the time spent waiting for the lock - */ - -#define SpinLockLockDbg(p) \ - if (!SpinLockTry(p)) { \ - long long s = TclpGetWideClicks(), e; \ - \ - SpinLockLock(p); \ - e = TclpGetWideClicks(); \ - TclMacOSXNotifierDbgMsg("waited on %s for %8.0f ns", \ - #p, TclpWideClicksToNanoseconds(e-s)); \ - } -#undef LOCK_NOTIFIER_INIT -#define LOCK_NOTIFIER_INIT SpinLockLockDbg(¬ifierInitLock) -#undef LOCK_NOTIFIER -#define LOCK_NOTIFIER SpinLockLockDbg(¬ifierLock) -#undef LOCK_NOTIFIER_TSD -#define LOCK_NOTIFIER_TSD SpinLockLockDbg(tsdPtr->tsdLock) -#include -static FILE *notifierLog = NULL; -#ifndef NOTIFIER_LOG -#define NOTIFIER_LOG "/tmp/tclMacOSXNotify.log" -#endif -#define OPEN_NOTIFIER_LOG \ - if (!notifierLog) { \ - notifierLog = fopen(NOTIFIER_LOG, "a"); \ - /*TclMacOSXNotifierDbgMsg("open log"); \ - *asl_set_filter(NULL, \ - * ASL_FILTER_MASK_UPTO(ASL_LEVEL_DEBUG)); \ - *asl_add_log_file(NULL, fileno(notifierLog));*/ \ - } -#define CLOSE_NOTIFIER_LOG \ - if (notifierLog) { \ - /*asl_remove_log_file(NULL, fileno(notifierLog)); \ - *TclMacOSXNotifierDbgMsg("close log");*/ \ - fclose(notifierLog); \ - notifierLog = NULL; \ - } -#define ENABLE_ASL \ - if (notifierLog) { \ - /*tsdPtr->asl = asl_open(NULL, "com.apple.console", \ - * ASL_OPT_NO_REMOTE); \ - *asl_set_filter(tsdPtr->asl, \ - * ASL_FILTER_MASK_UPTO(ASL_LEVEL_DEBUG)); \ - *asl_add_log_file(tsdPtr->asl, fileno(notifierLog));*/ \ - } -#define DISABLE_ASL \ - /*if (tsdPtr->asl) { \ - * if (notifierLog) { \ - * asl_remove_log_file(tsdPtr->asl, fileno(notifierLog)); \ - * } \ - * asl_close(tsdPtr->asl); \ - *}*/ -#define ASLCLIENT_DECL /*aslclient asl*/ -#else -#define TclMacOSXNotifierDbgMsg(m, ...) -#define OPEN_NOTIFIER_LOG -#define CLOSE_NOTIFIER_LOG -#define ENABLE_ASL -#define DISABLE_ASL -#define ASLCLIENT_DECL -#endif /* TCL_MAC_DEBUG_NOTIFIER */ - -/* * This structure is used to keep track of the notifier info for a registered * file. */ @@ -408,7 +258,6 @@ typedef struct ThreadSpecificData { CFTimeInterval waitTime; /* runLoopTimer wait time when running * embedded. */ - ASLCLIENT_DECL; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; @@ -520,29 +369,7 @@ static int atForkInit = 0; static void AtForkPrepare(void); static void AtForkParent(void); static void AtForkChild(void); -#if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1040 -/* Support for weakly importing pthread_atfork. */ -#define WEAK_IMPORT_PTHREAD_ATFORK -extern int pthread_atfork(void (*prepare)(void), - void (*parent)(void), void (*child)(void)) - WEAK_IMPORT_ATTRIBUTE; -#define MayUsePthreadAtfork() (pthread_atfork != NULL) -#else -#define MayUsePthreadAtfork() (1) -#endif /* HAVE_WEAK_IMPORT */ - -/* - * On Darwin 9 and later, it is not possible to call CoreFoundation after - * a fork. - */ -#if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || \ - MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -MODULE_SCOPE long tclMacOSXDarwinRelease; -#define noCFafterFork (tclMacOSXDarwinRelease >= 9) -#else /* MAC_OS_X_VERSION_MIN_REQUIRED */ -#define noCFafterFork 1 -#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */ #endif /* HAVE_PTHREAD_ATFORK */ /* @@ -706,7 +533,7 @@ TclpInitNotifier(void) * child of a fork. */ - if (MayUsePthreadAtfork() && !atForkInit) { + if (!atForkInit) { int result = pthread_atfork(AtForkPrepare, AtForkParent, AtForkChild); if (result) { @@ -749,9 +576,7 @@ TclpInitNotifier(void) */ notifierThreadRunning = 0; - OPEN_NOTIFIER_LOG; } - ENABLE_ASL; notifierCount++; UNLOCK_NOTIFIER_INIT; return tsdPtr; @@ -846,7 +671,6 @@ StartNotifierThread(void) } UNLOCK_NOTIFIER_INIT; } - /* *---------------------------------------------------------------------- @@ -874,7 +698,6 @@ TclpFinalizeNotifier( LOCK_NOTIFIER_INIT; notifierCount--; - DISABLE_ASL; /* * If this is the last thread to use the notifier, close the notifier pipe @@ -918,7 +741,6 @@ TclpFinalizeNotifier( close(receivePipe); triggerPipe = -1; } - CLOSE_NOTIFIER_LOG; } UNLOCK_NOTIFIER_INIT; @@ -1607,11 +1429,6 @@ OnOffWaitingList( { int changeWaitingList; -#if defined(TCL_MAC_DEBUG_NOTIFIER) && !defined(USE_OS_UNFAIR_LOCK) - if (SpinLockTry(¬ifierLock)) { - Tcl_Panic("OnOffWaitingList: notifierLock unlocked"); - } -#endif changeWaitingList = (!onList ^ !tsdPtr->onList); if (changeWaitingList) { if (onList) { @@ -1705,7 +1522,6 @@ Tcl_Sleep( Tcl_Panic("Tcl_Sleep: CFRunLoop finished"); break; case kCFRunLoopRunStopped: - TclMacOSXNotifierDbgMsg("CFRunLoop stopped"); waitTime = waitEnd - CFAbsoluteTimeGetCurrent(); break; case kCFRunLoopRunTimedOut: @@ -2234,14 +2050,6 @@ AtForkChild(void) if (tsdPtr->runLoop) { tsdPtr->runLoop = NULL; - if (!noCFafterFork) { - CFRunLoopSourceInvalidate(tsdPtr->runLoopSource); - CFRelease(tsdPtr->runLoopSource); - if (tsdPtr->runLoopTimer) { - CFRunLoopTimerInvalidate(tsdPtr->runLoopTimer); - CFRelease(tsdPtr->runLoopTimer); - } - } tsdPtr->runLoopSource = NULL; tsdPtr->runLoopTimer = NULL; } @@ -2250,19 +2058,6 @@ AtForkChild(void) notifierThreadRunning = 0; /* - * Assume that the return value of Tcl_InitNotifier in the child will - * be identical to the one stored as clientData in tclNotify.c's - * ThreadSpecificData by the parent's TclInitNotifier, so discard the - * return value here. This assumption may require the fork() to be - * executed in the main thread of the parent, otherwise - * Tcl_AlertNotifier may break in the child. - */ - - if (!noCFafterFork) { - Tcl_InitNotifier(); - } - - /* * Restart the notifier thread for signal handling. */ diff --git a/unix/configure b/unix/configure index 7110b71..489c969 100755 --- a/unix/configure +++ b/unix/configure @@ -10426,14 +10426,6 @@ printf "%s\n" "#define TCL_LOAD_FROM_MEMORY 1" >>confdefs.h printf "%s\n" "#define TCL_WIDE_CLICKS 1" >>confdefs.h - ac_fn_c_check_header_compile "$LINENO" "AvailabilityMacros.h" "ac_cv_header_AvailabilityMacros_h" "$ac_includes_default" -if test "x$ac_cv_header_AvailabilityMacros_h" = xyes -then : - printf "%s\n" "#define HAVE_AVAILABILITYMACROS_H 1" >>confdefs.h - -fi - - if test "$ac_cv_header_AvailabilityMacros_h" = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if weak import is available" >&5 printf %s "checking if weak import is available... " >&6; } if test ${tcl_cv_cc_weak_import+y} @@ -10441,18 +10433,11 @@ then : printf %s "(cached) " >&6 else case e in #( e) - hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 - #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 - #endif - #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020 - #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020 - #endif - int rand(void) __attribute__((weak_import)); + int rand(void) __attribute__((weak_import)); int main (void) @@ -10471,36 +10456,29 @@ esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CFLAGS=$hold_cflags ;; + CFLAGS=$hold_cflags ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_weak_import" >&5 printf "%s\n" "$tcl_cv_cc_weak_import" >&6; } - if test $tcl_cv_cc_weak_import = yes; then + if test $tcl_cv_cc_weak_import = yes; then printf "%s\n" "#define HAVE_WEAK_IMPORT 1" >>confdefs.h - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if Darwin SUSv3 extensions are available" >&5 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if Darwin SUSv3 extensions are available" >&5 printf %s "checking if Darwin SUSv3 extensions are available... " >&6; } if test ${tcl_cv_cc_darwin_c_source+y} then : printf %s "(cached) " >&6 else case e in #( e) - hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 - #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 - #endif - #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050 - #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050 - #endif - #define _DARWIN_C_SOURCE 1 - #include + #define _DARWIN_C_SOURCE 1 + #include int main (void) @@ -10518,16 +10496,15 @@ else case e in #( esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$hold_cflags ;; + CFLAGS=$hold_cflags ;; esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_darwin_c_source" >&5 printf "%s\n" "$tcl_cv_cc_darwin_c_source" >&6; } - if test $tcl_cv_cc_darwin_c_source = yes; then + if test $tcl_cv_cc_darwin_c_source = yes; then printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h - fi fi # Build .bundle dltest binaries in addition to .dylib DLTEST_LD='${CC} -bundle -Wl,-w ${CFLAGS} ${LDFLAGS}' diff --git a/unix/configure.ac b/unix/configure.ac index 658eb6a..240e8ac 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -539,44 +539,27 @@ if test "`uname -s`" = "Darwin" ; then [Can this platform load code from memory?]) AC_DEFINE(TCL_WIDE_CLICKS, 1, [Does this platform have wide high-resolution clicks?]) - AC_CHECK_HEADERS(AvailabilityMacros.h) - if test "$ac_cv_header_AvailabilityMacros_h" = yes; then AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [ - hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 - #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 - #endif - #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020 - #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020 - #endif - int rand(void) __attribute__((weak_import)); - ]], [[rand();]])], - [tcl_cv_cc_weak_import=yes],[tcl_cv_cc_weak_import=no]) - CFLAGS=$hold_cflags]) - if test $tcl_cv_cc_weak_import = yes; then - AC_DEFINE(HAVE_WEAK_IMPORT, 1, [Is weak import available?]) - fi - AC_CACHE_CHECK([if Darwin SUSv3 extensions are available], - tcl_cv_cc_darwin_c_source, [ - hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 - #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 - #endif - #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050 - #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050 - #endif - #define _DARWIN_C_SOURCE 1 - #include - ]], [[]])],[tcl_cv_cc_darwin_c_source=yes],[tcl_cv_cc_darwin_c_source=no]) - CFLAGS=$hold_cflags]) - if test $tcl_cv_cc_darwin_c_source = yes; then - AC_DEFINE(_DARWIN_C_SOURCE, 1, - [Are Darwin SUSv3 extensions available?]) - fi + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + int rand(void) __attribute__((weak_import)); + ]], [[rand();]])], + [tcl_cv_cc_weak_import=yes],[tcl_cv_cc_weak_import=no]) + CFLAGS=$hold_cflags]) + if test $tcl_cv_cc_weak_import = yes; then + AC_DEFINE(HAVE_WEAK_IMPORT, 1, [Is weak import available?]) + fi + AC_CACHE_CHECK([if Darwin SUSv3 extensions are available], + tcl_cv_cc_darwin_c_source, [ + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #define _DARWIN_C_SOURCE 1 + #include + ]], [[]])],[tcl_cv_cc_darwin_c_source=yes],[tcl_cv_cc_darwin_c_source=no]) + CFLAGS=$hold_cflags]) + if test $tcl_cv_cc_darwin_c_source = yes; then + AC_DEFINE(_DARWIN_C_SOURCE, 1, + [Are Darwin SUSv3 extensions available?]) fi # Build .bundle dltest binaries in addition to .dylib DLTEST_LD='${CC} -bundle -Wl,-w ${CFLAGS} ${LDFLAGS}' diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index b5e8198..e1a15a0 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -7,9 +7,6 @@ /* Is gettimeofday() actually declared in ? */ #undef GETTOD_NOT_DECLARED -/* Define to 1 if you have the header file. */ -#undef HAVE_AVAILABILITYMACROS_H - /* Define to 1 if the system has the type 'blkcnt_t'. */ #undef HAVE_BLKCNT_T -- cgit v0.12