]> www.ginac.de Git - cln.git/commitdiff
* m4/cc.m4: Emit a warning if g++ is used and optimization turned off.
authorRichard Kreckel <kreckel@ginac.de>
Fri, 29 Apr 2005 22:10:55 +0000 (22:10 +0000)
committerRichard Kreckel <kreckel@ginac.de>
Fri, 29 Apr 2005 22:10:55 +0000 (22:10 +0000)
ChangeLog
m4/cc.m4

index 51a4f898399409cc4c336244612e4d8613bed665..857fbee9e2957b10db2fdd926949f43b2149eaf5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-29  Richard B. Kreckel  <kreckel@ginac.de>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * m4/cc.m4: Emit a warning if g++ is used and optimization turned off.
+
 2005-04-24  Richard B. Kreckel  <kreckel@ginac.de>
 
        Make GCC compiler flags default to -O
index 0f071e57d08ca457feb780209c522fa1d7af309c..9a8326c5cb692254733cb11c30513771f8623e21 100644 (file)
--- a/m4/cc.m4
+++ b/m4/cc.m4
@@ -18,14 +18,25 @@ fi
 
 
 dnl Wrapper around AC_PROG_CXX setting CXXFLAGS to plain "-O" as opposed to
-dnl "-g -O2" for the GNU compiler (unless CXXFLAGS was set before).
+dnl "-g -O2" for the GNU compiler (unless CXXFLAGS was set before).  Also
+dnl emits a warning if G++ is used and optimization turned off.
 AC_DEFUN([CL_PROG_CXX],
 [cl_test_CXXFLAGS=${CXXFLAGS+set}
 # Make sure this macro does not come after AC_PROG_CXX.
 # Otherwise CXXFLAGS would already be set.
 AC_BEFORE([$0],[AC_PROG_CXX])dnl
 AC_PROG_CXX([$1])
-if test "$cl_test_CXXFLAGS" != set && test "$ac_compiler_gnu" = yes; then
+if test "$ac_compiler_gnu" = yes; then
+  if test "$cl_test_CXXFLAGS" != set; then
+    # User has not set CXXFLAGS.
     CXXFLAGS="-O"
+  else
+    # Warn if optimization has been turned off with GCC.
+    # Optimization is used for module ordering.
+    case $CXXFLAGS in
+      [ *\ -O | -O | -O\ * | *\ -O\ * | -O[!0]* | *\ -O[!0]*) ;; ]
+      *) AC_MSG_WARN([Optimization turned off. I recommend you unset CXXFLAGS.]);;
+    esac
+  fi
 fi
 ])