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]
Other format: [Raw text]

[PATCH]: fix the --with-mpfr-dir=PATH configure flag


The --with-mpfr-dir=PATH configure flag present in the top level configure
exists to allow one to point gcc at a build directory of mpfr and use it
without installing mpfr.  There exists an analogous --with-gmp-dir=PATH as
well.

As noted here:
http://gcc.gnu.org/ml/gcc/2006-11/msg00640.html

--with-mpfr-dir=PATH looks for PATH/libmpfr.a.  This doesn't work for
mpfr-2.2.0 because it uses libtool and places its library in the .libs (or
on DOS the _libs) subdirectory.

Prior versions of mpfr were included in gmp.  I did some archaeology and
found that up until and including gmp-4.1.3, mpfr didn't use libtool, so
this flag worked if you passed in for example:
--with-mpfr-dir=/path/to/gmp-4.1.3/mpfr.  Some time after this, maybe when
mpfr became its own package, is when mpfr started using libtool to create
shared libs as well as static and put things in the subdir.

The effect is that --with-mpfr-dir=PATH is broken on all GCC 4.x series if
you use that flag to build gcc with mpfr-2.2.0. This is a regression,
albeit not because of something changed in GCC, but because of changes to
GMP/MPFR.  Finding mpfr in an installation directory via --with-mpfr=PATH
obviously works okay, or we'd all be hosed and would have noticed. :-)

So we need to search .libs, _libs and "." for libmpfr.a.  The patch below
does this.  The analogous --with-gmp-dir=PATH already checks these places
because I suspect gmp started using libtool earlier.

Tested via configuring with --enable-languages=c,f95 using the flag
--with-mpfr-dir= and pointing it at a build dir of mpfr-2.2.0 as well as
the version of mpfr included with gmp-4.1.3.  I tried this with gcc 4.0.x,
4.1.x, 4.2.x and mainline.  In all cases, it was broken with mpfr-2.2.0
without my patch.  With the patch, mpfr-2.2.0 in its build directory is
usable.  The older mpfr build directory works in all cases both before and
after my patch.

Okay for all active branches?

		Thanks,
		--Kaveh


2006-11-17  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* configure.in (--with-mpfr-dir): Also look in .libs and _libs for
	libmpfr.a.
	* configure: Regenerate.

diff -rup orig/egcc-SVN20061116/configure.in egcc-SVN20061116/configure.in
--- orig/egcc-SVN20061116/configure.in	2006-11-13 20:01:53.000000000 -0500
+++ egcc-SVN20061116/configure.in	2006-11-17 17:01:25.140438242 -0500
@@ -1058,7 +1058,13 @@ AC_ARG_WITH(mpfr-dir, [  --with-mpfr-dir

 if test "x$with_mpfr_dir" != x; then
   gmpinc="-I$with_mpfr_dir"
-  gmplibs="$with_mpfr_dir/libmpfr.a"
+  if test -f "$with_mpfr_dir/.libs/libmpfr.a"; then
+    gmplibs="$with_mpfr_dir/.libs/libmpfr.a"
+  elif test -f "$with_mpfr_dir/_libs/libmpfr.a"; then
+    gmplibs="$with_mpfr_dir/_libs/libmpfr.a"
+  else
+    gmplibs="$with_mpfr_dir/libmpfr.a"
+  fi
 else
   gmplibs="-lmpfr"
 fi


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