* configure: Set CFLAGS and CXXFLAGS, and substitute them into
authorIan Lance Taylor <ian@airs.com>
Mon, 16 Jun 1997 19:46:12 +0000 (19:46 +0000)
committerIan Lance Taylor <ian@airs.com>
Mon, 16 Jun 1997 19:46:12 +0000 (19:46 +0000)
Makefile.  From Jeff Makey <jeff@cts.com>.
* Makefile.in: Add comment for CFLAGS and CXXFLAGS.

ChangeLog
Makefile.in
configure

index 0b04d1c05aac387803939c1fb1311d967c1f129a..c74d3598bb7fe6c84d36f9f2448e2c79182c28b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 Mon Jun 16 11:11:10 1997  Ian Lance Taylor  <ian@cygnus.com>
 
+       * configure: Set CFLAGS and CXXFLAGS, and substitute them into
+       Makefile.  From Jeff Makey <jeff@cts.com>.
+       * Makefile.in: Add comment for CFLAGS and CXXFLAGS.
+
        * Makefile.in (DISTBISONFILES): Remove.
        (taz): Don't futz with DISTBISONFILES.  Change BISON to use
        $(DEFAULT_YACC).
index 21fdd02d929e50009015fbcdd8bfd9852b655337..f1acf87a73138f86f5a8b9865968950fa7590a47 100644 (file)
@@ -62,9 +62,10 @@ HOST_CC = $(CC_FOR_BUILD)
 HOST_PREFIX = 
 HOST_PREFIX_1 = loser-
 
-# We don't specify -g -O because many compilers don't support -g -O,
-# and/or -O is broken in and of itself.
+# These flag values are normally overridden by the configure script.
 CFLAGS = -g
+CXXFLAGS = -g -O2
+
 LIBCFLAGS = $(CFLAGS)
 CFLAGS_FOR_TARGET = $(CFLAGS)
 LDFLAGS_FOR_TARGET = 
@@ -79,7 +80,6 @@ CHILL_LIB = -lchill
 CXX = c++
 
 # Use -O2 to stress test the compiler.
-CXXFLAGS = -g -O2
 LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
 CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
index 0417c541d886be0ff6030ca38cc8d411432fd4c2..621deda2facf9d1480cecfc6f8609000b965b150 100755 (executable)
--- a/configure
+++ b/configure
@@ -760,7 +760,9 @@ t loop
   AS=${AS-${host_alias}-as}
   AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
   CC=${CC-${host_alias}-gcc}
+  CFLAGS=${CFLAGS-"-g -O2"}
   CXX=${CXX-${host_alias}-c++}
+  CXXFLAGS=${CXXFLAGS-"-g -O2"}
   CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
   CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
   CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
@@ -830,7 +832,16 @@ else
     for dir in $PATH; do
       test -z "$dir" && dir=.
       if test -f $dir/gcc; then
-       CC="gcc -O2"
+       CC="gcc"
+       echo 'void f(){}' > conftest.c
+       if test -z "`${CC} -g -c conftest.c 2>&1`"; then
+         CFLAGS=${CFLAGS-"-g -O2"}
+         CXXFLAGS=${CFLAGS-"-g -O2"}
+       else
+         CFLAGS=${CFLAGS-"-O2"}
+         CXXFLAGS=${CFLAGS-"-O2"}
+       fi
+       rm -f conftest*
        break
       fi
     done
@@ -839,10 +850,14 @@ else
   fi
 
   CXX=${CXX-"c++"}
+  CFLAGS=${CFLAGS-"-g"}
+  CXXFLAGS=${CXXFLAGS-"-g -O2"}
 fi
 
 export CC
 export CXX
+export CFLAGS
+export CXXFLAGS
 
 case "$host" in
        *go32*)
@@ -1121,6 +1136,20 @@ EOF
                        t loop2
                        s%^CXX[         ]*=.*$%CXX = ${CXX}%
                        }" \
+                   -e "/^CFLAGS[       ]*=/{
+                       :loop3
+                       /\\\\$/ N
+                       s/\\\\\\n//g
+                       t loop3
+                       s%^CFLAGS[      ]*=.*$%CFLAGS = ${CFLAGS}%
+                       }" \
+                   -e "/^CXXFLAGS[     ]*=/{
+                       :loop4
+                       /\\\\$/ N
+                       s/\\\\\\n//g
+                       t loop4
+                       s%^CXXFLAGS[    ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
+                       }" \
                    -e "s:^SHELL[        ]*=.*$:SHELL = ${config_shell}:" \
                    -e "s:^GDB_TK[       ]*=.*$:GDB_TK = ${GDB_TK}:" \
                     -e "s|^srcdir[     ]*=.*$|srcdir = ${makesrcdir}|" \