diff options
author | Thomas Zimmermann <tdz@users.sourceforge.net> | 2016-08-15 19:46:03 +0200 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2016-10-13 17:20:42 +0100 |
commit | 003e5e68471b7917e39115814290d7847037c090 (patch) | |
tree | 76cbbaa01b5d3dbd182f158e6dfe97c18f8fd9cb /m4 | |
parent | 748689933112e43cad710654849d77864f9471d6 (diff) | |
download | dbus-003e5e68471b7917e39115814290d7847037c090.tar.gz |
Test compiler and linker flags with AX_COMPILER_FLAGS_* macros
The autoconf macros AX_COMPILER_FLAGS_{CFLAGS|CXXFLAGS|LDFLAGS} test
for compiler and linker support of various flags, and add the flags to
the generated output.
If the command-line option '--enable-compile-warnings' is specified to
'configure', a number of additional warning options is also added to the
output. This is the default.
The AX_COMPILER_FLAGS_* macros add stricter warnings then before. The
patch disables some of them to make dbus build without errors. A later
patch set should fix the warnings and remove the compiler flags.
This patch integrates all tests for compiler flags into the call to
AX_COMPILER_FLAGS_CFLAGS. All tests for compiler flags are now done
in a single place. The old macros have been removed.
Signed-off-by: Thomas Zimmermann <tdz@users.sourceforge.net>
[smcv: add missing $ to DISABLE_WARNINGS]
[smcv: drop -Wno-discarded-qualifiers]
[smcv: drop non-C++ option -Wpointer-sign in C++ mode]
[smcv: work around an AX_COMPILER_FLAGS_CFLAGS bug]
[smcv: this source tree is called dbus, not DBus]
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97357
Diffstat (limited to 'm4')
-rw-r--r-- | m4/tp-compiler-flag.m4 | 43 | ||||
-rw-r--r-- | m4/tp-compiler-warnings.m4 | 49 |
2 files changed, 0 insertions, 92 deletions
diff --git a/m4/tp-compiler-flag.m4 b/m4/tp-compiler-flag.m4 deleted file mode 100644 index 06deaba0..00000000 --- a/m4/tp-compiler-flag.m4 +++ /dev/null @@ -1,43 +0,0 @@ -dnl A version of AS_COMPILER_FLAG that supports both C and C++. -dnl Based on: - -dnl as-compiler-flag.m4 0.1.0 -dnl autostars m4 macro for detection of compiler flags -dnl David Schleef <ds@schleef.org> -dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $ - -dnl TP_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) -dnl Tries to compile with the given CFLAGS and CXXFLAGS. -dnl -dnl Runs ACTION-IF-ACCEPTED if the compiler for the currently selected -dnl AC_LANG can compile with the flags, and ACTION-IF-NOT-ACCEPTED otherwise. - -AC_DEFUN([TP_COMPILER_FLAG], -[ - AC_MSG_CHECKING([to see if compiler understands $1]) - - save_CFLAGS="$CFLAGS" - save_CXXFLAGS="$CXXFLAGS" - CFLAGS="$CFLAGS $1" - CXXFLAGS="$CXXFLAGS $1" - - AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) - CFLAGS="$save_CFLAGS" - CXXFLAGS="$save_CXXFLAGS" - - if test "X$flag_ok" = Xyes ; then - $2 - true - else - $3 - true - fi - AC_MSG_RESULT([$flag_ok]) -]) - -dnl TP_ADD_COMPILER_FLAG(VARIABLE, CFLAGS) -dnl Append CFLAGS to VARIABLE if the compiler supports them. -AC_DEFUN([TP_ADD_COMPILER_FLAG], -[ - TP_COMPILER_FLAG([$2], [$1="[$]$1 $2"]) -]) diff --git a/m4/tp-compiler-warnings.m4 b/m4/tp-compiler-warnings.m4 deleted file mode 100644 index ee4af310..00000000 --- a/m4/tp-compiler-warnings.m4 +++ /dev/null @@ -1,49 +0,0 @@ -dnl TP_COMPILER_WARNINGS(VARIABLE, WERROR_BY_DEFAULT, DESIRABLE, UNDESIRABLE) -dnl $1 (VARIABLE): the variable to put flags into -dnl $2 (WERROR_BY_DEFAULT): a command returning true if -Werror should be the -dnl default -dnl $3 (DESIRABLE): warning flags we want (e.g. all extra shadow) -dnl $4 (UNDESIRABLE): warning flags we don't want (e.g. -dnl missing-field-initializers unused-parameter) -AC_DEFUN([TP_COMPILER_WARNINGS], -[ - AC_REQUIRE([AC_ARG_ENABLE])dnl - AC_REQUIRE([AC_HELP_STRING])dnl - AC_REQUIRE([TP_COMPILER_FLAG])dnl - - tp_warnings="" - for tp_flag in $3; do - TP_COMPILER_FLAG([-W$tp_flag], [tp_warnings="$tp_warnings -W$tp_flag"]) - done - - tp_error_flags="-Werror" - TP_COMPILER_FLAG([-Werror], [tp_werror=yes], [tp_werror=no]) - - for tp_flag in $4; do - TP_COMPILER_FLAG([-Wno-$tp_flag], - [tp_warnings="$tp_warnings -Wno-$tp_flag"]) -dnl Yes, we do need to use both -Wno-foo and -Wno-error=foo. Simon says: -dnl some warnings we explicitly don't want, like unused-parameter, but -dnl they're in -Wall. when a distro using cdbs compiles us, we have: -dnl -Werror -Wno-unused-parameter -Wall -dnl ^ from us ^ from cdbs -dnl which turns -Wunused-parameter back on, in effect - TP_COMPILER_FLAG([-Wno-error=$tp_flag], - [tp_error_flags="$tp_error_flags -Wno-error=$tp_flag"], [tp_werror=no]) - done - - AC_ARG_ENABLE([Werror], - AC_HELP_STRING([--disable-Werror], - [compile without -Werror (normally enabled in development builds)]), - tp_werror=$enableval, :) - - if test "x$tp_werror" = xyes && $2; then -dnl We put -Wno-error=foo before -Wno-foo because clang interprets -Wall -dnl -Werror -Wno-foo -Wno-error=foo as “make foo a non-fatal warning”, but does -dnl what we want if you reverse them. - $1="$tp_error_flags $tp_warnings" - else - $1="$tp_warnings" - fi - -]) |