diff --git a/configure.ac b/configure.ac index 8b9f1b91c..69d3c6e08 100644 --- a/configure.ac +++ b/configure.ac @@ -13,6 +13,16 @@ AC_CONFIG_SRCDIR([wrap/wrap.cpp]) AC_CANONICAL_HOST # needs to be called at some point earlier AM_CONDITIONAL([DARWIN], [case $host_os in darwin*) true;; *) false;; esac]) +# enable debug variable +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 = xtrue]) + # Checks for programs. AC_PROG_CXX AC_PROG_CC diff --git a/cpp/Makefile.am b/cpp/Makefile.am index a936413f9..0760cb9ce 100644 --- a/cpp/Makefile.am +++ b/cpp/Makefile.am @@ -142,7 +142,6 @@ testVSLAMFactor_LDADD = libgtsam.la # The header files will be installed in ~/include/gtsam headers = gtsam.h Value.h Factor.h LinearFactorSet.h Point2Prior.h Simulated2DOdometry.h Simulated2DMeasurement.h smallExample.h $(sources:.cpp=.h) - # create both dynamic and static libraries AM_CXXFLAGS = -I$(boost) -fPIC lib_LTLIBRARIES = libgtsam.la @@ -150,6 +149,11 @@ libgtsam_la_SOURCES = $(sources) libgtsam_la_CPPFLAGS = $(AM_CXXFLAGS) libgtsam_la_LDFLAGS = -version-info $(version) -L../colamd -lcolamd #-lboost_serialization-mt +# enable debug if --enable-debug is set in configure +if DEBUG + AM_CXXFLAGS += -g +endif + # install the header files include_HEADERS = $(headers)