blob: 80da2f35b4a5e3ebd33d24c76ff1138ce7edd813 [file] [log] [blame]
From 88c78901503d50d0a62d85c96994ca4d67ab61e0 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Fri, 13 Nov 2020 20:50:27 +0100
Subject: [PATCH] Add an option to disable -Werror
Allow the user to disable -Werror to avoid the following build failure
with gcc 4.8:
libtac/lib/magic.c:138:13: error: ignoring return value of 'read', declared with attribute warn_unused_result [-Werror=unused-result]
(void) read(rfd, &seed, sizeof(seed));
^
Fixes:
- http://autobuild.buildroot.org/results/5c17226f12eba104d907693ec37fc101cc6d447f
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Makefile.am | 6 +++++-
configure.ac | 3 +++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 0be3cdb..4a137e9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,7 +8,11 @@
ACLOCAL_AMFLAGS = -I config
AUTOMAKE_OPTIONS = subdir-objects
-AM_CFLAGS = -Wall -Wextra -Werror
+AM_CFLAGS = -Wall -Wextra
+
+if ENABLE_WERROR
+AM_CFLAGS += -Werror
+endif
if TACC
bin_PROGRAMS = tacc
diff --git a/configure.ac b/configure.ac
index d0c5eba..dd8a966 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,6 +100,9 @@ AC_SUBST(pamdir)
AC_ARG_ENABLE(doc, AS_HELP_STRING([--disable-doc], [do not build docs]))
AM_CONDITIONAL(DOC, test "x$enable_doc" != "xno")
+AC_ARG_ENABLE(werror, AS_HELP_STRING([--disable-werror], [do not build with -Werror]))
+AM_CONDITIONAL(ENABLE_WERROR, test "x$enable_werror" != "xno")
+
dnl --------------------------------------------------------------------
dnl Switch for run-time debugging
AC_ARG_ENABLE(runtime-debugging, [AS_HELP_STRING([--enable-runtime-debugging],
--
2.28.0