configure: Workaround for clang not reporting an error on unknown options.

This commit is contained in:
Alexandre Julliard 2013-05-21 13:56:08 +02:00
parent debd62cf9f
commit 7f810293b7
2 changed files with 161 additions and 88 deletions

203
configure vendored
View File

@ -12353,6 +12353,32 @@ fi
$as_echo "$ac_cv_cflags__fno_strict_aliasing" >&6; } $as_echo "$ac_cv_cflags__fno_strict_aliasing" >&6; }
if test $ac_cv_cflags__fno_strict_aliasing = yes; then : if test $ac_cv_cflags__fno_strict_aliasing = yes; then :
EXTRACFLAGS="$EXTRACFLAGS -fno-strict-aliasing" EXTRACFLAGS="$EXTRACFLAGS -fno-strict-aliasing"
fi
saved_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror=unknown-warning-option" >&5
$as_echo_n "checking whether the compiler supports -Werror=unknown-warning-option... " >&6; }
if ${ac_cv_cflags__Werror_unknown_warning_option+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -Werror=unknown-warning-option"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(int argc, char **argv) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_cflags__Werror_unknown_warning_option=yes
else
ac_cv_cflags__Werror_unknown_warning_option=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Werror_unknown_warning_option" >&5
$as_echo "$ac_cv_cflags__Werror_unknown_warning_option" >&6; }
if test $ac_cv_cflags__Werror_unknown_warning_option = yes; then :
CFLAGS="$CFLAGS -Werror=unknown-warning-option"
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wdeclaration-after-statement" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wdeclaration-after-statement" >&5
$as_echo_n "checking whether the compiler supports -Wdeclaration-after-statement... " >&6; } $as_echo_n "checking whether the compiler supports -Wdeclaration-after-statement... " >&6; }
@ -12530,6 +12556,117 @@ if test $ac_cv_cflags__Wwrite_strings = yes; then :
EXTRACFLAGS="$EXTRACFLAGS -Wwrite-strings" EXTRACFLAGS="$EXTRACFLAGS -Wwrite-strings"
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wpointer-arith" >&5
$as_echo_n "checking whether the compiler supports -Wpointer-arith... " >&6; }
if ${ac_cv_cflags__Wpointer_arith+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -Wpointer-arith"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(int argc, char **argv) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_cflags__Wpointer_arith=yes
else
ac_cv_cflags__Wpointer_arith=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wpointer_arith" >&5
$as_echo "$ac_cv_cflags__Wpointer_arith" >&6; }
if test $ac_cv_cflags__Wpointer_arith = yes; then :
saved_string_h_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Wpointer-arith -Werror"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken string.h that generates warnings with -Wpointer-arith" >&5
$as_echo_n "checking for broken string.h that generates warnings with -Wpointer-arith... " >&6; }
if ${ac_cv_c_string_h_warnings+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string.h>
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_string_h_warnings=no
else
ac_cv_c_string_h_warnings=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_string_h_warnings" >&5
$as_echo "$ac_cv_c_string_h_warnings" >&6; }
test "$ac_cv_c_string_h_warnings" = yes || EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
CFLAGS=$saved_string_h_CFLAGS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wlogical-op" >&5
$as_echo_n "checking whether the compiler supports -Wlogical-op... " >&6; }
if ${ac_cv_cflags__Wlogical_op+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_wine_try_cflags_saved=$CFLAGS
CFLAGS="$CFLAGS -Wlogical-op"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int main(int argc, char **argv) { return 0; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_cflags__Wlogical_op=yes
else
ac_cv_cflags__Wlogical_op=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_wine_try_cflags_saved
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wlogical_op" >&5
$as_echo "$ac_cv_cflags__Wlogical_op" >&6; }
if test $ac_cv_cflags__Wlogical_op = yes; then :
saved_string_h_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Wlogical-op -Werror"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken string.h that generates warnings with -Wlogical-op" >&5
$as_echo_n "checking for broken string.h that generates warnings with -Wlogical-op... " >&6; }
if ${ac_cv_c_logicalop_noisy+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string.h>
char*f(const char *h,char n) {return strchr(h,n);}
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_logicalop_noisy=no
else
ac_cv_c_logicalop_noisy=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_logicalop_noisy" >&5
$as_echo "$ac_cv_c_logicalop_noisy" >&6; }
CFLAGS=$saved_string_h_CFLAGS
test "$ac_cv_c_logicalop_noisy" = yes || EXTRACFLAGS="$EXTRACFLAGS -Wlogical-op"
fi
CFLAGS=$saved_CFLAGS
for ac_flag in $CFLAGS; do for ac_flag in $CFLAGS; do
case $ac_flag in case $ac_flag in
-g) case $host_os in -g) case $host_os in
@ -12668,72 +12805,6 @@ if test $ac_cv_cflags__Wno_format = yes; then :
fi ;; fi ;;
esac esac
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wpointer-arith -Werror"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken string.h that generates warnings with -Wpointer-arith" >&5
$as_echo_n "checking for broken string.h that generates warnings with -Wpointer-arith... " >&6; }
if ${ac_cv_c_string_h_warnings+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string.h>
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_string_h_warnings=no
else
ac_cv_c_string_h_warnings=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_string_h_warnings" >&5
$as_echo "$ac_cv_c_string_h_warnings" >&6; }
CFLAGS="$saved_CFLAGS"
if test "$ac_cv_c_string_h_warnings" = "no"
then
EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
fi
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wlogical-op -Werror"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken string.h that generates warnings with -Wlogical-op" >&5
$as_echo_n "checking for broken string.h that generates warnings with -Wlogical-op... " >&6; }
if ${ac_cv_c_logicalop_noisy+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string.h>
int
main ()
{
char*f(const char *h,char n) {return strchr(h,n);}
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_logicalop_noisy=no
else
ac_cv_c_logicalop_noisy=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_logicalop_noisy" >&5
$as_echo "$ac_cv_c_logicalop_noisy" >&6; }
CFLAGS="$saved_CFLAGS"
if test "$ac_cv_c_logicalop_noisy" = "no"
then
EXTRACFLAGS="$EXTRACFLAGS -Wlogical-op"
fi
if test "x$enable_maintainer_mode" = "xyes" if test "x$enable_maintainer_mode" = "xyes"
then then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror" >&5

View File

@ -1770,6 +1770,9 @@ then
dnl Check for some compiler flags dnl Check for some compiler flags
WINE_TRY_CFLAGS([-fno-builtin],[AC_SUBST(BUILTINFLAG,"-fno-builtin")]) WINE_TRY_CFLAGS([-fno-builtin],[AC_SUBST(BUILTINFLAG,"-fno-builtin")])
WINE_TRY_CFLAGS([-fno-strict-aliasing]) WINE_TRY_CFLAGS([-fno-strict-aliasing])
dnl clang needs to be told to fail on unknown options
saved_CFLAGS=$CFLAGS
WINE_TRY_CFLAGS([-Werror=unknown-warning-option],[CFLAGS="$CFLAGS -Werror=unknown-warning-option"])
WINE_TRY_CFLAGS([-Wdeclaration-after-statement]) WINE_TRY_CFLAGS([-Wdeclaration-after-statement])
WINE_TRY_CFLAGS([-Wempty-body]) WINE_TRY_CFLAGS([-Wempty-body])
WINE_TRY_CFLAGS([-Wignored-qualifiers]) WINE_TRY_CFLAGS([-Wignored-qualifiers])
@ -1778,6 +1781,27 @@ then
WINE_TRY_CFLAGS([-Wunused-but-set-parameter]) WINE_TRY_CFLAGS([-Wunused-but-set-parameter])
WINE_TRY_CFLAGS([-Wwrite-strings]) WINE_TRY_CFLAGS([-Wwrite-strings])
dnl Check for noisy string.h
WINE_TRY_CFLAGS([-Wpointer-arith],
[saved_string_h_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Wpointer-arith -Werror"
AC_CACHE_CHECK([for broken string.h that generates warnings with -Wpointer-arith], ac_cv_c_string_h_warnings,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]])],[ac_cv_c_string_h_warnings=no],[ac_cv_c_string_h_warnings=yes]))
test "$ac_cv_c_string_h_warnings" = yes || EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
CFLAGS=$saved_string_h_CFLAGS])
dnl Check for noisy string.h on logical ops
WINE_TRY_CFLAGS([-Wlogical-op],
[saved_string_h_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Wlogical-op -Werror"
AC_CACHE_CHECK([for broken string.h that generates warnings with -Wlogical-op], ac_cv_c_logicalop_noisy,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>
char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy=no],[ac_cv_c_logicalop_noisy=yes]))
CFLAGS=$saved_string_h_CFLAGS
test "$ac_cv_c_logicalop_noisy" = yes || EXTRACFLAGS="$EXTRACFLAGS -Wlogical-op"])
CFLAGS=$saved_CFLAGS
dnl On Darwin, prefer stabs; everywhere else, default to dwarf-2 debug info dnl On Darwin, prefer stabs; everywhere else, default to dwarf-2 debug info
for ac_flag in $CFLAGS; do for ac_flag in $CFLAGS; do
case $ac_flag in case $ac_flag in
@ -1799,28 +1823,6 @@ then
x86_64-*mingw32*|x86_64-*cygwin*) WINE_TRY_CFLAGS([-Wno-format]) ;; x86_64-*mingw32*|x86_64-*cygwin*) WINE_TRY_CFLAGS([-Wno-format]) ;;
esac esac
dnl Check for noisy string.h
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wpointer-arith -Werror"
AC_CACHE_CHECK([for broken string.h that generates warnings with -Wpointer-arith], ac_cv_c_string_h_warnings,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]], [[]])],[ac_cv_c_string_h_warnings=no],[ac_cv_c_string_h_warnings=yes]))
CFLAGS="$saved_CFLAGS"
if test "$ac_cv_c_string_h_warnings" = "no"
then
EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
fi
dnl Check for noisy string.h on logical ops
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wlogical-op -Werror"
AC_CACHE_CHECK([for broken string.h that generates warnings with -Wlogical-op], ac_cv_c_logicalop_noisy,
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]], [[char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy=no],[ac_cv_c_logicalop_noisy=yes]))
CFLAGS="$saved_CFLAGS"
if test "$ac_cv_c_logicalop_noisy" = "no"
then
EXTRACFLAGS="$EXTRACFLAGS -Wlogical-op"
fi
dnl Enable -Werror for maintainer mode dnl Enable -Werror for maintainer mode
if test "x$enable_maintainer_mode" = "xyes" if test "x$enable_maintainer_mode" = "xyes"
then then