summaryrefslogtreecommitdiff
path: root/m4/dpkg-compiler.m4
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2010-10-31 03:27:29 +0100
committerGuillem Jover <guillem@debian.org>2010-11-19 05:21:14 +0100
commitfcd428d0b05f84ee1dbc4910a011d75bf6d02171 (patch)
tree1aced6a044df5a9d86ab625afbaafae9290f5242 /m4/dpkg-compiler.m4
parentd20d82f99479fd50eda013bcb790ca06acb9a25b (diff)
downloaddpkg-fcd428d0b05f84ee1dbc4910a011d75bf6d02171.tar.gz
build: Unify and fix AC_ARG_ENABLE usage
The current code was executing code in the action arguments, instead of just setting boolean flags and processing them afterwards. This poses several problems, it implies jugling code around in case the the default changes, it might also duplicate code, and it might leave the ACTION-IF-NOT-GIVEN argument empty which could turn into an empty “then fi” shell block which is a syntax error on POSIX shell. Leaving the ACTION-IF-GIVEN argument empty is fine as it's always used by autoconf to set $enableval to the specific enable variable, and setting that variable from $enableval is redundant and might be wrong depending on the order they are set, which could empty it. Reported-by: Michael Schmidt <michael.schmidt.dangel@gmail.com>
Diffstat (limited to 'm4/dpkg-compiler.m4')
-rw-r--r--m4/dpkg-compiler.m411
1 files changed, 7 insertions, 4 deletions
diff --git a/m4/dpkg-compiler.m4 b/m4/dpkg-compiler.m4
index e885af4bf..3a3860175 100644
--- a/m4/dpkg-compiler.m4
+++ b/m4/dpkg-compiler.m4
@@ -8,7 +8,7 @@ AC_DEFUN([DPKG_COMPILER_WARNINGS],
[AC_ARG_ENABLE(compiler-warnings,
AS_HELP_STRING([--disable-compiler-warnings],
[Disable additional compiler warnings]),
- [enable_compiler_warnings=$enableval],
+ [],
[enable_compiler_warnings=yes])
WFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers \
@@ -35,9 +35,12 @@ AC_DEFUN([DPKG_COMPILER_OPTIMISATIONS],
[AC_ARG_ENABLE(compiler-optimisations,
AS_HELP_STRING([--disable-compiler-optimisations],
[Disable compiler optimisations]),
-[if test "x$enable_compiler_optimisations" = "xno"; then
- [CFLAGS=$(echo "$CFLAGS" | sed -e "s/ -O[[1-9]]*\b/ -O0/g")]
-fi])dnl
+ [],
+ [enable_compiler_optimisations=yes])
+
+ AS_IF([test "x$enable_compiler_optimisations" = "xno"], [
+ CFLAGS=$(echo "$CFLAGS" | sed -e "s/ -O[[1-9]]*\b/ -O0/g")
+ ])
])
# DPKG_TRY_C99([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])