From 92aee12fbd246461a22925dd054c4d6394c4fdf5 Mon Sep 17 00:00:00 2001 From: Alon Bar-Lev Date: Fri, 31 May 2019 02:30:37 +0300 Subject: [PATCH] build: add --disable-defaultflags Align with tpm2-tss to allow downstream to provide flags. Signed-off-by: Alon Bar-Lev --- configure.ac | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) https://github.com/tpm2-software/tpm2-tss-engine/pull/117 diff --git a/configure.ac b/configure.ac index f3a399c..f59cfaf 100644 --- a/configure.ac +++ b/configure.ac @@ -80,23 +80,31 @@ AS_IF([test "x$enable_tctienvvar" = xyes], [AC_DEFINE([ENABLE_TCTIENVVAR], [1])] AC_CONFIG_FILES([Makefile]) -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