Use of the __GMP_CC and __GMP_CFLAGS macros

Vincent Lefevre vincent at
Mon Sep 24 16:57:34 CEST 2012

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!

What do GMP developers propose to do concerning the use of these

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.

Vincent Lefèvre <vincent at> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

More information about the gmp-discuss mailing list