Francois Gouget : configure: Add an option to enable -Werror.

Alexandre Julliard julliard at winehq.org
Mon Mar 16 16:49:07 CDT 2020


Module: wine
Branch: master
Commit: 85100cfc7a03a0fc32fd98241d9cf462eaae5988
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=85100cfc7a03a0fc32fd98241d9cf462eaae5988

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Sun Mar 15 22:29:21 2020 +0100

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 configure    | 13 +++++++++++--
 configure.ac | 10 +++++++---
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index bb2fccd1fc..76cfea1c07 100755
--- a/configure
+++ b/configure
@@ -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; }
diff --git a/configure.ac b/configure.ac
index 7c3c6d2b67..f722ac5d04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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




More information about the wine-cvs mailing list