bug-gnulib
[Top][All Lists]
Advanced

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

ansi-c++-opt: set CXXFLAGS to "-g -O2" by default


From: Bruno Haible
Subject: ansi-c++-opt: set CXXFLAGS to "-g -O2" by default
Date: Sat, 01 Feb 2020 15:51:55 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; )

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  <address@hidden>

        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




reply via email to

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