There are two different ways you can provide GCC with prerequisite
external host libraries like GMP and
MPFR:
Before configuring, run ./contrib/download_prerequisites
from the
toplevel GCC source directory. It will download the sources from the
respective project repositories. That's all you have to do; GCC will
configure and build these libraries before running configure for itself
or its target libraries.
configure with --with-gmp
etc. to point to the place where the
respective host library had been installed.
Either approach has its ups and down:
The first approach needs internet connection and build times go up.
However the increase of build time is negligible to the build time
needed for the rest of the compiler and its target libraries.
On the other hand, you will get the right version and build options of
either host lib as preferred by GCC, irrespective of which lib version
might already have been installed on the host. And this configuration
is much more convenient and self-contained when you are cross-compiling
GCC (because it's about host libraries, and you thus have to install
the prerequisite libraries on the host; installing it on build is
pointless). And it's more robust / self-contained if you are
distributing the built compiler: If the intended host does not have GMP
etc installed, then you'll have additional work to do on that host.
The second approach is more complicated because you have to build /
install the prerequisites on the host; correct version, correct
configure flags etc.
On the other hand, you only have to build the prerequisites once for
each host.
When you are configuring / rebuilding the compiler more than once, for
example when you are doing GCC development, then it's a bit faster cycle.
In the first case, the lib versions are independent of the host versions
of the libraries; GCC will actually not care whether the libs are
present on the host because it is using it's own "copy". The libraries
will be linked statically into the executable, hence you won't find them
anywhere (Maybe GCC has the option to do shared in-tree builds for the
libs, I don't know).
I am very much preferring the 1st approach because it is self-contained
and easier, in particular because I am frequently building GCC as
canadian cross, i.e. build ≠ host ≠ target ≠ build.