I'm seeing an issue with the top level configure code. Looking at it requires juggling m4, guile, shell and make syntax in one's head, I'm having some trouble so I'm seeking some assistance.
I'm running into the actual problem when I'm integrating the mpc library with GCC and testing in-tree building scenarios, but the issue can be seen by examining the current gmp/mpfr in-tree builds as well. So I'll stick to that in my explanation. Imagine the following scenario: 1. You're building gcc. 2. You have gmp installed in a location requiring --with-gmp=foo. 3. You do not have mpfr installed, so you unpack it in your source tree and expect it to be built during bootstrap using the gmp you specified in step 2. Now e.g. you're passing --with-gmp=/opt/cfarm/gmp-4.2.4 to configure. Inside Makefile.def the mpfr in-tree build code also adds --with-gmp-build=PATH_TO_IN_TREE_GMP to your configure (via extra_configure_flags) assuming that if you're building mpfr in-tree that you are also building gmp in-tree. But we are not. So when mpfr is built in-tree you get two different locations for gmp passed to it. Depending on how mpfr's configure argument processing code is written, it might be forgiving and pass two -I/-L flags during the build. Or as is the actual case with mpfr, one might override the other and you hope the one you want gets used. By chance it works today because of the flag processing order in mpfr's configure. However this seems extremely fragile and is a latent bug IMHO. What I would like to see is that the extra_configure_flags for mpfr actually check whether gmp is being built in-tree before passing --with-gmp-build=foo to mpfr's configure. But I don't get how to do that. If the mpfr case could be fixed, I could then copy the mechanism into my patch for adding mpc. Any assistance would be greatly appreciated. Thanks, --Kaveh