Here is a patch to fix PR libfortran/21547: when building with --with-gmp=/foo/bar and a shared libgmp in /foo/bar, the $(RPATH_ENVVAR) variable (usually LD_LIBRARY_PATH) is not set correctly when using the freshly built gfortran to build libgfortran. The same thing happens for the gfortran testsuite, and the fix is also included in this patch.
Basic testing done on i686-linux (built with --languages=c,fortran and a shared libgmp in /foo/bar, and regtested). Extended testing (which takes ages on my computer) in progress. OK for mainline? OK for 4.0? :ADDPATCH build:
Index: Makefile.tpl =================================================================== --- Makefile.tpl (revision 106019) +++ Makefile.tpl (working copy) @@ -157,6 +157,7 @@ OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \ + GMPLIBSDIR="$(HOST_GMPLIBSDIR)"; export GMPLIBSDIR; \ GMPINC="$(HOST_GMPINC)"; export GMPINC; \ @if gcc-bootstrap $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ @@ -216,6 +217,7 @@ # Where to find GMP HOST_GMPLIBS = @gmplibs@ +HOST_GMPLIBSDIR = @gmplibsdir@ HOST_GMPINC = @gmpinc@ # ---------------------------------------------- @@ -615,7 +617,7 @@ # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch @if gcc -HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc: +HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc:$$r/$(HOST_SUBDIR)/prev-gcc:$(HOST_GMPLIBSDIR): @endif gcc [+ FOR host_modules +][+ IF lib_path +] Index: configure.in =================================================================== --- configure.in (revision 106019) +++ configure.in (working copy) @@ -1058,6 +1058,7 @@ # Check for GMP and MPFR gmplibs= gmpinc= +gmplibsdir= have_gmp=yes # Specify a location for mpfr # check for this first so it ends up on the link line before gmp. @@ -1075,6 +1076,7 @@ if test "x$with_mpfr" != x; then gmplibs="-L$with_mpfr/lib $gmplibs" gmpinc="-I$with_mpfr/include" + gmplibsdir="$with_mpfr/lib" fi # Specify a location for gmp @@ -1097,6 +1099,11 @@ if test "x$with_gmp" != x; then gmplibs="-L$with_gmp/lib $gmplibs" gmpinc="-I$with_gmp/include $gmpinc" + if test "x$gmplibsdir" != x; then + gmplibsdir="$gmplibsdir:$with_gmp/lib" + else + gmplibsdir="$with_gmp/lib" + fi fi saved_CFLAGS="$CFLAGS" @@ -1125,6 +1132,7 @@ # Flags needed for both GMP and/or MPFR AC_SUBST(gmplibs) AC_SUBST(gmpinc) +AC_SUBST(gmplibsdir) # By default, C is the only stage 1 language. stage1_languages=c Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 106019) +++ gcc/configure.ac (working copy) @@ -3402,6 +3402,8 @@ AC_ARG_VAR(GMPLIBS,[How to link GMP]) AC_ARG_VAR(GMPINC,[How to find GMP include files]) +AC_ARG_VAR(GMPLIBSDIR,[Where to find the GMP library]) +AC_ARG_VAR(RPATH_ENVVAR,[How the systems locates libraries]) # Configure the subdirectories # AC_CONFIG_SUBDIRS($subdirs) Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 106019) +++ gcc/Makefile.in (working copy) @@ -294,6 +294,8 @@ # How to find GMP GMPLIBS = @GMPLIBS@ GMPINC = @GMPINC@ +GMPLIBSDIR = @GMPLIBSDIR@ +RPATH_ENVVAR = @RPATH_ENVVAR@ CPPLIB = ../libcpp/libcpp.a CPPINC = -I$(srcdir)/../libcpp/include @@ -3906,6 +3908,7 @@ srcdir=`cd ${srcdir}; ${PWD_COMMAND}` ; export srcdir ; \ cd $(TESTSUITEDIR); \ EXPECT=${EXPECT} ; export EXPECT ; \ + $(RPATH_ENVVAR)=`echo "$(GMPLIBSDIR):$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'` ; export $(RPATH_ENVVAR) ; \ if [ -f $${rootme}/../expect/expect ] ; then \ TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWD_COMMAND}` ; \ export TCL_LIBRARY ; fi ; \
libgmp.ChangeLog
Description: Binary data