Conditionally enable mudflap at configure time

This commit is contained in:
Danny Robson 2011-07-12 20:55:01 +10:00
parent 79e0d2de9d
commit 3b15524b7b

View File

@ -28,6 +28,16 @@ AC_ARG_ENABLE([debugging],
esac ], esac ],
[ac_cv_debugging=no]) [ac_cv_debugging=no])
AC_ARG_ENABLE([mudflap],
[AS_HELP_STRING([--enable-mudflap],
[enable mudflap runtime debugging])],
[ case "${enableval}" in
yes) ac_cv_mudflap=yes ;;
no) ac_cv_mudflap=no ;;
*) AC_MSG_ERROR([bad value for --enable-mudflap[yes|no]]) ;;
esac ],
[ac_cv_mudflap=no])
## ##
## Warnings ## Warnings
WARNING_FLAGS="" WARNING_FLAGS=""
@ -102,10 +112,17 @@ AM_CONDITIONAL([HAVE_EXECINFO], [test x$ac_cv_header_execinfo_h = "xyes"])
## Debug features ## Debug features
if test "x$ac_cv_debugging" = "xyes"; then if test "x$ac_cv_debugging" = "xyes"; then
COMMON_CFLAGS="$COMMON_CFLAGS -O0 -D_GLIBCXX_DEBUG" COMMON_CFLAGS="$COMMON_CFLAGS -O0 -D_GLIBCXX_DEBUG"
if test "x$ac_cv_mudflap" = "xyes"; then
AS_CXX_COMPILER_FLAG([-fmudflapth], [
COMMON_CFLAGS="$COMMON_CFLAGS -fmudflapth";
COMMON_LDFLAGS="$COMMON_LDFLAGS -lmudflapth"
])
fi
COMMON_CFLAGS="$COMMON_CFLAGS -D_FORTIFY_SOURCE=2"
else else
AS_CXX_COMPILER_FLAG([-flto], [ac_cv_flto=yes]) AS_CXX_COMPILER_FLAG([-flto], [ac_cv_flto=yes])
if test "x$ac_cv_flto" = "xyes"; then if test "x$ac_cv_flto" = "xyes"; then
COMMON_CFLAGS="$COMMON_CFLAGS -flto" COMMON_CFLAGS="$COMMON_CFLAGS -flto"
COMMON_LDFLAGS="-flto" COMMON_LDFLAGS="-flto"