configure: Add an option to enable -Werror.

--maintainer-mode already enables -Werror but it it incompatible with
out-of-tree builds. Calling configure with CFLAGS=-Werror causes it to
misdetect some functions like llrint() due to redefinition warnings. And
setting CFLAGS when invoking make risks losing compiler options like -g
-O2.
So add a --enable-werror configure option to allow cleanly using
-Werror.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Francois Gouget 2020-03-15 22:29:21 +01:00 committed by Alexandre Julliard
parent c38325109b
commit 85100cfc7a
2 changed files with 18 additions and 5 deletions

13
configure vendored
View File

@ -841,6 +841,7 @@ enable_win16
enable_win64
enable_tests
enable_maintainer_mode
enable_werror
with_alsa
with_capi
with_cms
@ -2537,6 +2538,7 @@ Optional Features:
--disable-tests do not build the regression tests
--enable-maintainer-mode
enable maintainer-specific build rules
--enable-werror treat compilation warnings as errors
--disable-largefile omit support for large files
Optional Packages:
@ -3861,6 +3863,11 @@ if test "${enable_maintainer_mode+set}" = set; then :
enableval=$enable_maintainer_mode;
fi
# Check whether --enable-werror was given.
if test "${enable_werror+set}" = set; then :
enableval=$enable_werror;
fi
# Check whether --with-alsa was given.
@ -6790,6 +6797,8 @@ $as_echo "yes ($icotool_version_major.$icotool_version_minor)" >&6; }
with_gettext=yes
with_gettextpo=yes
enable_werror=yes
fi
test "x$with_gettext" != xno || MSGFMT=false
@ -10582,7 +10591,7 @@ if test "x$ac_cv_crosscflags__Wl__delayload_autoconftest_dll" = xyes; then :
fi
if test "x$enable_maintainer_mode" = xyes
if test "x$enable_werror" = "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; }
@ -17691,7 +17700,7 @@ fi ;;
CFLAGS=$saved_CFLAGS
if test "x$enable_maintainer_mode" = "xyes"
if test "x$enable_werror" = "xyes"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Werror" >&5
$as_echo_n "checking whether the compiler supports -Werror... " >&6; }

View File

@ -32,6 +32,7 @@ AC_ARG_ENABLE(win16, AS_HELP_STRING([--disable-win16],[do not include Win16 supp
AC_ARG_ENABLE(win64, AS_HELP_STRING([--enable-win64],[build a Win64 emulator on AMD64 (won't run Win32 binaries)]))
AC_ARG_ENABLE(tests, AS_HELP_STRING([--disable-tests],[do not build the regression tests]))
AC_ARG_ENABLE(maintainer-mode, AS_HELP_STRING([--enable-maintainer-mode],[enable maintainer-specific build rules]))
AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],[treat compilation warnings as errors]))
AC_ARG_WITH(alsa, AS_HELP_STRING([--without-alsa],[do not use the Alsa sound support]))
AC_ARG_WITH(capi, AS_HELP_STRING([--without-capi],[do not use CAPI (ISDN support)]))
@ -373,6 +374,9 @@ else
dnl Maintainer mode requires gettext
with_gettext=yes
with_gettextpo=yes
dnl Maintainer mode wants -Werror
enable_werror=yes
fi
test "x$with_gettext" != xno || MSGFMT=false
@ -1092,7 +1096,7 @@ then
WINE_TRY_CROSSCFLAGS([-Wl,-delayload,autoconftest.dll], [AC_SUBST(DELAYLOADFLAG,["-Wl,-delayload,"])])
if test "x$enable_maintainer_mode" = xyes
if test "x$enable_werror" = "xyes"
then
WINE_TRY_CROSSCFLAGS([-Werror])
fi
@ -2080,8 +2084,8 @@ char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy=
CFLAGS=$saved_CFLAGS
dnl Enable -Werror for maintainer mode
if test "x$enable_maintainer_mode" = "xyes"
dnl Enable -Werror
if test "x$enable_werror" = "xyes"
then
WINE_TRY_CFLAGS([-Werror])
fi