From 334e23e7edb0c6534a247a37e36407d25803892b Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Thu, 2 May 2024 11:00:24 +0100 Subject: [PATCH] configure: Disable default CFLAGS from AC_PROG_CC Also tweak DEBUG_ENABLED handling in Makefile.am: we always pass `-g3` in the basic CFLAGS set from configure.ac, so no point adding it again there. Instead, pass `-O0`, which should be the default but here serves as a kind of documentation. Signed-off-by: Cole Miller --- Makefile.am | 3 ++- configure.ac | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 6e3e5c345..fd8bfa2f6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,5 @@ ACLOCAL_AMFLAGS = -I m4 + AM_CFLAGS += $(CODE_COVERAGE_CFLAGS) AM_CFLAGS += $(SQLITE_CFLAGS) $(UV_CFLAGS) $(PTHREAD_CFLAGS) AM_LDFLAGS = $(UV_LIBS) $(PTHREAD_LIBS) @@ -17,7 +18,7 @@ AM_LDFLAGS += $(RAFT_LIBS) endif if DEBUG_ENABLED -AM_CFLAGS += -g3 +AM_CFLAGS += -O0 else AM_CFLAGS += -O2 endif diff --git a/configure.ac b/configure.ac index 4ef34b5b0..5a85b3cc7 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,8 @@ AC_CONFIG_AUX_DIR([ac]) AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror -Wno-portability foreign]) AM_SILENT_RULES([yes]) +# Without this line, AC_PROG_CC boneheadedly adds `-g -O2` to our CFLAGS. +AC_SUBST(CFLAGS, "") AC_PROG_CC AC_USE_SYSTEM_EXTENSIONS