This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to using -O rather than -O2 when building binutils 2.11?


On Sun, 1 Apr 2001, Alan Modra wrote:

> A fix would seem to involve pulling CFLAGS out of the Makefile frags, but
> this is getting all too clever for my liking.

I succumbed to the lure of "cleverness" :-)

Before committing this, I'd like someone with more knowledge of shell
scripting than I to check it over.  I'm worried that use of
${var:+something} may not be that portable.  Besides, the master file for
top level "configure" is in gcc, isn't it?

	* configure (CC, CXX, CFLAGS, CXXFLAGS): Look for defaults in
	Makefile fragments.

Alan Modra
-- 
Linuxcare

--- configure.orig	Sat Feb 17 18:11:31 2001
+++ configure	Sun Apr  1 15:11:43 2001
@@ -3,7 +3,7 @@
 ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
 
 # Configuration script
-# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000, 2001
 # Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -804,46 +804,57 @@
 
 # If CC and CXX are not set in the environment, and the Makefile
 # exists, try to extract them from it.  This is to handle running
-# ./config.status by hand.
-if [ -z "${CC}" ] && [ -r Makefile ]; then
-  sed -n -e ':loop
+# ./config.status by hand.  Do the same for various Makefile fragments
+# so that they can specify these vars.
+for file in Mafefile ${package_makefile_rules_frag} \
+    ${site:+config/ms-${site}} ${host_makefile_frag} \
+    ${target_makefile_frag} ${package_makefile_frag}
+do
+  if ! test -r $file; then
+    file=${srcdir}/${file}
+    if ! test -r $file; then continue; fi
+  fi
+
+  if [ -z "${CC}" ]; then
+    sed -n -e ':loop
 /\\$/ N
 s/\\\n//g
 t loop
-/^CC[ 	]*=/ s/CC[ 	]*=[ 	]*\(.*\)/\1/p' < Makefile > Makefile.cc
-  CC=`tail -1 Makefile.cc`
-  rm -f Makefile.cc
-fi
+/^CC[ 	]*=/ s/CC[ 	]*=[ 	]*\(.*\)/\1/p' < $file > Makefile.cc
+    CC=`tail -1 Makefile.cc`
+    rm -f Makefile.cc
+  fi
 
-if [ -z "${CFLAGS}" ] && [ -r Makefile ]; then
-  sed -n -e ':loop
+  if [ -z "${CFLAGS}" ]; then
+    sed -n -e ':loop
 /\\$/ N
 s/\\\n//g
 t loop
-/^CFLAGS[ 	]*=/ s/CFLAGS[ 	]*=[ 	]*\(.*\)/\1/p' < Makefile > Makefile.cc
-  CFLAGS=`tail -1 Makefile.cc`
-  rm -f Makefile.cc
-fi
+/^CFLAGS[ 	]*=/ s/CFLAGS[ 	]*=[ 	]*\(.*\)/\1/p' < $file > Makefile.cc
+    CFLAGS=`tail -1 Makefile.cc`
+    rm -f Makefile.cc
+  fi
 
-if [ -z "${CXX}" ] && [ -r Makefile ]; then
-  sed -n -e ':loop
+  if [ -z "${CXX}" ]; then
+    sed -n -e ':loop
 /\\$/ N
 s/\\\n//g
 t loop
-/^CXX[ 	]*=/ s/CXX[ 	]*=[ 	]*\(.*\)/\1/p' < Makefile > Makefile.cc
-  CXX=`tail -1 Makefile.cc`
-  rm -f Makefile.cc
-fi
+/^CXX[ 	]*=/ s/CXX[ 	]*=[ 	]*\(.*\)/\1/p' < $file > Makefile.cc
+    CXX=`tail -1 Makefile.cc`
+    rm -f Makefile.cc
+  fi
 
-if [ -z "${CXXFLAGS}" ] && [ -r Makefile ]; then
-  sed -n -e ':loop
+  if [ -z "${CXXFLAGS}" ]; then
+    sed -n -e ':loop
 /\\$/ N
 s/\\\n//g
 t loop
-/^CXXFLAGS[ 	]*=/ s/CXXFLAGS[ 	]*=[ 	]*\(.*\)/\1/p' < Makefile > Makefile.cc
-  CXXFLAGS=`tail -1 Makefile.cc`
-  rm -f Makefile.cc
-fi
+/^CXXFLAGS[ 	]*=/ s/CXXFLAGS[ 	]*=[ 	]*\(.*\)/\1/p' < $file > Makefile.cc
+    CXXFLAGS=`tail -1 Makefile.cc`
+    rm -f Makefile.cc
+  fi
+done
 
 # Generate a default definition for YACC.  This is used if the makefile can't
 # locate bison or byacc in objdir.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]