summaryrefslogtreecommitdiff
blob: 232b4f9e8682d4c8e30a3e2cd5014eb6fcba6c2e (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 2652497a15572d2484f57fee8be252d0d5fe4f8c Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Fri, 31 May 2019 01:39:29 +0300
Subject: [PATCH] build: add --disable-defaultflags

Align with tpm2-tss to allow downstream to provide flags.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
 configure.ac | 42 +++++++++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 17 deletions(-)

https://github.com/tpm2-software/tpm2-totp/pull/39

diff --git a/configure.ac b/configure.ac
index baf596b..ac11e1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,23 +47,31 @@ AC_SUBST([LIBEXECDIR])
 
 AC_CONFIG_FILES([Makefile dist/tpm2-totp.pc dist/dracut/module-setup.sh dist/initcpio/install/plymouth-tpm2-totp])
 
-AX_ADD_COMPILER_FLAG([-std=c99])
-AX_ADD_COMPILER_FLAG([-Wall])
-AX_ADD_COMPILER_FLAG([-Wextra])
-AX_ADD_COMPILER_FLAG([-Wformat-security])
-AX_ADD_COMPILER_FLAG([-Werror])
-AX_ADD_COMPILER_FLAG([-fstack-protector-all])
-AX_ADD_COMPILER_FLAG([-fpic])
-AX_ADD_COMPILER_FLAG([-fPIC])
-
-# work around GCC bug #53119
-#   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
-AX_ADD_COMPILER_FLAG([-Wno-missing-braces])
-
-AX_ADD_LINK_FLAG([-Wl,--no-undefined])
-AX_ADD_LINK_FLAG([-Wl,-z,noexecstack])
-AX_ADD_LINK_FLAG([-Wl,-z,now])
-AX_ADD_LINK_FLAG([-Wl,-z,relro])
+AC_ARG_ENABLE([defaultflags],
+              [AS_HELP_STRING([--disable-defaultflags],
+                              [Disable default preprocessor, compiler, and linker flags.])],
+              [enable_defaultflags=$enableval],
+              [enable_defaultflags=yes])
+AS_IF([test "x$enable_defaultflags" = "xyes"],
+      [
+      AX_ADD_COMPILER_FLAG([-std=c99])
+      AX_ADD_COMPILER_FLAG([-Wall])
+      AX_ADD_COMPILER_FLAG([-Wextra])
+      AX_ADD_COMPILER_FLAG([-Wformat-security])
+      AX_ADD_COMPILER_FLAG([-Werror])
+      AX_ADD_COMPILER_FLAG([-fstack-protector-all])
+      AX_ADD_COMPILER_FLAG([-fpic])
+      AX_ADD_COMPILER_FLAG([-fPIC])
+
+      # work around GCC bug #53119
+      #   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
+      AX_ADD_COMPILER_FLAG([-Wno-missing-braces])
+
+      AX_ADD_LINK_FLAG([-Wl,--no-undefined])
+      AX_ADD_LINK_FLAG([-Wl,-z,noexecstack])
+      AX_ADD_LINK_FLAG([-Wl,-z,now])
+      AX_ADD_LINK_FLAG([-Wl,-z,relro])
+      ])
 
 AX_CODE_COVERAGE
 m4_ifdef([_AX_CODE_COVERAGE_RULES],
-- 
2.21.0