diff --git a/Makefile.am b/Makefile.am index ef806c1..d7de3ba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,12 +4,6 @@ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src test EXTRA_DIST = autogen.sh -if DEBUG -AM_CFLAGS = -g3 -O0 -D_GNU_SOURCE=1 -Werror -else -AM_CFLAGS = -O2 -D_GNU_SOURCE=1 -Werror -endif - INCLUDE = -I$(abs_top_builddir)/include \ -I$(abs_top_builddir)/include/erasurecode \ -I$(abs_top_builddir)/include/xor_codes @@ -17,7 +11,7 @@ INCLUDE = -I$(abs_top_builddir)/include \ AM_CPPFLAGS = $(CPPFLAGS) $(INCLUDE) AM_CPPFLAGS += -Werror -AM_CFLAGS += -fPIC $(AM_CPPFLAGS) -L/usr/local/lib +AM_CFLAGS = -fPIC $(AM_CPPFLAGS) -L/usr/local/lib include_HEADERS = \ include/erasurecode/alg_sig.h \ diff --git a/configure.ac b/configure.ac index e60052e..c64eeb4 100644 --- a/configure.ac +++ b/configure.ac @@ -49,17 +49,22 @@ AC_CHECK_LIB([gf_complete], [gf_init_easy], AM_CONDITIONAL([GF_COMPLETE_INSTALLED], [false]) ]) - -AC_ARG_ENABLE(debug, -AS_HELP_STRING([--enable-debug], - [enable debugging, default: no]), +AC_ARG_ENABLE([debug], +[ --enable-debug Turn on debugging], [case "${enableval}" in - yes) debug=true ;; - no) debug=false ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; -esac], -[debug=false]) -AM_CONDITIONAL(DEBUG, test x"$debug" = x"true") + yes) debug=true ;; + no) debug=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; +esac],[debug=false]) +if test x$debug = xtrue ; then + DEBUG=1 + CXXFLAGS="" + CFLAGS="-O0 -ggdb -g3 -Werror -D_GNU_SOURCE=1" +else + DEBUG=0 + CXXFLAGS="" + CFLAGS="-O2 -g -Werror -D_GNU_SOURCE=1" +fi dnl Expand the sources and objects needed to build the library AC_SUBST(ac_aux_dir)