This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


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

libgcj versus libtool


libgcj can't currently be built before egcs is installed, because
libtool won't pass -B flags to xgcc.  This can't be fixed in the
current libtool for various reasons, so I've come up with the attached
patch to allow libtool-dependent target packages to use an uninstalled
egcs, in the same build tree.

The idea is simple: a wrapper shell-script is created that runs xgcc
with the appropriate -B flags and whatever command-line flags the
script is started with.

There is a minor problem: on platforms that do not support running
scripts directly (i.e., require /bin/sh /path/to/script), this
work-around won't work.  But then, it will only be used to build
libgcj, which doesn't build on so many platforms anyway.

Since we've had a recent effort to allow gcc 2.95 and libgcj to be
built together, I'd like to have this patch installed for gcc 2.95, to
complete this effort.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists
Index: ChangeLog
from  Alexandre Oliva  <oliva@dcc.unicamp.br>
	
	* Makefile.in (LTCC_FOR_TARGET): Wrapper script for CC_FOR_TARGET.
	(BASE_FLAGS_TO_PASS): Pass LTCC_FOR_TARGET down.
	(ltcc-for-target): Create the wrapper script.
	(ALL_TARGET_MODULES): Note that libjava, zlib and boehm-gc use
	libtool, so they need LTCC_FOR_TARGET.  Set CC to LTCC_FOR_TARGET
	for them, and to CC_FOR_TARGET for the others.  Export CC_FOR_TARGET 
	to the wrapper script.
	(CONFIGURE_TARGET_MODULES, CHECK_TARGET_MODULES): Likewise.
	(INSTALL_TARGET_MODULES, CLEAN_TARGET_MODULES): Likewise.
	
Index: Makefile.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/Makefile.in,v
retrieving revision 1.39.4.2
diff -u -r1.39.4.2 Makefile.in
--- Makefile.in	1999/06/22 22:44:42	1.39.4.2
+++ Makefile.in	1999/06/29 14:38:57
@@ -229,6 +229,9 @@
     fi; \
   fi`
 
+# Libtool won't pass -B flags to the xgcc, so let's hide them in a wrapper
+LTCC_FOR_TARGET = $$r/ltcc-for-target
+
 # If CC_FOR_TARGET is not overriden on the command line, then this
 # 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
@@ -387,6 +390,7 @@
 	"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
 	"LIBCXXFLAGS=$(LIBCXXFLAGS)" \
 	"LIBCXXFLAGS_FOR_TARGET=$(LIBCXXFLAGS_FOR_TARGET)" \
+	"LTCC_FOR_TARGET=$(LTCC_FOR_TARGET)" \
 	"M4=$(M4)" \
 	"MAKE=$(MAKE)" \
 	"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
@@ -770,9 +774,9 @@
 	all-target-gperf \
 	all-target-examples \
 	all-target-libstub \
-	all-target-libjava \
-	all-target-zlib \
-	all-target-boehm-gc \
+	all-lt-target-libjava \
+	all-lt-target-zlib \
+	all-lt-target-boehm-gc \
 	all-target-qthreads \
 	all-target-cygmon
 
@@ -793,9 +797,9 @@
 	configure-target-gperf \
 	configure-target-examples \
 	configure-target-libstub \
-	configure-target-libjava \
-	configure-target-zlib \
-	configure-target-boehm-gc \
+	configure-lt-target-libjava \
+	configure-lt-target-zlib \
+	configure-lt-target-boehm-gc \
 	configure-target-qthreads \
 	configure-target-cygmon
 
@@ -811,9 +815,9 @@
 	check-target-libobjc \
 	check-target-winsup \
 	check-target-libiberty \
-	check-target-libjava \
-	check-target-zlib \
-	check-target-boehm-gc \
+	check-lt-target-libjava \
+	check-lt-target-zlib \
+	check-lt-target-boehm-gc \
 	check-target-qthreads \
 	check-target-gperf
 
@@ -831,9 +835,9 @@
 	install-target-libgloss \
 	install-target-libiberty \
 	install-target-bsp \
-	install-target-libjava \
-	install-target-zlib \
-	install-target-boehm-gc \
+	install-lt-target-libjava \
+	install-lt-target-zlib \
+	install-lt-target-boehm-gc \
 	install-target-qthreads \
 	install-target-gperf
 
@@ -920,9 +924,9 @@
 	clean-target-gperf \
 	clean-target-examples \
 	clean-target-libstub \
-	clean-target-libjava \
-	clean-target-zlib \
-	clean-target-boehm-gc \
+	clean-lt-target-libjava \
+	clean-lt-target-zlib \
+	clean-lt-target-boehm-gc \
 	clean-target-qthreads \
 	clean-target-cygmon
 
@@ -1070,13 +1074,19 @@
 
 .PHONY: $(CLEAN_TARGET_MODULES)
 $(CLEAN_TARGET_MODULES):
-	@dir=`echo $@ | sed -e 's/clean-target-//'`; \
+	@dir=`echo $@ | sed -e 's/clean-\(lt-\)*target-//'`; \
 	rm -f $(TARGET_SUBDIR)/$${dir}/multilib.out $(TARGET_SUBDIR)/$${dir}/tmpmulti.out; \
 	if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
 	  r=`pwd`; export r; \
 	  s=`cd $(srcdir); pwd`; export s; \
 	  $(SET_LIB_PATH) \
-	  (cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) clean); \
+	  case "$@" in \
+	  clean-lt-*) CC="$(LTCC_FOR_TARGET)" ;; \
+	  *) CC="$(CC_FOR_TARGET)" ;; \
+	  esac; export CC; \
+	  CC_FOR_TARGET="$(CC_FOR_TARGET)"; export CC_FOR_TARGET; \
+	  (cd $(TARGET_SUBDIR)/$${dir}; \
+	   $(MAKE) $(TARGET_FLAGS_TO_PASS) "CC=$$CC" clean); \
 	else \
 	  true; \
 	fi
@@ -1244,11 +1254,19 @@
 	  true; \
 	fi
 
+ltcc-for-target:
+	rm -f $@
+	echo "#! $${CONFIG_SHELL-/bin/sh}" > $@
+	r=`pwd`; \
+	echo CC_FOR_TARGET='$${CC_FOR_TARGET-"'"$(CC_FOR_TARGET)"'"}' >> $@
+	echo eval exec '$$CC_FOR_TARGET \$${1+"\$$@"}' >> $@
+	chmod +x $@
+
 # This rule is used to configure the modules which are built with the
 # target tools.
 .PHONY: $(CONFIGURE_TARGET_MODULES)
 $(CONFIGURE_TARGET_MODULES):
-	@dir=`echo $@ | sed -e 's/configure-target-//'`; \
+	@dir=`echo $@ | sed -e 's/configure-\(lt-\)*target-//'`; \
 	if [ -d $(TARGET_SUBDIR)/$${dir} ]; then \
 	  r=`pwd`; export r; \
 	  $(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/$${dir}/tmpmulti.out 2> /dev/null; \
@@ -1266,7 +1284,7 @@
 	    fi; \
 	  fi; \
 	fi; exit 0	# break command into two pieces
-	@dir=`echo $@ | sed -e 's/configure-target-//'`; \
+	@dir=`echo $@ | sed -e 's/configure-\(lt-\)*target-//'`; \
 	if [ ! -d $(TARGET_SUBDIR) ]; then \
 	  true; \
 	elif [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
@@ -1279,7 +1297,11 @@
 	    $(SET_LIB_PATH) \
 	    AR="$(AR_FOR_TARGET)"; export AR; \
 	    AS="$(AS_FOR_TARGET)"; export AS; \
-	    CC="$(CC_FOR_TARGET)"; export CC; \
+	    case "$@" in \
+	    configure-lt-*) CC="$(LTCC_FOR_TARGET)" ;; \
+	    *) CC="$(CC_FOR_TARGET)" ;; \
+	    esac; export CC; \
+	    CC_FOR_TARGET="$(CC_FOR_TARGET)"; export CC_FOR_TARGET; \
 	    CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
 	    CXX="$(CXX_FOR_TARGET)"; export CXX; \
 	    CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
@@ -1353,12 +1375,18 @@
 # To build a target all-X means to cd to X and make all.
 .PHONY: $(ALL_TARGET_MODULES)
 $(ALL_TARGET_MODULES):
-	@dir=`echo $@ | sed -e 's/all-target-//'`; \
+	@dir=`echo $@ | sed -e 's/all-\(lt-\)*target-//'`; \
 	if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
 	  r=`pwd`; export r; \
 	  s=`cd $(srcdir); pwd`; export s; \
 	  $(SET_LIB_PATH) \
-	  (cd $(TARGET_SUBDIR)/$${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) all); \
+	  case "$@" in \
+	  all-lt-*) CC="$(LTCC_FOR_TARGET)" ;; \
+	  *) CC="$(CC_FOR_TARGET)" ;; \
+	  esac; export CC; \
+	  CC_FOR_TARGET="$(CC_FOR_TARGET)"; export CC_FOR_TARGET; \
+	  (cd $(TARGET_SUBDIR)/$${dir}; \
+	   $(MAKE) $(TARGET_FLAGS_TO_PASS) "CC=$$CC" all); \
 	else \
 	  true; \
 	fi
@@ -1367,12 +1395,18 @@
 # To build a target install-X means to cd to X and make install.
 .PHONY: $(CHECK_TARGET_MODULES)
 $(CHECK_TARGET_MODULES):
-	@dir=`echo $@ | sed -e 's/check-target-//'`; \
+	@dir=`echo $@ | sed -e 's/check-\(lt-\)*target-//'`; \
 	if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
 	  r=`pwd`; export r; \
 	  s=`cd $(srcdir); pwd`; export s; \
 	  $(SET_LIB_PATH) \
-	  (cd $(TARGET_SUBDIR)/$${dir};$(MAKE) $(TARGET_FLAGS_TO_PASS) check);\
+	  case "$@" in \
+	  check-lt-*) CC="$(LTCC_FOR_TARGET)" ;; \
+	  *) CC="$(CC_FOR_TARGET)" ;; \
+	  esac; export CC; \
+	  CC_FOR_TARGET="$(CC_FOR_TARGET)"; export CC_FOR_TARGET; \
+	  (cd $(TARGET_SUBDIR)/$${dir}; \
+	   $(MAKE) $(TARGET_FLAGS_TO_PASS) "CC=$$CC" check);\
 	else \
 	  true; \
 	fi
@@ -1382,13 +1416,18 @@
 # and make install.
 .PHONY: $(INSTALL_TARGET_MODULES)
 $(INSTALL_TARGET_MODULES): installdirs
-	@dir=`echo $@ | sed -e 's/install-target-//'`; \
+	@dir=`echo $@ | sed -e 's/install-\(lt-\)*target-//'`; \
 	if [ -f $(TARGET_SUBDIR)/$${dir}/Makefile ] ; then \
 	  r=`pwd`; export r; \
 	  s=`cd $(srcdir); pwd`; export s; \
 	  $(SET_LIB_PATH) \
+	  case "$@" in \
+	  install-lt-*) CC="$(LTCC_FOR_TARGET)" ;; \
+	  *) CC="$(CC_FOR_TARGET)" ;; \
+	  esac; export CC; \
+	  CC_FOR_TARGET="$(CC_FOR_TARGET)"; export CC_FOR_TARGET; \
 	  (cd $(TARGET_SUBDIR)/$${dir}; \
-	    $(MAKE) $(TARGET_FLAGS_TO_PASS) install); \
+	    $(MAKE) $(TARGET_FLAGS_TO_PASS) "CC=$$CC" install); \
 	else \
 	  true; \
 	fi
@@ -1561,8 +1600,8 @@
 all-bfd: all-libiberty all-intl
 all-binutils: all-libiberty all-opcodes all-bfd all-flex all-bison all-byacc all-intl
 all-bison: all-texinfo
-configure-target-boehm-gc: configure-target-newlib configure-target-qthreads
-all-target-boehm-gc: configure-target-boehm-gc
+configure-lt-target-boehm-gc: ltcc-for-target configure-target-newlib configure-target-qthreads
+all-lt-target-boehm-gc: configure-lt-target-boehm-gc
 all-byacc:
 all-bzip2:
 all-cvssrc:
@@ -1615,8 +1654,8 @@
 check-target-libio: all-target-libstdc++
 all-libgui: all-tcl all-tk all-itcl
 all-libiberty:
-configure-target-libjava: $(ALL_GCC) configure-target-zlib configure-target-boehm-gc configure-target-qthreads configure-target-newlib
-all-target-libjava: configure-target-libjava all-gcc all-zip all-target-newlib all-target-zlib all-target-boehm-gc all-target-qthreads
+configure-lt-target-libjava: $(ALL_GCC) ltcc-for-target configure-lt-target-zlib configure-lt-target-boehm-gc configure-target-qthreads configure-target-newlib
+all-lt-target-libjava: configure-lt-target-libjava all-gcc all-zip all-target-newlib all-lt-target-zlib all-lt-target-boehm-gc all-target-qthreads
 configure-target-librx: $(ALL_GCC) configure-target-newlib
 all-target-librx: configure-target-librx
 configure-target-libstdc++: $(ALL_GCC)
@@ -1660,8 +1699,8 @@
 configure-target-winsup: configure-target-newlib
 all-uudecode: all-libiberty
 all-zip:
-configure-target-zlib: $(ALL_GCC)
-all-target-zlib: configure-target-zlib
+configure-lt-target-zlib: $(ALL_GCC) ltcc-for-target
+all-lt-target-zlib: configure-lt-target-zlib
 configure-target-libiberty: $(ALL_GCC)
 all-target-libiberty: configure-target-libiberty all-gcc all-ld all-target-newlib
 all-target: $(ALL_TARGET_MODULES)

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