From 1507d3ec217124e962b3674763db1e19fd844b9c Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Wed, 30 Nov 2022 18:22:37 +0400 Subject: [PATCH] DRY CFLAGS (#85) --- ChangeLog | 4 ++++ configure.ac | 6 +++--- shared.am | 7 ------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ea852b..ed4c066 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2022-11-30 Alex Kotov + + * configure.ac: Fix CFLAGS setting + 2022-11-29 Alex Kotov * include/kernaux/macro.h: Rename macro "KERNAUX_PACKING_ATTR" to diff --git a/configure.ac b/configure.ac index 76b4d4c..c8dad83 100644 --- a/configure.ac +++ b/configure.ac @@ -305,9 +305,9 @@ AS_IF([test "$with_units" = no], [AC_SUBST([comment_line_units], [ # Set build flags # ################### -AC_DEFUN([do_enable_freestanding], [CFLAGS+=' -nostdlib -ffreestanding -fno-pic -fno-stack-protector ']) -AC_DEFUN([do_disable_freestanding], [CFLAGS+=' -fpic ']) -AS_IF([test "$enable_freestanding" = yes], do_enable_freestanding, do_disable_freestanding) +AS_IF([test "$enable_freestanding" = yes], + [CFLAGS="$CFLAGS -nostdlib -ffreestanding -fno-pic -fno-stack-protector "], + [CFLAGS="$CFLAGS -fpic "]) diff --git a/shared.am b/shared.am index a64db6d..767a8db 100644 --- a/shared.am +++ b/shared.am @@ -18,10 +18,3 @@ endif if ENABLE_WERROR AM_CFLAGS += -Werror endif - -# TODO: DRY (configure.ac) -if ENABLE_FREESTANDING -AM_CFLAGS += -nostdlib -ffreestanding -fno-pic -fno-stack-protector -else -AM_CFLAGS += -fpic -endif