|
Packit |
971217 |
dnl handle various error-related things
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl Thomas Vander Stichele <thomas@apestaart.org>
|
|
Packit |
971217 |
dnl Tim-Philipp Müller <tim centricular net>
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl Last modification: 2008-02-18
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl AG_GST_SET_ERROR_CFLAGS([ADD-WERROR], [MORE_FLAGS])
|
|
Packit |
971217 |
dnl AG_GST_SET_ERROR_CXXFLAGS([ADD-WERROR], [MORE_FLAGS])
|
|
Packit |
971217 |
dnl AG_GST_SET_LEVEL_DEFAULT([IS-GIT-VERSION])
|
|
Packit |
971217 |
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl Sets WARNING_CFLAGS and ERROR_CFLAGS to something the compiler
|
|
Packit |
971217 |
dnl will accept and AC_SUBST them so they are available in Makefile
|
|
Packit |
971217 |
dnl
|
|
Packit |
971217 |
dnl WARNING_CFLAGS will contain flags to make the compiler emit more
|
|
Packit |
971217 |
dnl warnings.
|
|
Packit |
971217 |
dnl ERROR_CFLAGS will contain flags to make those warnings fatal,
|
|
Packit |
971217 |
dnl unless ADD-WERROR is set to "no"
|
|
Packit |
971217 |
dnl
|
|
Packit |
971217 |
dnl If MORE_FLAGS is set, tries to add each of the given flags
|
|
Packit |
971217 |
dnl to WARNING_CFLAGS if the compiler supports them. Each flag is
|
|
Packit |
971217 |
dnl tested separately.
|
|
Packit |
971217 |
dnl
|
|
Packit |
971217 |
dnl These flags can be overridden at make time:
|
|
Packit |
971217 |
dnl make ERROR_CFLAGS=
|
|
Packit |
971217 |
AC_DEFUN([AG_GST_SET_ERROR_CFLAGS],
|
|
Packit |
971217 |
[
|
|
Packit |
971217 |
AC_REQUIRE([AC_PROG_CC])
|
|
Packit |
971217 |
AC_REQUIRE([AS_COMPILER_FLAG])
|
|
Packit |
971217 |
|
|
Packit |
971217 |
WARNING_CFLAGS=""
|
|
Packit |
971217 |
ERROR_CFLAGS=""
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl if we support -Wall, set it unconditionally
|
|
Packit |
971217 |
AS_COMPILER_FLAG(-Wall,
|
|
Packit |
971217 |
WARNING_CFLAGS="$WARNING_CFLAGS -Wall")
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl Warn if declarations after statements are used (C99 extension)
|
|
Packit |
971217 |
AS_COMPILER_FLAG(-Wdeclaration-after-statement,
|
|
Packit |
971217 |
WARNING_CFLAGS="$WARNING_CFLAGS -Wdeclaration-after-statement")
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl Warn if variable length arrays are used (C99 extension)
|
|
Packit |
971217 |
AS_COMPILER_FLAG(-Wvla,
|
|
Packit |
971217 |
WARNING_CFLAGS="$WARNING_CFLAGS -Wvla")
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl Warn for invalid pointer arithmetic
|
|
Packit |
971217 |
AS_COMPILER_FLAG(-Wpointer-arith,
|
|
Packit |
971217 |
WARNING_CFLAGS="$WARNING_CFLAGS -Wpointer-arith")
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl if asked for, add -Werror if supported
|
|
Packit |
971217 |
if test "x$1" != "xno"
|
|
Packit |
971217 |
then
|
|
Packit |
971217 |
AS_COMPILER_FLAG(-Werror, ERROR_CFLAGS="$ERROR_CFLAGS -Werror")
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
|
|
Packit |
971217 |
if test "x$2" != "x"
|
|
Packit |
971217 |
then
|
|
Packit |
971217 |
UNSUPPORTED=""
|
|
Packit |
971217 |
list="$2"
|
|
Packit |
971217 |
for each in $list
|
|
Packit |
971217 |
do
|
|
Packit |
971217 |
AS_COMPILER_FLAG($each,
|
|
Packit |
971217 |
WARNING_CFLAGS="$WARNING_CFLAGS $each",
|
|
Packit |
971217 |
UNSUPPORTED="$UNSUPPORTED $each")
|
|
Packit |
971217 |
done
|
|
Packit |
971217 |
if test "X$UNSUPPORTED" != X ; then
|
|
Packit |
971217 |
AC_MSG_NOTICE([unsupported compiler flags: $UNSUPPORTED])
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
|
|
Packit |
971217 |
AC_SUBST(WARNING_CFLAGS)
|
|
Packit |
971217 |
AC_SUBST(ERROR_CFLAGS)
|
|
Packit |
971217 |
AC_MSG_NOTICE([set WARNING_CFLAGS to $WARNING_CFLAGS])
|
|
Packit |
971217 |
AC_MSG_NOTICE([set ERROR_CFLAGS to $ERROR_CFLAGS])
|
|
Packit |
971217 |
])
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl Sets WARNING_CXXFLAGS and ERROR_CXXFLAGS to something the compiler
|
|
Packit |
971217 |
dnl will accept and AC_SUBST them so they are available in Makefile
|
|
Packit |
971217 |
dnl
|
|
Packit |
971217 |
dnl WARNING_CXXFLAGS will contain flags to make the compiler emit more
|
|
Packit |
971217 |
dnl warnings.
|
|
Packit |
971217 |
dnl ERROR_CXXFLAGS will contain flags to make those warnings fatal,
|
|
Packit |
971217 |
dnl unless ADD-WERROR is set to "no"
|
|
Packit |
971217 |
dnl
|
|
Packit |
971217 |
dnl If MORE_FLAGS is set, tries to add each of the given flags
|
|
Packit |
971217 |
dnl to WARNING_CFLAGS if the compiler supports them. Each flag is
|
|
Packit |
971217 |
dnl tested separately.
|
|
Packit |
971217 |
dnl
|
|
Packit |
971217 |
dnl These flags can be overridden at make time:
|
|
Packit |
971217 |
dnl make ERROR_CXXFLAGS=
|
|
Packit |
971217 |
AC_DEFUN([AG_GST_SET_ERROR_CXXFLAGS],
|
|
Packit |
971217 |
[
|
|
Packit |
971217 |
AC_REQUIRE([AC_PROG_CXX])
|
|
Packit |
971217 |
AC_REQUIRE([AS_CXX_COMPILER_FLAG])
|
|
Packit |
971217 |
|
|
Packit |
971217 |
ERROR_CXXFLAGS=""
|
|
Packit |
971217 |
WARNING_CXXFLAGS=""
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl if we support -Wall, set it unconditionally
|
|
Packit |
971217 |
AS_CXX_COMPILER_FLAG(-Wall, WARNING_CXXFLAGS="$WARNING_CXXFLAGS -Wall")
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl if asked for, add -Werror if supported
|
|
Packit |
971217 |
if test "x$1" != "xno"
|
|
Packit |
971217 |
then
|
|
Packit |
971217 |
AS_CXX_COMPILER_FLAG(-Werror, ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror")
|
|
Packit |
971217 |
|
|
Packit |
971217 |
if test "x$ERROR_CXXFLAGS" != "x"
|
|
Packit |
971217 |
then
|
|
Packit |
971217 |
dnl add exceptions
|
|
Packit |
971217 |
AS_CXX_COMPILER_FLAG([-Wno-non-virtual-dtor], ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Wno-non-virtual-dtor")
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl Add -fno-strict-aliasing for GLib versions before 2.19.8
|
|
Packit |
971217 |
dnl as before G_LOCK and friends caused strict aliasing compiler
|
|
Packit |
971217 |
dnl warnings.
|
|
Packit |
971217 |
PKG_CHECK_EXISTS([glib-2.0 < 2.19.8], [
|
|
Packit |
971217 |
AS_CXX_COMPILER_FLAG([-fno-strict-aliasing],
|
|
Packit |
971217 |
ERROR_CXXFLAGS="$ERROR_CXXFLAGS -fno-strict-aliasing")
|
|
Packit |
971217 |
])
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
|
|
Packit |
971217 |
if test "x$2" != "x"
|
|
Packit |
971217 |
then
|
|
Packit |
971217 |
UNSUPPORTED=""
|
|
Packit |
971217 |
list="$2"
|
|
Packit |
971217 |
for each in $list
|
|
Packit |
971217 |
do
|
|
Packit |
971217 |
AS_CXX_COMPILER_FLAG($each,
|
|
Packit |
971217 |
WARNING_CXXFLAGS="$WARNING_CXXFLAGS $each",
|
|
Packit |
971217 |
UNSUPPORTED="$UNSUPPORTED $each")
|
|
Packit |
971217 |
done
|
|
Packit |
971217 |
if test "X$UNSUPPORTED" != X ; then
|
|
Packit |
971217 |
AC_MSG_NOTICE([unsupported compiler flags: $UNSUPPORTED])
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
|
|
Packit |
971217 |
AC_SUBST(WARNING_CXXFLAGS)
|
|
Packit |
971217 |
AC_SUBST(ERROR_CXXFLAGS)
|
|
Packit |
971217 |
AC_MSG_NOTICE([set WARNING_CXXFLAGS to $WARNING_CXXFLAGS])
|
|
Packit |
971217 |
AC_MSG_NOTICE([set ERROR_CXXFLAGS to $ERROR_CXXFLAGS])
|
|
Packit |
971217 |
])
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl Sets WARNING_OBJCFLAGS and ERROR_OBJCFLAGS to something the compiler
|
|
Packit |
971217 |
dnl will accept and AC_SUBST them so they are available in Makefile
|
|
Packit |
971217 |
dnl
|
|
Packit |
971217 |
dnl WARNING_OBJCFLAGS will contain flags to make the compiler emit more
|
|
Packit |
971217 |
dnl warnings.
|
|
Packit |
971217 |
dnl ERROR_OBJCFLAGS will contain flags to make those warnings fatal,
|
|
Packit |
971217 |
dnl unless ADD-WERROR is set to "no"
|
|
Packit |
971217 |
dnl
|
|
Packit |
971217 |
dnl If MORE_FLAGS is set, tries to add each of the given flags
|
|
Packit |
971217 |
dnl to WARNING_CFLAGS if the compiler supports them. Each flag is
|
|
Packit |
971217 |
dnl tested separately.
|
|
Packit |
971217 |
dnl
|
|
Packit |
971217 |
dnl These flags can be overridden at make time:
|
|
Packit |
971217 |
dnl make ERROR_OBJCFLAGS=
|
|
Packit |
971217 |
AC_DEFUN([AG_GST_SET_ERROR_OBJCFLAGS],
|
|
Packit |
971217 |
[
|
|
Packit |
971217 |
AC_REQUIRE([AC_PROG_OBJC])
|
|
Packit |
971217 |
AC_REQUIRE([AS_OBJC_COMPILER_FLAG])
|
|
Packit |
971217 |
|
|
Packit |
971217 |
ERROR_OBJCFLAGS=""
|
|
Packit |
971217 |
WARNING_OBJCFLAGS=""
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl if we support -Wall, set it unconditionally
|
|
Packit |
971217 |
AS_OBJC_COMPILER_FLAG(-Wall, WARNING_OBJCFLAGS="$WARNING_OBJCFLAGS -Wall")
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl if asked for, add -Werror if supported
|
|
Packit |
971217 |
if test "x$1" != "xno"
|
|
Packit |
971217 |
then
|
|
Packit |
971217 |
AS_OBJC_COMPILER_FLAG(-Werror, ERROR_OBJCFLAGS="$ERROR_OBJCFLAGS -Werror")
|
|
Packit |
971217 |
|
|
Packit |
971217 |
if test "x$ERROR_OBJCFLAGS" != "x"
|
|
Packit |
971217 |
then
|
|
Packit |
971217 |
dnl Add -fno-strict-aliasing for GLib versions before 2.19.8
|
|
Packit |
971217 |
dnl as before G_LOCK and friends caused strict aliasing compiler
|
|
Packit |
971217 |
dnl warnings.
|
|
Packit |
971217 |
PKG_CHECK_EXISTS([glib-2.0 < 2.19.8], [
|
|
Packit |
971217 |
AS_OBJC_COMPILER_FLAG([-fno-strict-aliasing],
|
|
Packit |
971217 |
ERROR_OBJCFLAGS="$ERROR_OBJCFLAGS -fno-strict-aliasing")
|
|
Packit |
971217 |
])
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
|
|
Packit |
971217 |
if test "x$2" != "x"
|
|
Packit |
971217 |
then
|
|
Packit |
971217 |
UNSUPPORTED=""
|
|
Packit |
971217 |
list="$2"
|
|
Packit |
971217 |
for each in $list
|
|
Packit |
971217 |
do
|
|
Packit |
971217 |
AS_OBJC_COMPILER_FLAG($each,
|
|
Packit |
971217 |
WARNING_OBJCFLAGS="$WARNING_OBJCFLAGS $each",
|
|
Packit |
971217 |
UNSUPPORTED="$UNSUPPORTED $each")
|
|
Packit |
971217 |
done
|
|
Packit |
971217 |
if test "X$UNSUPPORTED" != X ; then
|
|
Packit |
971217 |
AC_MSG_NOTICE([unsupported compiler flags: $UNSUPPORTED])
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
|
|
Packit |
971217 |
AC_SUBST(WARNING_OBJCFLAGS)
|
|
Packit |
971217 |
AC_SUBST(ERROR_OBJCFLAGS)
|
|
Packit |
971217 |
AC_MSG_NOTICE([set WARNING_OBJCFLAGS to $WARNING_OBJCFLAGS])
|
|
Packit |
971217 |
AC_MSG_NOTICE([set ERROR_OBJCFLAGS to $ERROR_OBJCFLAGS])
|
|
Packit |
971217 |
])
|
|
Packit |
971217 |
|
|
Packit |
971217 |
dnl Sets the default error level for debugging messages
|
|
Packit |
971217 |
AC_DEFUN([AG_GST_SET_LEVEL_DEFAULT],
|
|
Packit |
971217 |
[
|
|
Packit |
971217 |
dnl define correct errorlevel for debugging messages. We want to have
|
|
Packit |
971217 |
dnl GST_ERROR messages printed when running cvs builds
|
|
Packit |
971217 |
if test "x[$1]" = "xyes"; then
|
|
Packit |
971217 |
GST_LEVEL_DEFAULT=GST_LEVEL_ERROR
|
|
Packit |
971217 |
else
|
|
Packit |
971217 |
GST_LEVEL_DEFAULT=GST_LEVEL_NONE
|
|
Packit |
971217 |
fi
|
|
Packit |
971217 |
AC_DEFINE_UNQUOTED(GST_LEVEL_DEFAULT, $GST_LEVEL_DEFAULT,
|
|
Packit |
971217 |
[Default errorlevel to use])
|
|
Packit |
971217 |
dnl AC_SUBST so we can use it for win32/common/config.h
|
|
Packit |
971217 |
AC_SUBST(GST_LEVEL_DEFAULT)
|
|
Packit |
971217 |
])
|