From d2e09cb2597bf585ea45c0e584326a73e222a438 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 20 Jan 2026 15:42:22 +0000 Subject: [PATCH] Add a --enable-optimizations configure flag. --- Makefile.am | 7 ++++++- configure.ac | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index ff0de9f8..81c9c2fc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,7 +20,12 @@ LDADD = $(LIBOBJS) # Set flags for gcc. if IS_GCC -AM_CFLAGS += -std=gnu99 -O2 +AM_CFLAGS += -std=gnu99 +if IS_OPTIMIZED +AM_CFLAGS += -O2 +else +AM_CFLAGS += -O0 +endif if IS_DEBUG AM_CFLAGS += -g AM_CFLAGS += -Wno-long-long -Wall -W -Wformat=2 diff --git a/configure.ac b/configure.ac index e6d4b548..fa474825 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,15 @@ AC_ARG_ENABLE( ) AM_CONDITIONAL(IS_DEBUG, test "x$enable_debug" = xyes) +# Is this --enable-optimizations? +AC_ARG_ENABLE( + optimizations, + AS_HELP_STRING(--enable-optimizations, enable optimization build flags), + , + enable_optimizations=yes +) +AM_CONDITIONAL(IS_OPTIMIZED, test "x$enable_optimizations" = xyes) + # Is this a static build? AC_ARG_ENABLE( static,