configure: Try to detect a C99 flag for the cross compiler.

Similar to what AC_PROC_CC does for the host compiler.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52723
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-03-25 11:18:37 +01:00
parent d9fdde935a
commit 0aa31b735c
2 changed files with 52 additions and 0 deletions

35
configure vendored
View File

@ -10707,6 +10707,41 @@ then :
CFLAGS="$CFLAGS $llvm_cflags"
fi
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CROSSCC option to enable C99 features" >&5
printf %s "checking for $CROSSCC option to enable C99 features... " >&6; }
if test ${wine_cv_crosscc_c99+y}
then :
printf %s "(cached) " >&6
else $as_nop
wine_cv_crosscc_c99=no
for arg in '' '-std=gnu99'
do
CC="$CROSSCC $arg"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_c_conftest_c99_program
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
wine_cv_crosscc_c99=$arg
else $as_nop
wine_cv_crosscc_c99=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
test "x$wine_cv_crosscc_c99" != xno && break
done
fi
case "x$wine_cv_crosscc_c99" in
x) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
printf "%s\n" "none needed" >&6; } ;;
xno) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
printf "%s\n" "unsupported" >&6; } ;;
x*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_crosscc_c99" >&5
printf "%s\n" "$wine_cv_crosscc_c99" >&6; }
CROSSCC="$CROSSCC $wine_cv_crosscc_c99" ;;
esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -fno-strict-aliasing" >&5
printf %s "checking whether the cross-compiler supports -fno-strict-aliasing... " >&6; }
if test ${ac_cv_crosscflags__fno_strict_aliasing+y}

View File

@ -913,6 +913,23 @@ then
AC_SUBST(DELAYLOADFLAG,["-Wl,-delayload,"])
CFLAGS="$CFLAGS $llvm_cflags"])
fi
AC_MSG_CHECKING([for $CROSSCC option to enable C99 features])
AC_CACHE_VAL([wine_cv_crosscc_c99],
[wine_cv_crosscc_c99=no
for arg in '' '-std=gnu99'
do
CC="$CROSSCC $arg"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([$ac_c_conftest_c99_program])],
[wine_cv_crosscc_c99=$arg],[wine_cv_crosscc_c99=no])
test "x$wine_cv_crosscc_c99" != xno && break
done])
case "x$wine_cv_crosscc_c99" in
x) AC_MSG_RESULT([none needed]) ;;
xno) AC_MSG_RESULT([unsupported]) ;;
x*) AC_MSG_RESULT([$wine_cv_crosscc_c99])
CROSSCC="$CROSSCC $wine_cv_crosscc_c99" ;;
esac
WINE_TRY_CROSSCFLAGS([-fno-strict-aliasing])
dnl clang needs to be told to fail on unknown options
WINE_TRY_CROSSCFLAGS([-Werror=unknown-warning-option],[CFLAGS="$CFLAGS -Werror=unknown-warning-option"])