summaryrefslogtreecommitdiff
path: root/m4/compiler_options.m4
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2018-09-04 10:25:19 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2018-09-18 15:15:31 +0200
commit51776b297e04dabb24b7b645744da7100f85ff2e (patch)
treeecca0122202eda5aeb122b9482a0aa66a5391cd4 /m4/compiler_options.m4
parentd0c32a15a5ce1220a8079167f3b08b476273afda (diff)
downloadNetworkManager-51776b297e04dabb24b7b645744da7100f85ff2e.tar.gz
build: don't change CFLAGS from configure.ac
If configure.ac automatically adds compiler flags to CFLAGS, it becomes hard to override one of them for a specific target because CFLAGS is added last. It is better to use AM_CFLAGS. See [1]. [1] https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
Diffstat (limited to 'm4/compiler_options.m4')
-rw-r--r--m4/compiler_options.m410
1 files changed, 5 insertions, 5 deletions
diff --git a/m4/compiler_options.m4 b/m4/compiler_options.m4
index 0683e44e38..1f283db692 100644
--- a/m4/compiler_options.m4
+++ b/m4/compiler_options.m4
@@ -31,7 +31,7 @@ AC_DEFUN([NM_COMPILER_FLAG], [
dnl Check whether a particular warning is not emitted with code provided,
dnl append an option to disable the warning to a specified variable if the check fails.
-dnl NM_COMPILER_WARNING([ENV-VAR], [C-SNIPPET], [WARNING]])
+dnl NM_COMPILER_WARNING([ENV-VAR], [WARNING], [C-SNIPPET])
AC_DEFUN([NM_COMPILER_WARNING], [
_NM_COMPILER_FLAG([-W$2], [$3], [eval "AS_TR_SH([$1])='$$1 -W$2'"], [eval "AS_TR_SH([$1])='$$1 -Wno-$2'"])
])
@@ -47,10 +47,10 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
dnl This is enabled in clang by default, makes little sense,
dnl and causes the build to abort with -Werror.
- CFLAGS_SAVED="$$1"
- eval "AS_TR_SH([$1])='$$1 -Qunused-arguments'"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], [], eval "AS_TR_SH([$1])='$CFLAGS_SAVED'")
- unset CFLAGS_SAVED
+ CFLAGS_SAVED="$CFLAGS"
+ CFLAGS="$CFLAGS -Qunused-arguments"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], eval "AS_TR_SH([$1])='$$1 -Qunused-arguments'", [])
+ CFLAGS="$CFLAGS_SAVED"
dnl clang only warns about unknown warnings, unless
dnl called with "-Werror=unknown-warning-option"