From 5fb355e21753cf794cbd95111fc35a964a89b6d3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 20 Apr 2022 11:01:39 +0000 Subject: Fix compiler warning, when using Tcl 9.0 headers --- macosx/tkMacOSXMenu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index ffad795..f42b91c 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -1028,7 +1028,7 @@ TkpPostTearoffMenu( * at the given coordinates. */ - if (index >= menuPtr->numEntries) { + if (index < 0 || (TkSizeT)index >= menuPtr->numEntries) { index = menuPtr->numEntries - 1; } if (index >= 0) { -- cgit v0.12 From 6644b8b7ad2134b73c7483ad6426a7acaa7bd2de Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 20 Apr 2022 11:07:40 +0000 Subject: Fix [bf0f4808d7]: macOS Aqua : CFLAGS_OPTIMIZE. Builds on MacOSX will now be done with -O2 and without -std=gnu99 --- macosx/README | 6 +- macosx/Tk-Common.xcconfig | 1 - macosx/Tk-Release.xcconfig | 2 +- macosx/Tk.xcode/project.pbxproj | 32 +++---- macosx/Tk.xcodeproj/project.pbxproj | 39 ++++---- macosx/tkMacOSXPrivate.h | 27 ------ unix/configure | 175 ++---------------------------------- unix/configure.ac | 25 +----- unix/tcl.m4 | 56 ++---------- 9 files changed, 49 insertions(+), 314 deletions(-) diff --git a/macosx/README b/macosx/README index d5ee192..9ec0833 100644 --- a/macosx/README +++ b/macosx/README @@ -391,14 +391,12 @@ trees in a common parent directory. - The following instructions assume the Tcl and Tk source trees are named "tcl${ver}" and "tk${ver}" (where ${ver} is a shell variable containing the -Tcl/Tk version number, e.g. '8.6'). +Tcl/Tk version number, e.g. '8.7'). Setup this shell variable as follows: ver="8.6" -If you are building from CVS, omit this step (CVS source tree names usually do -not contain a version number). - Setup environment variables as desired, e.g. for a universal build on 10.5: - CFLAGS="-arch i386 -arch x86_64 -arch ppc -mmacosx-version-min=10.5" + CFLAGS="-arch x86_64 -arch arm64e -mmacosx-version-min=10.5" export CFLAGS - Change to the directory containing the Tcl and Tk source trees and build: diff --git a/macosx/Tk-Common.xcconfig b/macosx/Tk-Common.xcconfig index 72ef08a..508384f 100644 --- a/macosx/Tk-Common.xcconfig +++ b/macosx/Tk-Common.xcconfig @@ -33,7 +33,6 @@ FRAMEWORK_INSTALL_PATH = /Library/Frameworks INCLUDEDIR = $(PREFIX)/include LIBDIR = $(PREFIX)/lib MANDIR = $(PREFIX)/man -PER_ARCH_CFLAGS_ppc = -mcpu=G3 -mtune=G4 $(PER_ARCH_CFLAGS_ppc) PREFIX = /usr/local TCL_BUILD_DIR = $(OBJROOT)/../tcl/Tcl.build/$(CONFIGURATION)/Tcl.build/Objects TCL_CONFIGURE_ARGS = --enable-dtrace diff --git a/macosx/Tk-Release.xcconfig b/macosx/Tk-Release.xcconfig index 505373c..07287da 100644 --- a/macosx/Tk-Release.xcconfig +++ b/macosx/Tk-Release.xcconfig @@ -13,7 +13,7 @@ DEBUG_INFORMATION_FORMAT = dwarf-with-dsym // DEPLOYMENT_POSTPROCESSING = YES -GCC_OPTIMIZATION_LEVEL = s +GCC_OPTIMIZATION_LEVEL = 2 GCC_PREPROCESSOR_DEFINITIONS = NDEBUG $(TCL_DEFS) $(TK_DEFS) $(GCC_PREPROCESSOR_DEFINITIONS) CONFIGURE_ARGS = --disable-symbols $(TCL_CONFIGURE_ARGS) $(CONFIGURE_ARGS) MAKE_TARGET = deploy diff --git a/macosx/Tk.xcode/project.pbxproj b/macosx/Tk.xcode/project.pbxproj index c1c5b41..89eda46 100644 --- a/macosx/Tk.xcode/project.pbxproj +++ b/macosx/Tk.xcode/project.pbxproj @@ -4747,8 +4747,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_ENABLE_PASCAL_STRINGS = NO; @@ -5059,8 +5059,8 @@ F97258AC0A86873D00096C78 /* ReleaseUniversal */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, @@ -5392,8 +5392,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_ENABLE_PASCAL_STRINGS = NO; @@ -5426,8 +5426,8 @@ F9988BB40D81586D00B6B03B /* ReleaseUniversal gcc40 */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, @@ -5446,8 +5446,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; DEBUG_INFORMATION_FORMAT = dwarf; GCC = "llvm-gcc"; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -5483,8 +5483,8 @@ F9988BB80D81587400B6B03B /* ReleaseUniversal llvm-gcc */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, @@ -5636,8 +5636,8 @@ F9EEED980C2FEFD300396116 /* ReleaseUniversal10.5SDK */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, @@ -5656,8 +5656,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; CPPFLAGS = "-isysroot $(SDKROOT) $(CPPFLAGS)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; diff --git a/macosx/Tk.xcodeproj/project.pbxproj b/macosx/Tk.xcodeproj/project.pbxproj index ea4ecfc..a2c700a 100644 --- a/macosx/Tk.xcodeproj/project.pbxproj +++ b/macosx/Tk.xcodeproj/project.pbxproj @@ -4749,8 +4749,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_ENABLE_PASCAL_STRINGS = NO; @@ -5061,8 +5061,8 @@ F97258AC0A86873D00096C78 /* ReleaseUniversal */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, @@ -5394,8 +5394,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; GCC_ENABLE_PASCAL_STRINGS = NO; @@ -5428,8 +5428,8 @@ F9988BB40D81586D00B6B03B /* ReleaseUniversal gcc40 */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, @@ -5448,8 +5448,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; DEBUG_INFORMATION_FORMAT = dwarf; GCC = "llvm-gcc"; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -5486,8 +5486,8 @@ F9988BB80D81587400B6B03B /* ReleaseUniversal llvm-gcc */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, @@ -5696,9 +5696,8 @@ buildSettings = { ARCHS = ( "$(NATIVE_ARCH_64_BIT)", - "$(NATIVE_ARCH_32_BIT)", ); - CFLAGS = "-arch i386 -arch x86_64 $(CFLAGS)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; DEBUG_INFORMATION_FORMAT = dwarf; GCC = clang; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -5734,8 +5733,8 @@ F9A9D1F60FC77799002A2BE3 /* ReleaseUniversal clang */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, /usr/X11R6/include/freetype2, @@ -5771,8 +5770,8 @@ F9EEED980C2FEFD300396116 /* ReleaseUniversal10.5SDK */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; GCC_INPUT_FILETYPE = sourcecode.c.c; HEADER_SEARCH_PATHS = ( /usr/X11R6/include, @@ -5791,8 +5790,8 @@ isa = XCBuildConfiguration; baseConfigurationReference = F97AE82B0B65C69B00310EA2 /* Tk-Release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CFLAGS = "-arch i386 -arch x86_64 -arch ppc $(CFLAGS)"; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CFLAGS = "-arch x86_64 -arch arm64e $(CFLAGS)"; CPPFLAGS = "-isysroot $(SDKROOT) $(CPPFLAGS)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = supported; diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index ead6a71..7ff0d35 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -332,21 +332,6 @@ VISIBILITY_HIDDEN NSAutoreleasePool *_mainPool; NSThread *_backgoundLoop; Bool _tkLiveResizeEnded; - -#ifdef __i386__ - /* The Objective C runtime used on i386 requires this. */ - int _poolLock; - int _macOSVersion; /* 10000 * major + 100*minor */ - Bool _isDrawing; - Bool _needsToDraw; - Bool _isSigned; - Bool _tkLiveResizeEnded; - TkWindow *_tkPointerWindow; - TkWindow *_tkEventTarget; - TkWindow *_tkDragTarget; - unsigned int _tkButtonState; -#endif - } @property int poolLock; @property int macOSVersion; @@ -463,10 +448,6 @@ VISIBILITY_HIDDEN VISIBILITY_HIDDEN @interface TKWindow : NSWindow { -#ifdef __i386__ - /* The Objective C runtime used on i386 requires this. */ - Window _tkWindow; -#endif } @property Window tkWindow; @end @@ -478,20 +459,12 @@ VISIBILITY_HIDDEN @interface TKDrawerWindow : NSWindow { id _i1, _i2; -#ifdef __i386__ - /* The Objective C runtime used on i386 requires this. */ - Window _tkWindow; -#endif } @property Window tkWindow; @end @interface TKPanel : NSPanel { -#ifdef __i386__ - /* The Objective C runtime used on i386 requires this. */ - Window _tkWindow; -#endif } @property Window tkWindow; @end diff --git a/unix/configure b/unix/configure index 179e629..03ff4b9 100755 --- a/unix/configure +++ b/unix/configure @@ -5247,7 +5247,7 @@ fi LDFLAGS="$LDFLAGS -pthread" ;; Darwin-*) - CFLAGS_OPTIMIZE="-Os" + CFLAGS_OPTIMIZE="-O2" SHLIB_CFLAGS="-fno-common" # To avoid discrepancies between what headers configure sees during # preprocessing tests and compiling tests, move any -isysroot and @@ -5262,47 +5262,7 @@ fi then : case `arch` in - ppc) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch ppc64 flag" >&5 -printf %s "checking if compiler accepts -arch ppc64 flag... " >&6; } -if test ${tcl_cv_cc_arch_ppc64+y} -then : - printf %s "(cached) " >&6 -else $as_nop - - hold_cflags=$CFLAGS - CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - tcl_cv_cc_arch_ppc64=yes -else $as_nop - tcl_cv_cc_arch_ppc64=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS=$hold_cflags -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_ppc64" >&5 -printf "%s\n" "$tcl_cv_cc_arch_ppc64" >&6; } - if test $tcl_cv_cc_arch_ppc64 = yes -then : - - CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" - do64bit_ok=yes - -fi;; - i386) + x86_64) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch x86_64 flag" >&5 printf %s "checking if compiler accepts -arch x86_64 flag... " >&6; } if test ${tcl_cv_cc_arch_x86_64+y} @@ -5342,21 +5302,13 @@ then : do64bit_ok=yes fi;; + arm64e) + do64bit_ok=yes;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5 printf "%s\n" "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};; esac -else $as_nop - - # Check for combined 32-bit and 64-bit fat build - if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \ - && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) ' -then : - - fat_32_64=yes -fi - fi SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if ld accepts -single_module flag" >&5 @@ -5479,17 +5431,6 @@ then : else $as_nop hold_libs=$LIBS - if test "$fat_32_64" = yes -then : - - for v in CFLAGS CPPFLAGS LDFLAGS; do - # On Tiger there is no 64-bit CF, so remove 64-bit - # archs from CFLAGS et al. while testing for - # presence of CF. 64-bit CF is disabled in - # tclUnixPort.h if necessary. - eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' - done -fi LIBS="$LIBS -framework CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5510,13 +5451,6 @@ else $as_nop fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - if test "$fat_32_64" = yes -then : - - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval $v'="$hold_'$v'"' - done -fi LIBS=$hold_libs fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_corefoundation" >&5 @@ -5532,55 +5466,6 @@ printf "%s\n" "#define HAVE_COREFOUNDATION 1" >>confdefs.h else $as_nop tcl_corefoundation=no fi - if test "$fat_32_64" = yes -a $tcl_corefoundation = yes -then : - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit CoreFoundation" >&5 -printf %s "checking for 64-bit CoreFoundation... " >&6; } -if test ${tcl_cv_lib_corefoundation_64+y} -then : - printf %s "(cached) " >&6 -else $as_nop - - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' - done - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -CFBundleRef b = CFBundleGetMainBundle(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - tcl_cv_lib_corefoundation_64=yes -else $as_nop - tcl_cv_lib_corefoundation_64=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval $v'="$hold_'$v'"' - done -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_corefoundation_64" >&5 -printf "%s\n" "$tcl_cv_lib_corefoundation_64" >&6; } - if test $tcl_cv_lib_corefoundation_64 = no -then : - - -printf "%s\n" "#define NO_COREFOUNDATION_64 1" >>confdefs.h - - LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings" - -fi - -fi fi ;; @@ -7454,56 +7339,6 @@ printf "%s\n" "$as_me: WARNING: Aqua requires Mac OS X 10.5 or later" >&2;} fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tk_aqua" >&5 printf "%s\n" "$tk_aqua" >&6; } - if test "$fat_32_64" = yes; then - if test $tk_aqua = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit X11" >&5 -printf %s "checking for 64-bit X11... " >&6; } -if test ${tcl_cv_lib_x11_64+y} -then : - printf %s "(cached) " >&6 -else $as_nop - - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' - done - CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include" - LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -XrmInitialize(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - tcl_cv_lib_x11_64=yes -else $as_nop - tcl_cv_lib_x11_64=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval $v'="$hold_'$v'"' - done -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_x11_64" >&5 -printf "%s\n" "$tcl_cv_lib_x11_64" >&6; } - fi - # remove 64-bit arch flags from CFLAGS et al. for combined 32 & 64 bit - # fat builds if configuration does not support 64-bit. - if test "$tcl_cv_lib_x11_64" = no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Removing 64-bit architectures from compiler & linker flags" >&5 -printf "%s\n" "$as_me: Removing 64-bit architectures from compiler & linker flags" >&6;} - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' - done - fi - fi if test $tk_aqua = no; then # check if weak linking whole libraries is possible. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if ld accepts -weak-l flag" >&5 @@ -7650,7 +7485,7 @@ printf "%s\n" "#define MAC_OSX_TK 1" >>confdefs.h if test -d /System/Library/Frameworks/UserNotifications.framework; then LIBS="$LIBS -framework UserNotifications" fi - EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c' + EXTRA_CC_SWITCHES='-x objective-c' TK_WINDOWINGSYSTEM=AQUA if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then diff --git a/unix/configure.ac b/unix/configure.ac index 631b3ab..cce5c29 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -230,29 +230,6 @@ if test "`uname -s`" = "Darwin" ; then fi fi AC_MSG_RESULT([$tk_aqua]) - if test "$fat_32_64" = yes; then - if test $tk_aqua = no; then - AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [ - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' - done - CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include" - LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[XrmInitialize();]])], - [tcl_cv_lib_x11_64=yes],[tcl_cv_lib_x11_64=no]) - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval $v'="$hold_'$v'"' - done]) - fi - # remove 64-bit arch flags from CFLAGS et al. for combined 32 & 64 bit - # fat builds if configuration does not support 64-bit. - if test "$tcl_cv_lib_x11_64" = no; then - AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags]) - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' - done - fi - fi if test $tk_aqua = no; then # check if weak linking whole libraries is possible. AC_CACHE_CHECK([if ld accepts -weak-l flag], tcl_cv_ld_weak_l, [ @@ -311,7 +288,7 @@ if test $tk_aqua = yes; then if test -d /System/Library/Frameworks/UserNotifications.framework; then LIBS="$LIBS -framework UserNotifications" fi - EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c' + EXTRA_CC_SWITCHES='-x objective-c' TK_WINDOWINGSYSTEM=AQUA if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?]) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index dfbb9be..064c49a 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1369,7 +1369,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ LDFLAGS="$LDFLAGS -pthread" ;; Darwin-*) - CFLAGS_OPTIMIZE="-Os" + CFLAGS_OPTIMIZE="-O2" SHLIB_CFLAGS="-fno-common" # To avoid discrepancies between what headers configure sees during # preprocessing tests and compiling tests, move any -isysroot and @@ -1382,19 +1382,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`" AS_IF([test $do64bit = yes], [ case `arch` in - ppc) - AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag], - tcl_cv_cc_arch_ppc64, [ - hold_cflags=$CFLAGS - CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [tcl_cv_cc_arch_ppc64=yes],[tcl_cv_cc_arch_ppc64=no]) - CFLAGS=$hold_cflags]) - AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [ - CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" - do64bit_ok=yes - ]);; - i386) + x86_64) AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag], tcl_cv_cc_arch_x86_64, [ hold_cflags=$CFLAGS @@ -1406,15 +1394,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS="$CFLAGS -arch x86_64" do64bit_ok=yes ]);; + arm64e) + do64bit_ok=yes;; *) AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);; esac - ], [ - # Check for combined 32-bit and 64-bit fat build - AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \ - && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [ - fat_32_64=yes]) - ]) + ], []) SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}' AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [ hold_ldflags=$LDFLAGS @@ -1461,48 +1446,17 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ AC_CACHE_CHECK([for CoreFoundation.framework], tcl_cv_lib_corefoundation, [ hold_libs=$LIBS - AS_IF([test "$fat_32_64" = yes], [ - for v in CFLAGS CPPFLAGS LDFLAGS; do - # On Tiger there is no 64-bit CF, so remove 64-bit - # archs from CFLAGS et al. while testing for - # presence of CF. 64-bit CF is disabled in - # tclUnixPort.h if necessary. - eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' - done]) LIBS="$LIBS -framework CoreFoundation" AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[CFBundleRef b = CFBundleGetMainBundle();]])], [tcl_cv_lib_corefoundation=yes], [tcl_cv_lib_corefoundation=no]) - AS_IF([test "$fat_32_64" = yes], [ - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval $v'="$hold_'$v'"' - done]) LIBS=$hold_libs]) AS_IF([test $tcl_cv_lib_corefoundation = yes], [ LIBS="$LIBS -framework CoreFoundation" AC_DEFINE(HAVE_COREFOUNDATION, 1, [Do we have access to Darwin CoreFoundation.framework?]) ], [tcl_corefoundation=no]) - AS_IF([test "$fat_32_64" = yes -a $tcl_corefoundation = yes],[ - AC_CACHE_CHECK([for 64-bit CoreFoundation], - tcl_cv_lib_corefoundation_64, [ - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' - done - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[CFBundleRef b = CFBundleGetMainBundle();]])], - [tcl_cv_lib_corefoundation_64=yes], - [tcl_cv_lib_corefoundation_64=no]) - for v in CFLAGS CPPFLAGS LDFLAGS; do - eval $v'="$hold_'$v'"' - done]) - AS_IF([test $tcl_cv_lib_corefoundation_64 = no], [ - AC_DEFINE(NO_COREFOUNDATION_64, 1, - [Is Darwin CoreFoundation unavailable for 64-bit?]) - LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings" - ]) - ]) ]) ;; OS/390-*) -- cgit v0.12 From cc1144423482d3d3469d9dc8e4ba68d73bf79653 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 20 Apr 2022 11:10:31 +0000 Subject: Proposed fix for [f63c37be3a]: functionality on a safe interpreter with Tk --- generic/tkCmds.c | 10 +++++++--- library/tk.tcl | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/generic/tkCmds.c b/generic/tkCmds.c index e652740..4fb06b2 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -60,6 +60,7 @@ MODULE_SCOPE const TkEnsemble tkFontchooserEnsemble[]; */ static const TkEnsemble tkCmdMap[] = { + {"fontchooser", NULL, tkFontchooserEnsemble}, {"appname", AppnameCmd, NULL }, {"busy", Tk_BusyObjCmd, NULL }, {"caret", CaretCmd, NULL }, @@ -67,7 +68,6 @@ static const TkEnsemble tkCmdMap[] = { {"scaling", ScalingCmd, NULL }, {"useinputmethods", UseinputmethodsCmd, NULL }, {"windowingsystem", WindowingsystemCmd, NULL }, - {"fontchooser", NULL, tkFontchooserEnsemble}, {NULL, NULL, NULL} }; @@ -650,9 +650,13 @@ TkInitTkCmd( Tcl_Interp *interp, ClientData clientData) { - TkMakeEnsemble(interp, "::", "tk", clientData, tkCmdMap); + /* If the interp is safe, leave out "fontchooser" */ + int isSafe = Tcl_IsSafe(interp); + TkMakeEnsemble(interp, "::", "tk", clientData, tkCmdMap + isSafe); #if defined(_WIN32) || defined(MAC_OSX_TK) - TkInitFontchooser(interp, clientData); + if (!isSafe) { + TkInitFontchooser(interp, clientData); + } #endif return TCL_OK; } diff --git a/library/tk.tcl b/library/tk.tcl index 7a70f21..0ef1d20 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -507,7 +507,9 @@ if {$::tk_library ne ""} { SourceLibFile scale SourceLibFile scrlbar SourceLibFile spinbox - SourceLibFile systray + if {![interp issafe]} { + SourceLibFile systray + } SourceLibFile text } } -- cgit v0.12 From af6b6491bf5dffb77da1203394b643367c95cd0c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 21 Apr 2022 12:55:04 +0000 Subject: Fix [bf0f4808d7]: macOS Aqua : CFLAGS_OPTIMIZE. Builds on MacOSX will now be done with -O2 --- macosx/Tk-Release.xcconfig | 2 +- unix/configure | 72 ++++++++++++++++++++++++++++++++++++++++++++-- unix/tcl.m4 | 21 +++++++++++--- 3 files changed, 87 insertions(+), 8 deletions(-) diff --git a/macosx/Tk-Release.xcconfig b/macosx/Tk-Release.xcconfig index 505373c..07287da 100644 --- a/macosx/Tk-Release.xcconfig +++ b/macosx/Tk-Release.xcconfig @@ -13,7 +13,7 @@ DEBUG_INFORMATION_FORMAT = dwarf-with-dsym // DEPLOYMENT_POSTPROCESSING = YES -GCC_OPTIMIZATION_LEVEL = s +GCC_OPTIMIZATION_LEVEL = 2 GCC_PREPROCESSOR_DEFINITIONS = NDEBUG $(TCL_DEFS) $(TK_DEFS) $(GCC_PREPROCESSOR_DEFINITIONS) CONFIGURE_ARGS = --disable-symbols $(TCL_CONFIGURE_ARGS) $(CONFIGURE_ARGS) MAKE_TARGET = deploy diff --git a/unix/configure b/unix/configure index 6fe6752..035c1f8 100755 --- a/unix/configure +++ b/unix/configure @@ -5419,7 +5419,7 @@ fi ;; Darwin-*) - CFLAGS_OPTIMIZE="-Os" + CFLAGS_OPTIMIZE="-O2" SHLIB_CFLAGS="-fno-common" # To avoid discrepancies between what headers configure sees during # preprocessing tests and compiling tests, move any -isysroot and @@ -5499,7 +5499,7 @@ echo "${ECHO_T}$tcl_cv_cc_arch_ppc64" >&6 fi ;; - i386) + i386|x86_64) echo "$as_me:$LINENO: checking if compiler accepts -arch x86_64 flag" >&5 echo $ECHO_N "checking if compiler accepts -arch x86_64 flag... $ECHO_C" >&6 if test "${tcl_cv_cc_arch_x86_64+set}" = set; then @@ -5565,6 +5565,72 @@ echo "${ECHO_T}$tcl_cv_cc_arch_x86_64" >&6 fi ;; + arm64|arm64e) + echo "$as_me:$LINENO: checking if compiler accepts -arch arm64e flag" >&5 +echo $ECHO_N "checking if compiler accepts -arch arm64e flag... $ECHO_C" >&6 +if test "${tcl_cv_cc_arch_arm64e+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + hold_cflags=$CFLAGS + CFLAGS="$CFLAGS -arch arm64e" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + 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_cc_arch_arm64e=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cc_arch_arm64e=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_cc_arch_arm64e" >&5 +echo "${ECHO_T}$tcl_cv_cc_arch_arm64e" >&6 + if test $tcl_cv_cc_arch_arm64e = yes; then + + CFLAGS="$CFLAGS -arch arm64e" + do64bit_ok=yes + +fi +;; *) { 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;};; @@ -5573,7 +5639,7 @@ echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >& else # Check for combined 32-bit and 64-bit fat build - if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \ + if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64|arm64e) ' \ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then fat_32_64=yes diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 739dce3..ca94abd 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1504,7 +1504,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ ]) ;; Darwin-*) - CFLAGS_OPTIMIZE="-Os" + CFLAGS_OPTIMIZE="-O2" SHLIB_CFLAGS="-fno-common" # To avoid discrepancies between what headers configure sees during # preprocessing tests and compiling tests, move any -isysroot and @@ -1529,7 +1529,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" do64bit_ok=yes ]);; - i386) + i386|x86_64) AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag], tcl_cv_cc_arch_x86_64, [ hold_cflags=$CFLAGS @@ -1541,12 +1541,24 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS="$CFLAGS -arch x86_64" do64bit_ok=yes ]);; + arm64|arm64e) + AC_CACHE_CHECK([if compiler accepts -arch arm64e flag], + tcl_cv_cc_arch_arm64e, [ + hold_cflags=$CFLAGS + CFLAGS="$CFLAGS -arch arm64e" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [tcl_cv_cc_arch_arm64e=yes],[tcl_cv_cc_arch_arm64e=no]) + CFLAGS=$hold_cflags]) + AS_IF([test $tcl_cv_cc_arch_arm64e = yes], [ + CFLAGS="$CFLAGS -arch arm64e" + do64bit_ok=yes + ]);; *) AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);; esac ], [ # Check for combined 32-bit and 64-bit fat build - AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \ + AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64|arm64e) ' \ && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [ fat_32_64=yes]) ]) @@ -1568,7 +1580,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ tcl_cv_ld_search_paths_first, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])],[tcl_cv_ld_search_paths_first=yes], + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])], + [tcl_cv_ld_search_paths_first=yes], [tcl_cv_ld_search_paths_first=no]) LDFLAGS=$hold_ldflags]) AS_IF([test $tcl_cv_ld_search_paths_first = yes], [ -- cgit v0.12