From 058a736f9e36238c284ca80e7ed5f62434655019 Mon Sep 17 00:00:00 2001 From: Deepak C Shetty Date: Fri, 3 Aug 2012 15:46:22 +0530 Subject: Add support for --enable-debug configure option Currently default build adds -g -O2 to CFLAGS unconditionally and there is no way to control them from configure. This patch adds support for --enable-debug option to the configure cmdline. If yes, then only -g is added. If no, then -g -O2 is added. Build defaults to --enable-debug=no. Also fixes couple of Makefile.am's which had -g hardcoded. v2: Adds -O0 for debug=yes case. v3: Added bugID while submitting patch Change-Id: I7505619be6fc683de463a0bd44ba5500b0bedfe1 BUG: 851092 Signed-off-by: Deepak C Shetty Reviewed-on: http://review.gluster.org/3822 Tested-by: Gluster Build System Tested-by: Deepak Shetty Reviewed-by: Vijay Bellur --- configure.ac | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index cef8634c..988184d3 100644 --- a/configure.ac +++ b/configure.ac @@ -460,6 +460,7 @@ AC_SUBST(GF_DISTRIBUTION) GF_HOST_OS="" GF_LDFLAGS="-rdynamic" +CFLAGS="-g" case $host_os in linux*) @@ -518,6 +519,22 @@ case $host_os in ;; esac +# enable debug section +AC_ARG_ENABLE([debug], + AC_HELP_STRING([--enable-debug], + [Enable debug build options.])) + +DEBUG=no +if test "x$enable_debug" = "xyes"; then + DEBUG=yes + CFLAGS="-O0 $CFLAGS" +else + CFLAGS="-O2 $CFLAGS" + DEBUG=no +fi +AC_SUBST(CFLAGS) +# end enable debug section + BUILD_READLINE=no AC_CHECK_LIB([readline -lcurses],[readline],[RLLIBS="-lreadline -lcurses"]) AC_CHECK_LIB([readline -ltermcap],[readline],[RLLIBS="-lreadline -ltermcap"]) @@ -573,4 +590,5 @@ echo "fusermount : $BUILD_FUSERMOUNT" echo "readline : $BUILD_READLINE" echo "georeplication : $BUILD_SYNCDAEMON" echo "Linux-AIO : $BUILD_LIBAIO" +echo "Enable Debug : $DEBUG" echo -- cgit