diff options
author | Deepak C Shetty <deepakcs@linux.vnet.ibm.com> | 2012-08-03 15:46:22 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-08-23 03:08:06 -0700 |
commit | 058a736f9e36238c284ca80e7ed5f62434655019 (patch) | |
tree | 9df41b60cb354a4e3cbe914a563a1b6806ef3cb1 | |
parent | 99a0fcb7a46c996518a93c3975805f53108a4eba (diff) |
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 <deepakcs@linux.vnet.ibm.com>
Reviewed-on: http://review.gluster.org/3822
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: Deepak Shetty <dpkshetty@gmail.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r-- | configure.ac | 18 | ||||
-rw-r--r-- | libglusterfs/src/Makefile.am | 2 | ||||
-rw-r--r-- | rpc/xdr/src/Makefile.am | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index cef8634c04d..988184d3d79 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 diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am index 093f47f37ef..ca83246ba0f 100644 --- a/libglusterfs/src/Makefile.am +++ b/libglusterfs/src/Makefile.am @@ -1,4 +1,4 @@ -libglusterfs_la_CFLAGS = -fPIC -Wall -g -shared -nostartfiles $(GF_CFLAGS) \ +libglusterfs_la_CFLAGS = -fPIC -Wall -shared -nostartfiles $(GF_CFLAGS) \ $(GF_DARWIN_LIBGLUSTERFS_CFLAGS) libglusterfs_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 \ diff --git a/rpc/xdr/src/Makefile.am b/rpc/xdr/src/Makefile.am index 7174815b841..d598cb49508 100644 --- a/rpc/xdr/src/Makefile.am +++ b/rpc/xdr/src/Makefile.am @@ -1,6 +1,6 @@ lib_LTLIBRARIES = libgfxdr.la -libgfxdr_la_CFLAGS = -fPIC -Wall -g -shared -nostartfiles $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS) +libgfxdr_la_CFLAGS = -fPIC -Wall -shared -nostartfiles $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS) libgfxdr_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 \ -D_GNU_SOURCE -D$(GF_HOST_OS) \ |