mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-06 16:21:50 +00:00
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
This commit is contained in:
parent
d0c32a15a5
commit
51776b297e
|
@ -1043,7 +1043,7 @@ else
|
||||||
more_logging_default=no
|
more_logging_default=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
NM_COMPILER_WARNINGS(CFLAGS, ${more_warnings_default})
|
NM_COMPILER_WARNINGS(AM_CFLAGS, ${more_warnings_default})
|
||||||
|
|
||||||
NM_COMPILER_FLAG(LIBSYSTEMD_NM_CFLAGS, "-Wno-gnu-variable-sized-type-not-at-end")
|
NM_COMPILER_FLAG(LIBSYSTEMD_NM_CFLAGS, "-Wno-gnu-variable-sized-type-not-at-end")
|
||||||
AC_SUBST(LIBSYSTEMD_NM_CFLAGS)
|
AC_SUBST(LIBSYSTEMD_NM_CFLAGS)
|
||||||
|
@ -1051,7 +1051,7 @@ AC_SUBST(LIBSYSTEMD_NM_CFLAGS)
|
||||||
CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
|
CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
|
||||||
-fno-strict-aliasing \
|
-fno-strict-aliasing \
|
||||||
])
|
])
|
||||||
CFLAGS="$CFLAGS $with_cflags"
|
AM_CFLAGS="$AM_CFLAGS $with_cflags"
|
||||||
|
|
||||||
AC_ARG_ENABLE(more-asserts,
|
AC_ARG_ENABLE(more-asserts,
|
||||||
AS_HELP_STRING([--enable-more-asserts],
|
AS_HELP_STRING([--enable-more-asserts],
|
||||||
|
@ -1248,6 +1248,7 @@ fi
|
||||||
|
|
||||||
AM_CONDITIONAL(BUILD_DOCS, test "$build_docs" = "yes")
|
AM_CONDITIONAL(BUILD_DOCS, test "$build_docs" = "yes")
|
||||||
AM_CONDITIONAL(HAVE_DOCS, test "$build_docs" = "yes" -o "$use_pregen_docs" = "yes")
|
AM_CONDITIONAL(HAVE_DOCS, test "$build_docs" = "yes" -o "$use_pregen_docs" = "yes")
|
||||||
|
AC_SUBST(AM_CFLAGS)
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
|
|
|
@ -31,7 +31,7 @@ AC_DEFUN([NM_COMPILER_FLAG], [
|
||||||
|
|
||||||
dnl Check whether a particular warning is not emitted with code provided,
|
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 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], [
|
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'"])
|
_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 This is enabled in clang by default, makes little sense,
|
||||||
dnl and causes the build to abort with -Werror.
|
dnl and causes the build to abort with -Werror.
|
||||||
CFLAGS_SAVED="$$1"
|
CFLAGS_SAVED="$CFLAGS"
|
||||||
eval "AS_TR_SH([$1])='$$1 -Qunused-arguments'"
|
CFLAGS="$CFLAGS -Qunused-arguments"
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], [], eval "AS_TR_SH([$1])='$CFLAGS_SAVED'")
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], eval "AS_TR_SH([$1])='$$1 -Qunused-arguments'", [])
|
||||||
unset CFLAGS_SAVED
|
CFLAGS="$CFLAGS_SAVED"
|
||||||
|
|
||||||
dnl clang only warns about unknown warnings, unless
|
dnl clang only warns about unknown warnings, unless
|
||||||
dnl called with "-Werror=unknown-warning-option"
|
dnl called with "-Werror=unknown-warning-option"
|
||||||
|
|
Loading…
Reference in a new issue