PING x2: [PATCH take 2]: Integrate GCC with the complex math library MPC (configury)

Kaveh R. GHAZI ghazi@caip.rutgers.edu
Sun Jun 7 18:49:00 GMT 2009


On Mon, 1 Jun 2009, Kaveh R. GHAZI wrote:

> On Mon, 1 Jun 2009, Tobias Burnus wrote:
>
> > Is it on purpose that the configure script does not find MPC if it is
> > installed but none of the -with*mpc* option has been used?
>
> D'oh!  It is not supposed to do that of course, I'll fix it.
>
> I don't have root access on my test box, so I don't have MPC in the
> default /usr installation directory.  That's why I didn't come across
> this myself.  Perhaps you can test my patch when it's ready?

Tobias,

Sorry for the delay, here's the patch.  The reason it took so long is that
I had a hard time getting my brain wrapped around the different scenarios
possible.  We have three options for each library of where to find it:
in-tree, out-tree (using --with-foo=) and in the default directory.
Because MPC is currently optional, that's really a fourth choice.

So there are 3*3*4 or 36 different ways to configure.  Note GCC currently
bypasses testing version numbers of gmp/mpfr if the user specifies in-tree
building and assume "you know what you're doing".  I believe that's
because gmp.h is built when compiling gmp itself so you can't run
configure tests from the top level dir that include gmp.h (via mpfr.h or
mpc.h) to check for the right library version numbers.

Now because MPC is optional and I have to test if it exists by compiling
some MPC code, I can't check if it's there when doing in-tree builds of
gmp and/or mpfr.  So in those cases, this code will play it safe and
assume MPC isn't there.  This problem will go away, and the configure code
will simplify, when MPC is hard-required.  In the mean time, here's what I
have.

Tested by configuring all 8 combinations of in-tree / out-tree of the
three libraries.  In the cases where either GMP or MPFR were in-tree and
MPC was not, MPC was (intentionally) disabled and GCC built with only GMP
and MPFR.  In the other scenarios all three libraries where detected and
used.

I don't have root to install MPC in the default directory.  So Tobias,
would you test this patch and see if it finds MPC in your default
directory?  If so, and if it passes regtest on my box (currently underway)
then I'll install it on mainline as a follow-on bugfix to my last patch.

(While the analysis is convoluted, I think the patch itself qualifies as
obvious once testing verifies all the cases.)

		Thanks,
		--Kaveh


2009-06-07  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* configure.ac: Detect MPC in default directory.

	* configure: Regenerate.

diff -rup orig/egcc-SVN20090607/configure.ac egcc-SVN20090607/configure.ac
--- orig/egcc-SVN20090607/configure.ac	2009-06-03 02:01:13.000000000 +0200
+++ egcc-SVN20090607/configure.ac	2009-06-07 20:11:02.000000000 +0200
@@ -1195,7 +1195,7 @@ ACX_PROG_CMP_IGNORE_INITIAL
 gmplibs="-lmpfr -lgmp"
 gmpinc=
 have_gmp=no
-mpclibs=
+mpclibs=-lmpc
 mpcinc=
 have_mpc=no

@@ -1397,6 +1397,11 @@ They may be located in separate packages
   fi
 fi

+if test x$have_mpc != xyes ; then
+  mpcinc=
+  mpclibs=
+fi
+
 gmpinc="$mpcinc $gmpinc"
 gmplibs="$mpclibs $gmplibs"



More information about the Gcc-patches mailing list