Procházet zdrojové kódy

build: Fix compiler flag detection with non-GCC compilers

We enable -Werror when checking the flags so that on compilers like
clang which just emit a warning on unknown warning options, instead
of erroring out, we get proper detection.

We could just use stuff like -Werror=unknown-warning-option and
-Werror=unused-command-line-argument, but then we would need to detect
if those are available as they might make the compiler error out if
they are no supported. So just using the blanket -Werror, although more
broad, makes the code less complicated.
Guillem Jover před 11 roky
rodič
revize
9540bc984b
2 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 1 0
      debian/changelog
  2. 1 1
      m4/dpkg-compiler.m4

+ 1 - 0
debian/changelog

@@ -7,6 +7,7 @@ dpkg (1.17.14) UNRELEASED; urgency=low
     update the information within.
   * Bump Standards-Version to 3.9.6 (no changes needed).
   * Disable unused run-time type information for dselect.
+  * Fix compiler flag detection with non-GCC compilers in the build system.
 
   [ Raphaël Hertzog ]
   * Explain better in deb-triggers(5) why interest/activate-noawait should be

+ 1 - 1
m4/dpkg-compiler.m4

@@ -21,7 +21,7 @@ AC_DEFUN([DPKG_CHECK_COMPILER_FLAG], [
   ])
   AC_CACHE_CHECK([whether ]dpkg_compiler[ accepts $1], [dpkg_varname_cache], [
     AS_VAR_COPY([dpkg_varname_save], [dpkg_varname])
-    AS_VAR_SET([dpkg_varname], [$1])
+    AS_VAR_SET([dpkg_varname], ["$1 -Werror"])
     AC_COMPILE_IFELSE([
       AC_LANG_SOURCE([[]])
     ], [