emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109779: * configure.ac (CFLAGS): Pre


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109779: * configure.ac (CFLAGS): Prefer -g3 to -g if -g3 works
Date: Sat, 25 Aug 2012 21:37:40 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109779
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2012-08-25 21:37:40 -0700
message:
  * configure.ac (CFLAGS): Prefer -g3 to -g if -g3 works
  
  and if the user has not specified CFLAGS.  -g3 simplifies
  debugging, since it makes macros visible to the debugger.
modified:
  ChangeLog
  configure.ac
=== modified file 'ChangeLog'
--- a/ChangeLog 2012-08-25 10:04:17 +0000
+++ b/ChangeLog 2012-08-26 04:37:40 +0000
@@ -1,3 +1,9 @@
+2012-08-26  Paul Eggert  <address@hidden>
+
+       * configure.ac (CFLAGS): Prefer -g3 to -g if -g3 works
+       and if the user has not specified CFLAGS.  -g3 simplifies
+       debugging, since it makes macros visible to the debugger.
+
 2012-08-25  Juanma Barranquero  <address@hidden>
 
        * lib/makefile.w32-in ($(BLD)/execinfo.$(O)): Update dependencies.

=== modified file 'configure.ac'
--- a/configure.ac      2012-08-20 22:12:35 +0000
+++ b/configure.ac      2012-08-26 04:37:40 +0000
@@ -577,6 +577,34 @@
 # Initialize gnulib right after choosing the compiler.
 gl_EARLY
 
+# It's helpful to have C macros available to GDB, so prefer -g3 to -g
+# if -g3 works and the user does not specify CFLAGS.
+# This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains.
+if test "$ac_test_CFLAGS" != set; then
+  case $CFLAGS in
+    '-g')
+      emacs_g3_CFLAGS='-g3';;
+    '-g -O2')
+      emacs_g3_CFLAGS='-g3 -O2';;
+    *)
+      emacs_g3_CFLAGS='';;
+  esac
+  if test -n "$emacs_g3_CFLAGS"; then
+    emacs_save_CFLAGS=$CFLAGS
+    CFLAGS=$emacs_g3_CFLAGS
+    AC_CACHE_CHECK([whether $CC accepts $emacs_g3_CFLAGS],
+      [emacs_cv_prog_cc_g3],
+      [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+        [emacs_cv_prog_cc_g3=yes],
+         [emacs_cv_prog_cc_g3=no])])
+    if test $emacs_cv_prog_cc_g3 = yes; then
+      CFLAGS=$emacs_g3_CFLAGS
+    else
+      CFLAGS=$emacs_save_CFLAGS
+    fi
+  fi
+fi
+
 AC_ARG_ENABLE([gcc-warnings],
   [AS_HELP_STRING([--enable-gcc-warnings],
                   [turn on lots of GCC warnings. This is intended for


reply via email to

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