From d1e33bbc71403b9692b82f09558a1b88a69e1c38 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 26 Aug 2019 15:35:12 +0200 Subject: [PATCH] Add a workaround for broken Xcode 11 beta versions --- configure | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 17 +++++++++++++ 2 files changed, 88 insertions(+) diff --git a/configure b/configure index 8187a5f0..075d4d77 100755 --- a/configure +++ b/configure @@ -7492,6 +7492,77 @@ fi ;; esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a broken Xcode version" >&5 +$as_echo_n "checking for a broken Xcode version... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +#if !defined(__APPLE_CC__) || __APPLE_CC__ != 6000 +#error Not Apple +#endif +#if !defined(__clang_major__) || __clang_major__ != 11 +#error Not Xcode 11 +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Using unsupported Xcode version" >&5 +$as_echo "$as_me: WARNING: Using unsupported Xcode version" >&2;} + as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$CFLAGS -ffreestanding" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $CFLAGS -ffreestanding" >&5 +$as_echo_n "checking whether C compiler accepts $CFLAGS -ffreestanding... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $CFLAGS -ffreestanding" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +time_t x; int fodder = 0; if (fodder > -1000 && time(&x)) return (int) x + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : + CFLAGS="$CFLAGS -ffreestanding" +else + : +fi + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "x$enable_ssp" != "xno"; then : diff --git a/configure.ac b/configure.ac index a2de3fd4..9a878d47 100644 --- a/configure.ac +++ b/configure.ac @@ -284,6 +284,23 @@ AS_CASE([$host_os], ]) ]) +AC_MSG_CHECKING(for a broken Xcode version) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ +#if !defined(__APPLE_CC__) || __APPLE_CC__ != 6000 +#error Not Apple +#endif +#if !defined(__clang_major__) || __clang_major__ != 11 +#error Not Xcode 11 +#endif +]])], + [AC_MSG_RESULT(yes) + AC_MSG_WARN([Using unsupported Xcode version]) + AX_CHECK_COMPILE_FLAG([$CFLAGS -ffreestanding], + [CFLAGS="$CFLAGS -ffreestanding"]) + ], + [AC_MSG_RESULT(no) +]) + AS_IF([test "x$enable_ssp" != "xno"],[ AS_CASE([$host_os],