hc
2024-08-19 eb6b9ee90f50f13c5abb885ce483802d6262f2b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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