From cccd6d9d04e755aa8194ef86d27405021d5a8f4e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 12 Jul 2016 15:32:18 +0300 Subject: Add omit frame pointer flag if debug flag enabled. --- configure.ac | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 0a86ffb58..e88834722 100644 --- a/configure.ac +++ b/configure.ac @@ -789,6 +789,32 @@ AC_DEFUN([AC_CHECK_SANITIZER_FLAG], ] ) +AC_DEFUN([AC_CHECK_FLAG], + [ + AC_MSG_CHECKING([whether $CC supports $1]) + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $1" + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([int foo;])], + [ + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + ], + [ + AC_MSG_RESULT([guessing no]) + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + ] + ) + ] +) + # # sanitize Support test # @@ -1198,10 +1224,12 @@ case $enable_debug in "yes") CFLAGS="$CFLAGS -g" CPPFLAGS="$CPPFLAGS -DDEBUG" + AC_CHECK_FLAG(-fno-omit-frame-pointer) ;; "gdb") CFLAGS="$CFLAGS -ggdb" CPPFLAGS="$CPPFLAGS -DDEBUG" + AC_CHECK_FLAG(-fno-omit-frame-pointer) ;; esac -- cgit v1.2.3-70-g09d2