diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2008-02-22 11:22:58 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2008-02-22 11:22:58 +0000 |
commit | bd6ec57040fe3fa93e21ca440dfe494e3ee18555 (patch) | |
tree | 075126c6be9fd6df61838cf96502a2634f6c7bf1 | |
parent | 838bc3091b9faacd2201b2e91c79b29b957f0d2f (diff) |
m4/as-compiler-flag.m4: Add AS_CXX_COMPILER_FLAG
Original commit message from CVS:
* m4/as-compiler-flag.m4:
Add AS_CXX_COMPILER_FLAG
* m4/gst-error.m4:
Add AG_GST_SET_ERROR_CXXFLAGS (Forte bits need testing)
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | m4/as-compiler-flag.m4 | 35 | ||||
-rw-r--r-- | m4/gst-error.m4 | 100 |
3 files changed, 126 insertions, 17 deletions
@@ -1,5 +1,13 @@ 2008-02-22 Tim-Philipp Müller <tim at centricular dot net> + * m4/as-compiler-flag.m4: + Add AS_CXX_COMPILER_FLAG + + * m4/gst-error.m4: + Add AG_GST_SET_ERROR_CXXFLAGS (Forte bits need testing) + +2008-02-22 Tim-Philipp Müller <tim at centricular dot net> + * gtk-doc-plugins.mak: Add 'check-inspected-versions' target; this helps identify files that should have been removed or where the version diff --git a/m4/as-compiler-flag.m4 b/m4/as-compiler-flag.m4 index aba31b1..882a4c7 100644 --- a/m4/as-compiler-flag.m4 +++ b/m4/as-compiler-flag.m4 @@ -3,8 +3,7 @@ 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 2004/06/01 09:33:45 thomasvs Exp $ +dnl Tim-Philipp Müller <tim centricular net> dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) dnl Tries to compile with the given CFLAGS. @@ -31,3 +30,35 @@ AC_DEFUN([AS_COMPILER_FLAG], AC_MSG_RESULT([$flag_ok]) ]) +dnl AS_CXX_COMPILER_FLAG(CPPFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) +dnl Tries to compile with the given CPPFLAGS. +dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, +dnl and ACTION-IF-NOT-ACCEPTED otherwise. + +AC_DEFUN([AS_CXX_COMPILER_FLAG], +[ + AC_REQUIRE([AC_PROG_CXX]) + + AC_MSG_CHECKING([to see if c++ compiler understands $1]) + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $1" + + AC_LANG_PUSH(C++) + + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CPPFLAGS="$save_CPPFLAGS" + + if test "X$flag_ok" = Xyes ; then + $2 + true + else + $3 + true + fi + + AC_LANG_POP(C++) + + AC_MSG_RESULT([$flag_ok]) +]) + diff --git a/m4/gst-error.m4 b/m4/gst-error.m4 index ad0622b..d9d9d82 100644 --- a/m4/gst-error.m4 +++ b/m4/gst-error.m4 @@ -1,10 +1,12 @@ dnl handle various error-related things dnl Thomas Vander Stichele <thomas@apestaart.org> +dnl Tim-Philipp Müller <tim centricular net> -dnl Last modification: 2005-10-16 +dnl Last modification: 2008-02-18 dnl AG_GST_SET_ERROR_CFLAGS([ADD-WERROR]) +dnl AG_GST_SET_ERROR_CXXFLAGS([ADD-WERROR]) dnl AG_GST_SET_LEVEL_DEFAULT([IS-CVS-VERSION]) @@ -32,22 +34,28 @@ AC_DEFUN([AG_GST_SET_ERROR_CFLAGS], then AS_COMPILER_FLAG(-Werror, ERROR_CFLAGS="$ERROR_CFLAGS -Werror") - dnl if -Werror isn't suported + dnl if -Werror isn't suported, try -errwarn=%all (Sun Forte case) if test "x$ERROR_CFLAGS" == "x" then - dnl try -errwarn=%all,no%E_EMPTY_DECLARATION,no%E_STATEMENT_NOT_REACHED,no%E_ARGUEMENT_MISMATCH,no%E_MACRO_REDEFINED (Sun Forte case) - dnl For Forte we need disable "empty declaration" warning produced by un-needed semicolon - dnl "statement not reached" disabled because there is g_assert_not_reached () in some places - dnl "macro redefined" because of gst/gettext.h - AS_COMPILER_FLAG([-errwarn=%all,no%E_EMPTY_DECLARATION,no%E_STATEMENT_NOT_REACHED,no%E_ARGUEMENT_MISMATCH,no%E_MACRO_REDEFINED], - [ERROR_CFLAGS="-errwarn=%all,no%E_EMPTY_DECLARATION,no%E_STATEMENT_NOT_REACHED,no%E_ARGUEMENT_MISMATCH,no%E_MACRO_REDEFINED"]) - - dnl if this also isn't suported, try only for -errwarn=%all - if test "x$ERROR_CFLAGS" == "x" - then - AS_COMPILER_FLAG(-errwarn=%all, - ERROR_CFLAGS="-errwarn=%all") - fi + AS_COMPILER_FLAG([-errwarn=%all], [ + ERROR_CFLAGS="-errwarn=%all" + dnl try -errwarn=%all,no%E_EMPTY_DECLARATION, + dnl no%E_STATEMENT_NOT_REACHED,no%E_ARGUEMENT_MISMATCH, + dnl no%E_MACRO_REDEFINED (Sun Forte case) + dnl For Forte we need disable "empty declaration" warning produced by un-needed semicolon + dnl "statement not reached" disabled because there is g_assert_not_reached () in some places + dnl "macro redefined" because of gst/gettext.h + dnl FIXME: is it really supposed to be 'ARGUEMENT' and not 'ARGUMENT'? + for f in 'no%E_EMPTY_DECLARATION' \ + 'no%E_STATEMENT_NOT_REACHED' \ + 'no%E_ARGUEMENT_MISMATCH' \ + 'no%E_MACRO_REDEFINED' + do + AS_CXX_COMPILER_FLAG([-errwarn=%all,$f], [ + ERROR_CXXFLAGS="$ERROR_CXXFLAGS,$f" + ]) + done + ]) fi fi @@ -55,6 +63,68 @@ AC_DEFUN([AG_GST_SET_ERROR_CFLAGS], AC_MSG_NOTICE([set ERROR_CFLAGS to $ERROR_CFLAGS]) ]) +dnl Sets ERROR_CXXFLAGS to something the compiler will accept. +dnl AC_SUBST them so they are available in Makefile + +dnl -Wall is added if it is supported +dnl -Werror is added if ADD-WERROR is not "no" + +dnl These flags can be overridden at make time: +dnl make ERROR_CXXFLAGS= +AC_DEFUN([AG_GST_SET_ERROR_CXXFLAGS], +[ + AC_REQUIRE([AC_PROG_CXX]) + AC_REQUIRE([AS_CXX_COMPILER_FLAG]) + + + dnl if we support -Wall, set it unconditionally + AS_CXX_COMPILER_FLAG(-Wall, [ + ERROR_CXXFLAGS="-Wall" + ], [ + ERROR_CXXFLAGS="" + ]) + + dnl if asked for, add -Werror if supported + if test "x$1" != "xno" + then + AS_CXX_COMPILER_FLAG([-Werror], [ + ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror" + + dnl add exceptions + for f in '-Wno-non-virtual-dtor' + do + AS_CXX_COMPILER_FLAG([$f], ERROR_CXXFLAGS="$ERROR_CXXFLAGS $f") + done + ], [ + dnl if -Werror isn't suported, try -errwarn=%all + AS_CXX_COMPILER_FLAG([-errwarn=%all], [ + ERROR_CXXFLAGS="-errwarn=%all" + dnl try -errwarn=%all,no%E_EMPTY_DECLARATION, + dnl no%E_STATEMENT_NOT_REACHED,no%E_ARGUEMENT_MISMATCH, + dnl no%E_MACRO_REDEFINED (Sun Forte case) + dnl For Forte we need disable "empty declaration" warning produced by un-needed semicolon + dnl "statement not reached" disabled because there is g_assert_not_reached () in some places + dnl "macro redefined" because of gst/gettext.h + dnl FIXME: is it really supposed to be 'ARGUEMENT' and not 'ARGUMENT'? + dnl FIXME: do any of these work with the c++ compiler? if not, why + dnl do we check at all? + for f in 'no%E_EMPTY_DECLARATION' \ + 'no%E_STATEMENT_NOT_REACHED' \ + 'no%E_ARGUEMENT_MISMATCH' \ + 'no%E_MACRO_REDEFINED' + do + AS_CXX_COMPILER_FLAG([-errwarn=%all,$f], [ + ERROR_CXXFLAGS="$ERROR_CXXFLAGS,$f" + ]) + done + ]) + ]) + fi + + AC_SUBST(ERROR_CXXFLAGS) + AC_MSG_NOTICE([set ERROR_CXXFLAGS to $ERROR_CXXFLAGS]) +]) + dnl Sets the default error level for debugging messages AC_DEFUN([AG_GST_SET_LEVEL_DEFAULT], [ |