Use of the __GMP_CC and __GMP_CFLAGS macros

Gabriel Dos Reis gdr at
Tue Sep 25 04:33:28 CEST 2012

On Mon, Sep 24, 2012 at 9:57 AM, Vincent Lefevre <vincent at> wrote:
> The __GMP_CC and __GMP_CFLAGS macros were introduced in gmp.h so that
> the GMP user (in particular, MPFR) doesn't have to guess which ABI GMP
> chose (and how to use it) when it was built and installed, in case GMP
> didn't select the default ABI. You can read the full discussion here:
> The problem is that distributions (like Debian) could have built GMP
> under a particular environment and provide packages with a gmp.h using
> __GMP_CC and __GMP_CFLAGS values from this environment, which may not
> match what is expected on the end user machine. The differences could
> be, e.g.:
>   * a compiler that isn't necessarily installed or have a unusual name
>     (for instance, Debian uses x86_64-linux-gnu-gcc);
>   * suboptimal compiler options (for instance, Debian uses -O3 without
>     architecture information, which may generate code slower than with
>     -O2, at least this happened in the past).
> Unfortunately, the Debian maintainer doesn't want to change that
> (like removing these macros, since Debian always uses the default
> ABI) because he assumes that the user shouldn't use __GMP_CC and
> Of course, this is not the right solution (unless GMP decides to use
> the default ABI everywhere), otherwise one would get the same problems
> as in the past!

So, we have a distro maintainer who refuses to provide
a sensible GMP build/distribution. Is that correct?

> What do GMP developers propose to do concerning the use of these
> macros?
> Note: with the autotools, I'm not sure whether it is possible to use
> the default compiler and options by default, and the values in the
> __GMP_* macros as a fallback.

More information about the gmp-discuss mailing list