guestfs-tools/0006-m4-guestfs-c.m4-Re-add...

43 lines
1.4 KiB
Diff

From dbc179ab026897be96651e7f9ca6026a3ebf540d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 29 Feb 2024 21:20:59 +0000
Subject: [PATCH] m4/guestfs-c.m4: Re-add ./configure --enable-werror
Somewhere during removal of gnulib and splitting guestfs-tools from
libguestfs, this option was lost. Re-add it simply by copying the
configure fragment over from libguestfs.
(cherry picked from commit 42426992a292b45611b00fcff42160854db09922)
---
m4/guestfs-c.m4 | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/m4/guestfs-c.m4 b/m4/guestfs-c.m4
index bc7e3b2aa..67004d0a1 100644
--- a/m4/guestfs-c.m4
+++ b/m4/guestfs-c.m4
@@ -29,6 +29,23 @@ test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
AM_PROG_CC_C_O
+AC_ARG_ENABLE([werror],
+ [AS_HELP_STRING([--enable-werror],
+ [turn on lots of GCC warnings (for developers)])],
+ [case $enableval in
+ yes|no) ;;
+ *) AC_MSG_ERROR([bad value $enableval for werror option]) ;;
+ esac
+ gcc_warnings=$enableval],
+ [gcc_warnings=no]
+)
+WARN_CFLAGS="-Wall"
+AC_SUBST([WARN_CFLAGS])
+if test "x$gcc_warnings" = "xyes"; then
+ WERROR_CFLAGS="-Werror"
+fi
+AC_SUBST([WERROR_CFLAGS])
+
# Provide a global place to set CFLAGS. (Note that setting AM_CFLAGS
# is no use because it doesn't override target_CFLAGS).
#---