configure: Use CROSSCFLAGS when testing the cross-compiler.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-04-08 09:43:03 +02:00
parent 1bb1940061
commit b8a6693e19
2 changed files with 30 additions and 22 deletions

28
configure vendored
View File

@ -9669,7 +9669,14 @@ test -n "$CROSSCC" || CROSSCC="false"
if test "$CROSSCC" != "false" if test "$CROSSCC" != "false"
then then
ac_save_CC="$CC" ac_save_CC="$CC"
saved_CFLAGS=$CFLAGS
CROSSCFLAGS=${CROSSCFLAGS:-$CFLAGS}
EXTRACROSSCFLAGS="-DWINE_CROSSTEST -Wall"
CC="$CROSSCC" CC="$CROSSCC"
CFLAGS=$CROSSCFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CROSSCC works" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CROSSCC works" >&5
$as_echo_n "checking whether $CROSSCC works... " >&6; } $as_echo_n "checking whether $CROSSCC works... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@ -9701,13 +9708,6 @@ else
$as_echo "no" >&6; } $as_echo "no" >&6; }
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CC="$ac_save_CC"
CROSSCFLAGS=${CROSSCFLAGS:-$CFLAGS}
EXTRACROSSCFLAGS="-DWINE_CROSSTEST -Wall"
saved_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -fno-strict-aliasing" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -fno-strict-aliasing" >&5
$as_echo_n "checking whether the cross-compiler supports -fno-strict-aliasing... " >&6; } $as_echo_n "checking whether the cross-compiler supports -fno-strict-aliasing... " >&6; }
if ${ac_cv_cflags__fno_strict_aliasing+:} false; then : if ${ac_cv_cflags__fno_strict_aliasing+:} false; then :
@ -9739,7 +9739,7 @@ $as_echo "$ac_cv_cflags__fno_strict_aliasing" >&6; }
if test "x$ac_cv_cflags__fno_strict_aliasing" = xyes; then : if test "x$ac_cv_cflags__fno_strict_aliasing" = xyes; then :
EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -fno-strict-aliasing" EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -fno-strict-aliasing"
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -Werror=unknown-warning-option" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -Werror=unknown-warning-option" >&5
$as_echo_n "checking whether the cross-compiler supports -Werror=unknown-warning-option... " >&6; } $as_echo_n "checking whether the cross-compiler supports -Werror=unknown-warning-option... " >&6; }
if ${ac_cv_cflags__Werror_unknown_warning_option+:} false; then : if ${ac_cv_cflags__Werror_unknown_warning_option+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
@ -10239,9 +10239,7 @@ if test "x$ac_cv_cflags__Wno_format" = xyes; then :
fi ;; fi ;;
esac esac
CFLAGS=$saved_CFLAGS for ac_flag in $CROSSCFLAGS; do
for ac_flag in $CFLAGS; do
case $ac_flag in case $ac_flag in
-g) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gdwarf-2" >&5 -g) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gdwarf-2" >&5
$as_echo_n "checking whether the cross-compiler supports -gdwarf-2... " >&6; } $as_echo_n "checking whether the cross-compiler supports -gdwarf-2... " >&6; }
@ -10308,7 +10306,9 @@ fi ;;
esac esac
done done
test "x$enable_maintainer_mode" != "xyes" || { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -Werror" >&5 if test "x$enable_maintainer_mode" = xyes
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -Werror" >&5
$as_echo_n "checking whether the cross-compiler supports -Werror... " >&6; } $as_echo_n "checking whether the cross-compiler supports -Werror... " >&6; }
if ${ac_cv_cflags__Werror+:} false; then : if ${ac_cv_cflags__Werror+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
@ -10339,6 +10339,10 @@ $as_echo "$ac_cv_cflags__Werror" >&6; }
if test "x$ac_cv_cflags__Werror" = xyes; then : if test "x$ac_cv_cflags__Werror" = xyes; then :
EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -Werror" EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -Werror"
fi fi
fi
CFLAGS=$saved_CFLAGS
CC="$ac_save_CC"
fi fi
fi fi
if test "x$CROSSTARGET" = "x"; then : if test "x$CROSSTARGET" = "x"; then :

View File

@ -1002,7 +1002,12 @@ then
if test "$CROSSCC" != "false" if test "$CROSSCC" != "false"
then then
ac_save_CC="$CC" ac_save_CC="$CC"
saved_CFLAGS=$CFLAGS
AC_SUBST(CROSSCFLAGS,${CROSSCFLAGS:-$CFLAGS})
AC_SUBST(EXTRACROSSCFLAGS,"-DWINE_CROSSTEST -Wall")
CC="$CROSSCC" CC="$CROSSCC"
CFLAGS=$CROSSCFLAGS
AC_MSG_CHECKING([whether $CROSSCC works]) AC_MSG_CHECKING([whether $CROSSCC works])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes]) [AC_MSG_RESULT([yes])
@ -1017,13 +1022,8 @@ then
shift shift
done], done],
[AC_MSG_RESULT([no])]) [AC_MSG_RESULT([no])])
CC="$ac_save_CC"
AC_SUBST(CROSSCFLAGS,${CROSSCFLAGS:-$CFLAGS})
AC_SUBST(EXTRACROSSCFLAGS,"-DWINE_CROSSTEST -Wall")
dnl clang needs to be told to fail on unknown options
saved_CFLAGS=$CFLAGS
WINE_TRY_CROSSCFLAGS([-fno-strict-aliasing]) WINE_TRY_CROSSCFLAGS([-fno-strict-aliasing])
dnl clang needs to be told to fail on unknown options
WINE_TRY_CROSSCFLAGS([-Werror=unknown-warning-option]) WINE_TRY_CROSSCFLAGS([-Werror=unknown-warning-option])
WINE_TRY_CROSSCFLAGS([-Wdeclaration-after-statement]) WINE_TRY_CROSSCFLAGS([-Wdeclaration-after-statement])
WINE_TRY_CROSSCFLAGS([-Wempty-body]) WINE_TRY_CROSSCFLAGS([-Wempty-body])
@ -1044,17 +1044,21 @@ then
x86_64) WINE_TRY_CROSSCFLAGS([-Wno-format]) ;; x86_64) WINE_TRY_CROSSCFLAGS([-Wno-format]) ;;
esac esac
CFLAGS=$saved_CFLAGS
dnl Default to dwarf-2 debug info dnl Default to dwarf-2 debug info
for ac_flag in $CFLAGS; do for ac_flag in $CROSSCFLAGS; do
case $ac_flag in case $ac_flag in
-g) WINE_TRY_CROSSCFLAGS([-gdwarf-2]) -g) WINE_TRY_CROSSCFLAGS([-gdwarf-2])
WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;; WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;;
esac esac
done done
test "x$enable_maintainer_mode" != "xyes" || WINE_TRY_CROSSCFLAGS([-Werror]) if test "x$enable_maintainer_mode" = xyes
then
WINE_TRY_CROSSCFLAGS([-Werror])
fi
CFLAGS=$saved_CFLAGS
CC="$ac_save_CC"
fi fi
fi fi
WINE_NOTICE_WITH(mingw,[test "x$CROSSTARGET" = "x"], WINE_NOTICE_WITH(mingw,[test "x$CROSSTARGET" = "x"],