This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

toplevel: make yet more autoconf-friendly


This patch is being submitted for gcc 3.4 stage 1, under the assumption that
gcc 3.3 will branch sometime soon.  Since my only expertise is in the
build system, there's little I can do to help 3.3; however, after this patch,
I'm going to do what little I can. :-/

This is the next step in the toplevel autoconfiscation process, and one of
the ugliest.  It looks rather odd by itself.  Believe it or not, this is the 
most incremental and least invasive way to go.

This alters a number of variables in the Makefile to be substituted in an
autoconf-like manner when build=host.  They are already substituted when
build!=host, albeit not in an autoconf-like manner.

The goal is to have them substituted the same way all the time, but there are 
some separate issues regarding that, specifically relating to Makefile 
fragments, which deserve their own patches and their own testing.  Since they
will *change behavior* on individual hosts and targets I want to take them
one at a time; this is the 'machine-indpendent' part, so to speak.

This is diffed to apply after my three outstanding top level patches.

The patch to Makefile.in is effectively identical to the patch to 
Makefile.tpl.

Tested by a full bootstrap on i686-pc-linux-gnu (except ada).  There was a
bootstrap failure building libjava, which is definitely unrelated.  (It
complained about missing classes in java.nio, which was missing in my tree.)

	* Makefile.tpl: Make more autoconf-friendly.
	* Makefile.in: Regenerate.
	* configure: Substitute some variables formerly hard-coded in the 
	Makefile for build=host.

--- Makefile.tpl.autox	2002-10-10 13:25:33.000000000 -0400
+++ Makefile.tpl	2002-10-10 14:05:14.000000000 -0400
@@ -85,16 +85,16 @@
 
 INSTALL_DOSREL = install-dosrel-fake
 
-AS = as
-AR = ar
+AS = @AS@
+AR = @AR@
 AR_FLAGS = rc
 CC = cc
 
 # Special variables passed down in EXTRA_GCC_FLAGS.  They are defined
 # here so that they can be overridden by Makefile fragments.
 HOST_CC = $(CC_FOR_BUILD)
-BUILD_PREFIX = 
-BUILD_PREFIX_1 = loser-
+BUILD_PREFIX = @BUILD_PREFIX@
+BUILD_PREFIX_1 = @BUILD_PREFIX_1@
 
 # These flag values are normally overridden by the configure script.
 CFLAGS = -g
@@ -120,25 +120,27 @@
 CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 
-DLLTOOL = dlltool
-WINDRES = windres
+DLLTOOL = @DLLTOOL@
+WINDRES = @WINDRES@
 
-NM = nm
+NM = @NM@
 
-LD = ld
+LD = @LD@
 
 # These values are substituted by configure.
 DEFAULT_YACC = @DEFAULT_YACC@
 DEFAULT_LEX = @DEFAULT_LEX@
 DEFAULT_M4 = @DEFAULT_M4@
 
-BISON = `if [ -f $$r/bison/bison ] ; then \
+BISON=@BISON@
+USUAL_BISON = `if [ -f $$r/bison/bison ] ; then \
 	    echo $$r/bison/bison -L $$s/bison/ ; \
 	 else \
 	    echo bison ; \
 	 fi`
 
-YACC = `if [ -f $$r/bison/bison ] ; then \
+YACC=@YACC@
+USUAL_YACC = `if [ -f $$r/bison/bison ] ; then \
 	    echo $$r/bison/bison -y -L $$s/bison/ ; \
 	elif [ -f $$r/byacc/byacc ] ; then \
 	    echo $$r/byacc/byacc ; \
@@ -146,7 +148,8 @@
 	    echo ${DEFAULT_YACC} ; \
 	fi`
 
-LEX = `if [ -f $$r/flex/flex ] ; \
+LEX=@LEX@
+USUAL_LEX = `if [ -f $$r/flex/flex ] ; \
 	then echo $$r/flex/flex ; \
 	else echo ${DEFAULT_LEX} ; fi`
 
@@ -156,7 +159,8 @@
 
 # For an installed makeinfo, we require it to be from texinfo 4 or
 # higher, else we use the "missing" dummy.
-MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \
+MAKEINFO=@MAKEINFO@
+USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \
 	then echo $$r/texinfo/makeinfo/makeinfo ; \
 	else if (makeinfo --version \
 	  | egrep 'texinfo[^0-9]*([1-3][0-9]|[4-9])') >/dev/null 2>&1; \
@@ -178,7 +182,7 @@
 
 # compilers to use to create programs which must be run in the build
 # environment.
-CC_FOR_BUILD = $(CC)
+CC_FOR_BUILD = @CC_FOR_BUILD@
 CXX_FOR_BUILD = $(CXX)
 
 SUBDIRS = @configdirs@
@@ -250,9 +254,11 @@
 # variable is passed down to the gcc Makefile, where it is used to
 # build libgcc2.a.  We define it here so that it can itself be
 # overridden on the command line.
-GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET)
+GCC_FOR_TARGET=@GCC_FOR_TARGET@
+USUAL_GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET)
 
-AS_FOR_TARGET = ` \
+AS_FOR_TARGET=@AS_FOR_TARGET@
+USUAL_AS_FOR_TARGET = ` \
   if [ -f $$r/gas/as-new ] ; then \
     echo $$r/gas/as-new ; \
   elif [ -f $$r/gcc/xgcc ]; then \
@@ -265,7 +271,8 @@
     fi; \
   fi`
 
-LD_FOR_TARGET = ` \
+LD_FOR_TARGET=@LD_FOR_TARGET@
+USUAL_LD_FOR_TARGET = ` \
   if [ -f $$r/ld/ld-new ] ; then \
     echo $$r/ld/ld-new ; \
   elif [ -f $$r/gcc/xgcc ]; then \
@@ -278,7 +285,8 @@
     fi; \
   fi`
 
-DLLTOOL_FOR_TARGET = ` \
+DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
+USUAL_DLLTOOL_FOR_TARGET = ` \
   if [ -f $$r/binutils/dlltool ] ; then \
     echo $$r/binutils/dlltool ; \
   else \
@@ -289,7 +297,8 @@
     fi; \
   fi`
 
-WINDRES_FOR_TARGET = ` \
+WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
+USUAL_WINDRES_FOR_TARGET = ` \
   if [ -f $$r/binutils/windres ] ; then \
     echo $$r/binutils/windres ; \
   else \
@@ -300,7 +309,8 @@
     fi; \
   fi`
 
-AR_FOR_TARGET = ` \
+AR_FOR_TARGET=@AR_FOR_TARGET@
+USUAL_AR_FOR_TARGET = ` \
   if [ -f $$r/binutils/ar ] ; then \
     echo $$r/binutils/ar ; \
   else \
@@ -311,7 +321,8 @@
     fi; \
   fi`
 
-RANLIB_FOR_TARGET = ` \
+RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
+USUAL_RANLIB_FOR_TARGET = ` \
   if [ -f $$r/binutils/ranlib ] ; then \
     echo $$r/binutils/ranlib ; \
   else \
@@ -326,7 +337,8 @@
     fi; \
   fi`
 
-NM_FOR_TARGET = ` \
+NM_FOR_TARGET=@NM_FOR_TARGET@
+USUAL_NM_FOR_TARGET = ` \
   if [ -f $$r/binutils/nm-new ] ; then \
     echo $$r/binutils/nm-new ; \
   elif [ -f $$r/gcc/xgcc ]; then \


--- configure.new	2002-10-04 16:07:09.000000000 -0400
+++ configure	2002-10-10 14:05:40.000000000 -0400
@@ -906,10 +906,10 @@
   test -n "$DEFAULT_LEX" && break
 done
 
+
 if [ "${build}" != "${host}" ]; then
   # If we are doing a Canadian Cross, in which the host and build systems
   # are not the same, we set reasonable default values for the tools.
-
   tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
   tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET GCJ_FOR_TARGET"
   tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET BUILD_PREFIX"
@@ -1016,6 +1016,42 @@
   export OBJCOPY
   export OBJDUMP
 else
+  # Set reasonable default values for some tools even if not Canadian.
+  # Of course, these are different reasonable default values, originally
+  # specified directly in the Makefile.
+  # We don't export, so that autoconf can do its job.
+  # Note that all these settings are above the fragment inclusion point
+  # in Makefile.in, so can still be overridden by fragments.
+  # This is all going to change when we autoconfiscate...
+
+  tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
+  tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET BUILD_PREFIX"
+  tools="${tools} BUILD_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
+  tools="${tools} NM_FOR_TARGET RANLIB_FOR_TARGET"
+  tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
+
+  AR=ar
+  AR_FOR_TARGET='\$(USUAL_AR_FOR_TARGET)'
+  AS=as
+  AS_FOR_TARGET='\$(USUAL_AS_FOR_TARGET)'
+  BISON='$(USUAL_BISON)'
+  CC_FOR_BUILD='\$(CC)'
+  DLLTOOL=dlltool
+  DLLTOOL_FOR_TARGET='\$(USUAL_DLLTOOL_FOR_TARGET)'
+  GCC_FOR_TARGET='\$(USUAL_GCC_FOR_TARGET)'
+  BUILD_PREFIX=
+  BUILD_PREFIX_1=loser-
+  LD=ld
+  LD_FOR_TARGET='\$(USUAL_LD_FOR_TARGET)'
+  MAKEINFO='\$(USUAL_MAKEINFO)'
+  NM=nm
+  NM_FOR_TARGET='\$(USUAL_NM_FOR_TARGET)'
+  RANLIB_FOR_TARGET='\$(USUAL_RANLIB_FOR_TARGET)'
+  WINDRES=windres
+  WINDRES_FOR_TARGET='\$(USUAL_WINDRES_FOR_TARGET)'
+  LEX='\$(USUAL_LEX)'
+  YACC='\$(USUAL_YACC)'
+
   # If CC is still not set, try to get gcc.
   if [ -z "${CC}" ]; then
     IFS="${IFS= 	}"; save_ifs="$IFS"; IFS="${IFS}:"
@@ -1383,6 +1419,18 @@
       mv -f ${Makefile}.tem ${Makefile}
     done
   fi
+  # If this is NOT a Canadian Cross, preset the values of some more
+  # tools.  The above line should get merged into this, but this
+  # substitutes *once* where the above substitutes *globally*; that
+  # needs to be worked out before the merger.  The issue is in Makefile
+  # fragment elements (ick, yuck, ugh).
+  if [ "${build}" = "${host}" ]; then
+    for var in ${tools}; do
+      eval val=\$${var}
+      sed -e "s%@${var}@%${val}%" ${Makefile} > ${Makefile}.tem
+      mv -f ${Makefile}.tem ${Makefile}
+    done
+  fi
 
   # final copy now in ${Makefile}
 


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