Commit 870f99ec authored by Alexandre Julliard's avatar Alexandre Julliard

configure: Check for supported warning flags also for the cross-compiler.

parent 3e6a4c4a
...@@ -42,6 +42,7 @@ CFLAGS = @CFLAGS@ ...@@ -42,6 +42,7 @@ CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@ CPPFLAGS = @CPPFLAGS@
CROSSCFLAGS = @CROSSCFLAGS@ CROSSCFLAGS = @CROSSCFLAGS@
EXTRACFLAGS = @EXTRACFLAGS@ EXTRACFLAGS = @EXTRACFLAGS@
EXTRACROSSCFLAGS= @EXTRACROSSCFLAGS@
MSVCRTFLAGS = @BUILTINFLAG@ MSVCRTFLAGS = @BUILTINFLAG@
TARGETFLAGS = @TARGETFLAGS@ TARGETFLAGS = @TARGETFLAGS@
UNWINDFLAGS = @UNWINDFLAGS@ UNWINDFLAGS = @UNWINDFLAGS@
......
...@@ -149,6 +149,29 @@ CFLAGS=$ac_wine_try_cflags_saved]) ...@@ -149,6 +149,29 @@ CFLAGS=$ac_wine_try_cflags_saved])
AS_VAR_IF([ac_var],[yes],[m4_default([$2], [EXTRACFLAGS="$EXTRACFLAGS $1"])], [$3])dnl AS_VAR_IF([ac_var],[yes],[m4_default([$2], [EXTRACFLAGS="$EXTRACFLAGS $1"])], [$3])dnl
AS_VAR_POPDEF([ac_var])]) AS_VAR_POPDEF([ac_var])])
dnl **** Check if we can link an empty program with special CFLAGS ****
dnl
dnl Usage: WINE_TRY_CROSSCFLAGS(flags,[action-if-yes,[action-if-no]])
dnl
dnl The default action-if-yes is to append the flags to EXTRACROSSCFLAGS.
dnl
AC_DEFUN([WINE_TRY_CROSSCFLAGS],
[AS_VAR_PUSHDEF([ac_var], ac_cv_cflags_[[$1]])dnl
AC_CACHE_CHECK([whether the cross-compiler supports $1], ac_var,
[ac_wine_try_cflags_saved=$CFLAGS
ac_wine_try_cflags_saved_cc=$CC
ac_wine_try_cflags_saved_exeext=$ac_exeext
CFLAGS="$CFLAGS $1"
CC="$CROSSCC"
ac_exeext=".exe"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(int argc, char **argv) { return 0; }]])],
[AS_VAR_SET(ac_var,yes)], [AS_VAR_SET(ac_var,no)])
CFLAGS=$ac_wine_try_cflags_saved
CC=$ac_wine_try_cflags_saved_cc
ac_exeext=$ac_wine_try_cflags_saved_exeext])
AS_VAR_IF([ac_var],[yes],[m4_default([$2], [EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS $1"])], [$3])dnl
AS_VAR_POPDEF([ac_var])])
dnl **** Check if we can link an empty shared lib (no main) with special CFLAGS **** dnl **** Check if we can link an empty shared lib (no main) with special CFLAGS ****
dnl dnl
dnl Usage: WINE_TRY_SHLIB_FLAGS(flags,[action-if-yes,[action-if-no]]) dnl Usage: WINE_TRY_SHLIB_FLAGS(flags,[action-if-yes,[action-if-no]])
......
...@@ -1019,6 +1019,42 @@ then ...@@ -1019,6 +1019,42 @@ then
[AC_MSG_RESULT([no])]) [AC_MSG_RESULT([no])])
CC="$ac_save_CC" CC="$ac_save_CC"
AC_SUBST(CROSSCFLAGS,${CROSSCFLAGS:-$CFLAGS}) 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([-Werror=unknown-warning-option])
WINE_TRY_CROSSCFLAGS([-Wdeclaration-after-statement])
WINE_TRY_CROSSCFLAGS([-Wempty-body])
WINE_TRY_CROSSCFLAGS([-Wignored-qualifiers])
WINE_TRY_CROSSCFLAGS([-Wpacked-not-aligned],[EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -Wno-packed-not-aligned"])
WINE_TRY_CROSSCFLAGS([-Wpragma-pack],[EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -Wno-pragma-pack"])
WINE_TRY_CROSSCFLAGS([-Wshift-overflow=2])
WINE_TRY_CROSSCFLAGS([-Wstrict-prototypes])
WINE_TRY_CROSSCFLAGS([-Wtype-limits])
WINE_TRY_CROSSCFLAGS([-Wunused-but-set-parameter])
WINE_TRY_CROSSCFLAGS([-Wvla])
WINE_TRY_CROSSCFLAGS([-Wwrite-strings])
WINE_TRY_CROSSCFLAGS([-Wpointer-arith])
WINE_TRY_CROSSCFLAGS([-Wlogical-op])
case $host_cpu in
*i[[3456789]]86*) WINE_TRY_CROSSCFLAGS([-fno-omit-frame-pointer]) ;;
x86_64) WINE_TRY_CROSSCFLAGS([-Wno-format]) ;;
esac
CFLAGS=$saved_CFLAGS
dnl Default to dwarf-2 debug info
for ac_flag in $CFLAGS; do
case $ac_flag in
-g) WINE_TRY_CROSSCFLAGS([-gdwarf-2])
WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;;
esac
done
test "x$enable_maintainer_mode" != "xyes" || WINE_TRY_CROSSCFLAGS([-Werror])
fi fi
fi fi
WINE_NOTICE_WITH(mingw,[test "x$CROSSTARGET" = "x"], WINE_NOTICE_WITH(mingw,[test "x$CROSSTARGET" = "x"],
......
...@@ -132,6 +132,7 @@ static struct strarray dll_flags; ...@@ -132,6 +132,7 @@ static struct strarray dll_flags;
static struct strarray target_flags; static struct strarray target_flags;
static struct strarray msvcrt_flags; static struct strarray msvcrt_flags;
static struct strarray extra_cflags; static struct strarray extra_cflags;
static struct strarray extra_cross_cflags;
static struct strarray cpp_flags; static struct strarray cpp_flags;
static struct strarray unwind_flags; static struct strarray unwind_flags;
static struct strarray libs; static struct strarray libs;
...@@ -2958,7 +2959,7 @@ static void output_source_default( struct makefile *make, struct incl_file *sour ...@@ -2958,7 +2959,7 @@ static void output_source_default( struct makefile *make, struct incl_file *sour
output_filenames( make->define_args ); output_filenames( make->define_args );
output_filenames( extradefs ); output_filenames( extradefs );
if (make->use_msvcrt) output_filenames( msvcrt_flags ); if (make->use_msvcrt) output_filenames( msvcrt_flags );
output_filename( "-DWINE_CROSSTEST" ); output_filenames( extra_cross_cflags );
output_filenames( cpp_flags ); output_filenames( cpp_flags );
output_filename( "$(CROSSCFLAGS)" ); output_filename( "$(CROSSCFLAGS)" );
output( "\n" ); output( "\n" );
...@@ -4200,6 +4201,7 @@ int main( int argc, char *argv[] ) ...@@ -4200,6 +4201,7 @@ int main( int argc, char *argv[] )
msvcrt_flags = get_expanded_make_var_array( top_makefile, "MSVCRTFLAGS" ); msvcrt_flags = get_expanded_make_var_array( top_makefile, "MSVCRTFLAGS" );
dll_flags = get_expanded_make_var_array( top_makefile, "DLLFLAGS" ); dll_flags = get_expanded_make_var_array( top_makefile, "DLLFLAGS" );
extra_cflags = get_expanded_make_var_array( top_makefile, "EXTRACFLAGS" ); extra_cflags = get_expanded_make_var_array( top_makefile, "EXTRACFLAGS" );
extra_cross_cflags = get_expanded_make_var_array( top_makefile, "EXTRACROSSCFLAGS" );
cpp_flags = get_expanded_make_var_array( top_makefile, "CPPFLAGS" ); cpp_flags = get_expanded_make_var_array( top_makefile, "CPPFLAGS" );
unwind_flags = get_expanded_make_var_array( top_makefile, "UNWINDFLAGS" ); unwind_flags = get_expanded_make_var_array( top_makefile, "UNWINDFLAGS" );
libs = get_expanded_make_var_array( top_makefile, "LIBS" ); libs = get_expanded_make_var_array( top_makefile, "LIBS" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment