gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master b0766af 1/2: Configure script has a new --enab


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master b0766af 1/2: Configure script has a new --enable-debug option
Date: Tue, 17 Jul 2018 06:24:29 -0400 (EDT)

branch: master
commit b0766af5a9a60619651e7bfa0900809b9968c57d
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Configure script has a new --enable-debug option
    
    With this new option, the configure script will disable optimization and
    enable debugging flags during the build. This is easier to remember (and
    less buggy) than directly setting CFLAGS at configure time.
---
 NEWS              |  3 +++
 configure.ac      | 14 +++++++++++---
 developer-build   |  2 +-
 doc/gnuastro.texi | 14 ++++++++++++--
 4 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/NEWS b/NEWS
index dd12541..d5ab9ba 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
 
 ** New features
 
+  Installation:
+    --enable-debug: enable debugging flags and disable optimization.
+
   Arithmetic:
     - `collapse-sum': collapse/remove a dimension by summing over it.
     - `collapse-mean': collapse/remove a dimension by averaging over it.
diff --git a/configure.ac b/configure.ac
index afdd986..e43df75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,9 +87,17 @@ AC_DEFINE([IN_GNUASTRO_BUILD], [1], [In building, not usage])
 
 
 
-# Add warnings and high optimization flags for all builds.
-CFLAGS="-Wall -O3 $CFLAGS"
-CXXFLAGS="-Wall -O3 $CXXFLAGS"
+# Set the compilation flags.
+AC_ARG_ENABLE(debug,
+              [AS_HELP_STRING([--enable-debug],
+                              [No optimization, build with debug flags.])],
+              [AS_IF([test "x$enable_debug" != xno], [enable_debug=yes])],
+              [enable_debug=no])
+AS_IF([test "x$enable_debug" == "xyes"],
+      [cflags_add="-g -O0"],
+      [cflags_add="-O3"])
+CFLAGS="-Wall $cflags_add $CFLAGS"
+CXXFLAGS="-Wall $cflags_add $CXXFLAGS"
 
 
 
diff --git a/developer-build b/developer-build
index 22b8ae2..e72e2c0 100755
--- a/developer-build
+++ b/developer-build
@@ -398,7 +398,7 @@ cd $build_dir
 # cancelled in debugging.
 if [ ! -f Makefile ]; then
     if [ x$debug = x1 ]; then
-        $srcdir/configure --srcdir=$srcdir CFLAGS="-g -O0" --disable-shared
+        $srcdir/configure --srcdir=$srcdir --enable-debug --disable-shared
     else
         $srcdir/configure --srcdir=$srcdir
     fi
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 98c6f86..29a7821 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -5754,6 +5754,16 @@ program using the GNU build system (through the 
configure script).
 
 @vtable @option
 
address@hidden --enable-debug
+Compile/build Gnuastro with debugging information and no optimization. In
+order to allow more efficient programs when using Gnuastro (after the
+installation), by default Gnuastro is built with a 3rd level (a very high
+level) optimization and no debugging information. But when there are
+crashes or un-expected behavior, debugging flags and disabling optimization
+can greatly help in localizing the problem. This configuration option is
+identical to manually calling the configuration script with
address@hidden"-g -O0"}.
+
 @item --enable-progname
 Only build and install @file{progname} along with any other program that is
 enabled in this fashion. @file{progname} is the name of the executable
@@ -6431,7 +6441,7 @@ as GDB, or Valgrind), disable optimization and also the 
building of shared
 libraries. Similar to running the configure script of below
 
 @example
-$ ./configure CFLAGS="-g -O0" --disable-shared
+$ ./configure --enable-debug --disable-shared
 @end example
 
 Besides all the debugging advantages of building with this option, it will
@@ -29096,7 +29106,7 @@ significantly slow down the compilation (the 
@command{make} command). So
 during development it is recommended to configure Gnuastro as follows:
 
 @example
-$ ./configure --disable-shared CFLAGS="-g -O0"
+$ ./configure --enable-debug --disable-shared
 @end example
 
 @noindent



reply via email to

[Prev in Thread] Current Thread [Next in Thread]