1 dnl handle various error-related things
3 dnl Thomas Vander Stichele <thomas@apestaart.org>
5 dnl Last modification: 2005-10-16
7 dnl AG_GST_SET_ERROR_CFLAGS([ADD-WERROR])
8 dnl AG_GST_SET_LEVEL_DEFAULT([IS-CVS-VERSION])
11 dnl Sets ERROR_CFLAGS to something the compiler will accept.
12 dnl AC_SUBST them so they are available in Makefile
14 dnl -Wall is added if it is supported
15 dnl -Werror is added if ADD-WERROR is not "no"
17 dnl These flags can be overridden at make time:
18 dnl make ERROR_CFLAGS=
19 AC_DEFUN([AG_GST_SET_ERROR_CFLAGS],
21 AC_REQUIRE([AC_PROG_CC])
22 AC_REQUIRE([AS_COMPILER_FLAG])
25 dnl if we support -Wall, set it unconditionally
26 AS_COMPILER_FLAG(-Wall,
30 dnl if asked for, add -Werror if supported
31 if test "x$1" != "xno"
33 AS_COMPILER_FLAG(-Werror, ERROR_CFLAGS="$ERROR_CFLAGS -Werror")
35 dnl if -Werror isn't suported
36 if test "x$ERROR_CFLAGS" == "x"
38 dnl try -errwarn=%all,no%E_EMPTY_DECLARATION,no%E_STATEMENT_NOT_REACHED (Sun Forte case)
39 dnl For Forte we need disable "empty declaration" warning produced by un-needed semicolon
40 dnl "statement not reached" disabled because there is g_assert_not_reached () in some places
41 AS_COMPILER_FLAG([-errwarn=%all,no%E_EMPTY_DECLARATION,no%E_STATEMENT_NOT_REACHED],
42 [ERROR_CFLAGS="-errwarn=%all,no%E_EMPTY_DECLARATION,no%E_STATEMENT_NOT_REACHED"])
44 dnl if this also isn't suported, try only for -errwarn=%all
45 if test "x$ERROR_CFLAGS" == "x"
47 AS_COMPILER_FLAG(-errwarn=%all,
48 ERROR_CFLAGS="-errwarn=%all")
53 AC_SUBST(ERROR_CFLAGS)
54 AC_MSG_NOTICE([set ERROR_CFLAGS to $ERROR_CFLAGS])
57 dnl Sets the default error level for debugging messages
58 AC_DEFUN([AG_GST_SET_LEVEL_DEFAULT],
60 dnl define correct errorlevel for debugging messages. We want to have
61 dnl GST_ERROR messages printed when running cvs builds
62 if test "x[$1]" = "xyes"; then
63 GST_LEVEL_DEFAULT=GST_LEVEL_ERROR
65 GST_LEVEL_DEFAULT=GST_LEVEL_NONE
67 AC_DEFINE_UNQUOTED(GST_LEVEL_DEFAULT, $GST_LEVEL_DEFAULT,
68 [Default errorlevel to use])
69 dnl AC_SUBST so we can use it for win32/common/config.h
70 AC_SUBST(GST_LEVEL_DEFAULT)