From 0d69fc832e95cff706d7bb039e2ff329b8c5d202 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 4 Feb 2021 11:11:34 +0000 Subject: Fix [03b70c8918]: core-8-branch : trying to build on macOS10.9 linked against XQuartz --- unix/configure | 65 +++++++++++++++++++++++++++++++++++++++-------------- unix/tcl.m4 | 70 ++++++++++++++++++++++++++++++++-------------------------- win/configure | 35 ++++++++++++++++++++++++++++- win/tcl.m4 | 10 ++++++++- 4 files changed, 131 insertions(+), 49 deletions(-) diff --git a/unix/configure b/unix/configure index 2943334..26de9a8 100755 --- a/unix/configure +++ b/unix/configure @@ -5581,7 +5581,7 @@ fi then : CFLAGS_OPTIMIZE=-O2 - CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -finput-charset=UTF-8" + CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" case "${CC}" in *++|*++-*) ;; @@ -7293,11 +7293,11 @@ then : fi - # See if the compiler supports casting to a union type. - # This is used to stop gcc from printing a compiler - # warning when initializing a union member. + # See if the compiler supports casting to a union type. + # This is used to stop gcc from printing a compiler + # warning when initializing a union member. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5 printf %s "checking for cast to union support... " >&6; } if test ${tcl_cv_cast_to_union+y} then : @@ -7310,8 +7310,8 @@ int main (void) { - union foo { int i; double d; }; - union foo f = (union foo) (int) 0; + union foo { int i; double d; }; + union foo f = (union foo) (int) 0; ; return 0; @@ -7328,13 +7328,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5 printf "%s\n" "$tcl_cv_cast_to_union" >&6; } - if test "$tcl_cv_cast_to_union" = "yes"; then + if test "$tcl_cv_cast_to_union" = "yes"; then printf "%s\n" "#define HAVE_CAST_TO_UNION 1" >>confdefs.h - fi - hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -fno-lto" >&5 + fi + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working -fno-lto" >&5 printf %s "checking for working -fno-lto... " >&6; } if test ${ac_cv_nolto+y} then : @@ -7362,12 +7362,45 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_nolto" >&5 printf "%s\n" "$ac_cv_nolto" >&6; } + CFLAGS=$hold_cflags + if test "$ac_cv_nolto" = "yes" ; then + CFLAGS_NOLTO="-fno-lto" + else + CFLAGS_NOLTO="" + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -finput-charset" >&5 +printf %s "checking if the compiler understands -finput-charset... " >&6; } +if test ${tcl_cv_cc_input_charset+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + tcl_cv_cc_input_charset=yes +else $as_nop + tcl_cv_cc_input_charset=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$hold_cflags - if test "$ac_cv_nolto" = "yes" ; then - CFLAGS_NOLTO="-fno-lto" - else - CFLAGS_NOLTO="" - fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_input_charset" >&5 +printf "%s\n" "$tcl_cv_cc_input_charset" >&6; } + if test $tcl_cv_cc_input_charset = yes; then + CFLAGS="$CFLAGS -finput-charset=UTF-8" + fi ac_fn_c_check_header_compile "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default" if test "x$ac_cv_header_stdbool_h" = xyes diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 08c1907..a8911f8 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -960,7 +960,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g AS_IF([test "$GCC" = yes], [ CFLAGS_OPTIMIZE=-O2 - CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -finput-charset=UTF-8" + CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" case "${CC}" in *++|*++-*) ;; @@ -1838,36 +1838,44 @@ dnl # preprocessing tests use only CPPFLAGS. TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"]) AC_SUBST(TCL_LIBS) - # See if the compiler supports casting to a union type. - # This is used to stop gcc from printing a compiler - # warning when initializing a union member. - - AC_CACHE_CHECK(for cast to union support, - tcl_cv_cast_to_union, - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - union foo { int i; double d; }; - union foo f = (union foo) (int) 0; - ]])], - [tcl_cv_cast_to_union=yes], - [tcl_cv_cast_to_union=no]) - ) - if test "$tcl_cv_cast_to_union" = "yes"; then - AC_DEFINE(HAVE_CAST_TO_UNION, 1, - [Defined when compiler supports casting to union type.]) - fi - hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto" - AC_CACHE_CHECK(for working -fno-lto, - ac_cv_nolto, - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], - [ac_cv_nolto=yes], - [ac_cv_nolto=no]) - ) - CFLAGS=$hold_cflags - if test "$ac_cv_nolto" = "yes" ; then - CFLAGS_NOLTO="-fno-lto" - else - CFLAGS_NOLTO="" - fi + # See if the compiler supports casting to a union type. + # This is used to stop gcc from printing a compiler + # warning when initializing a union member. + + AC_CACHE_CHECK(for cast to union support, + tcl_cv_cast_to_union, + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ + union foo { int i; double d; }; + union foo f = (union foo) (int) 0; + ]])], + [tcl_cv_cast_to_union=yes], + [tcl_cv_cast_to_union=no]) + ) + if test "$tcl_cv_cast_to_union" = "yes"; then + AC_DEFINE(HAVE_CAST_TO_UNION, 1, + [Defined when compiler supports casting to union type.]) + fi + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -fno-lto" + AC_CACHE_CHECK(for working -fno-lto, + ac_cv_nolto, + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [ac_cv_nolto=yes], + [ac_cv_nolto=no]) + ) + CFLAGS=$hold_cflags + if test "$ac_cv_nolto" = "yes" ; then + CFLAGS_NOLTO="-fno-lto" + else + CFLAGS_NOLTO="" + fi + AC_CACHE_CHECK([if the compiler understands -finput-charset], + tcl_cv_cc_input_charset, [ + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_input_charset=yes],[tcl_cv_cc_input_charset=no]) + CFLAGS=$hold_cflags]) + if test $tcl_cv_cc_input_charset = yes; then + CFLAGS="$CFLAGS -finput-charset=UTF-8" + fi AC_CHECK_HEADER(stdbool.h, [AC_DEFINE(HAVE_STDBOOL_H, 1, [Do we have ?])],) diff --git a/win/configure b/win/configure index 97a680b..ae9e666 100755 --- a/win/configure +++ b/win/configure @@ -4323,6 +4323,39 @@ printf "%s\n" "$ac_cv_nolto" >&6; } else CFLAGS_NOLTO="" fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -finput-charset" >&5 +printf %s "checking if the compiler understands -finput-charset... " >&6; } +if test ${tcl_cv_cc_input_charset+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + tcl_cv_cc_input_charset=yes +else $as_nop + tcl_cv_cc_input_charset=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$hold_cflags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_input_charset" >&5 +printf "%s\n" "$tcl_cv_cc_input_charset" >&6; } + if test $tcl_cv_cc_input_charset = yes; then + extra_cflags="$extra_cflags -finput-charset=UTF-8" + fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking compiler flags" >&5 @@ -4386,7 +4419,7 @@ printf "%s\n" "using shared flags" >&6; } CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -finput-charset=UTF-8" + CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= diff --git a/win/tcl.m4 b/win/tcl.m4 index 852aa33..b9a164c 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -617,6 +617,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ else CFLAGS_NOLTO="" fi + AC_CACHE_CHECK([if the compiler understands -finput-charset], + tcl_cv_cc_input_charset, [ + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -finput-charset=UTF-8" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_input_charset=yes],[tcl_cv_cc_input_charset=no]) + CFLAGS=$hold_cflags]) + if test $tcl_cv_cc_input_charset = yes; then + extra_cflags="$extra_cflags -finput-charset=UTF-8" + fi fi AC_MSG_CHECKING([compiler flags]) @@ -677,7 +685,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith -finput-charset=UTF-8" + CFLAGS_WARNING="-Wall -Wextra -Wshadow -Wundef -Wwrite-strings -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= -- cgit v0.12