Use of the __GMP_CC and __GMP_CFLAGS macros

Vincent Lefevre vincent at vinc17.org
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:

  https://sympa.inria.fr/sympa/arc/mpfr/2008-07/msg00010.html

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
__GMP_CFLAGS:

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=687169

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
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.

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


More information about the gmp-discuss mailing list