bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* ansi-c++-opt: set CXXFLAGS to "-g -O2" by default
@ 2020-02-01 14:51 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2020-02-01 14:51 UTC (permalink / raw)
  To: bug-gnulib

Currently, gl_PROG_ANSI_CXX keeps CXXFLAGS empty by default, whereas
AC_PROG_CXX sets it to "-g -O2" by default (assuming GNU C++).
It makes no sense to build part of a package without optimization and
debugging by default. So, align gl_PROG_ANSI_CXX with AC_PROG_CXX.


2020-02-01  Bruno Haible  <bruno@clisp.org>

	ansi-c++-opt: Set CXXFLAGS to "-g -O2" by default.
	* m4/ansi-c++.m4 (gl_PROG_ANSI_CXX): Determine CXXFLAGS like AC_PROG_CXX
	does.

diff --git a/m4/ansi-c++.m4 b/m4/ansi-c++.m4
index 856109f..f93c324 100644
--- a/m4/ansi-c++.m4
+++ b/m4/ansi-c++.m4
@@ -1,4 +1,4 @@
-# ansi-c++.m4 serial 10
+# ansi-c++.m4 serial 11
 dnl Copyright (C) 2002-2003, 2005, 2010-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -122,6 +122,16 @@ EOF
     dnl /usr/local/share/automake-1.11/am/depend2.am:   The usual way to define 'am__fastdepCXX' is to add 'AC_PROG_CXX'
     dnl /usr/local/share/automake-1.11/am/depend2.am:   to 'configure.ac' and run 'aclocal' and 'autoconf' again.
     _AM_DEPENDENCIES([CXX])
+    dnl Determine a good default for the CXXFLAGS variable.
+    AC_LANG_PUSH([C++])
+    _AC_LANG_COMPILER_GNU
+    if test $ac_compiler_gnu = yes; then
+      GXX=yes
+    else
+      GXX=
+    fi
+    _AC_PROG_CXX_G
+    AC_LANG_POP([C++])
   else
     AM_CONDITIONAL([am__fastdepCXX], [false])
   fi



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-01 14:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-01 14:51 ansi-c++-opt: set CXXFLAGS to "-g -O2" by default Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).