clang version 10.0.1 identified as gcc in configure ?
Paul Zimmermann
Paul.Zimmermann at inria.fr
Thu Aug 20 09:30:49 UTC 2020
> > flat$ cc -v
> > Apple clang version 12.0.0 (clang-1200.0.22.19)
> > Target: x86_64-apple-darwin19.6.0
> > Thread model: posix
> > InstalledDir:
> > /Users/tege/Downloads/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
> > flat$ cc -dM -E - < /dev/null | grep GNU
> > #define __GNUC_MINOR__ 2
> > #define __GNUC_PATCHLEVEL__ 1
> > #define __GNUC_STDC_INLINE__ 1
> > #define __GNUC__ 4
>
> Fascinating! I never would have guessed :
note that the same happens with Intel cc:
[zimmerma at miriel015 ~]$ icc -v
icc version 19.0.4.243 (gcc version 9.2.0 compatibility)
[zimmerma at miriel015 ~]$ icc -dM -E - < /dev/null | grep GNU
#define __GNUC_STDC_INLINE__ 1
#define __GNUC_GNU_INLINE__ 1
#define __GNUC__ 9
#define __GNUC_MINOR__ 2
#define __GNUC_PATCHLEVEL__ 0
The trick is to first look for __INTEL_COMPILER or __clang__:
[zimmerma at miriel015 ~]$ icc -dM -E - < /dev/null | grep INTEL
#define __INTEL_COMPILER 1900
#define __INTEL_COMPILER_UPDATE 4
#define __INTEL_RTTI__ 1
#define __INTEL_COMPILER_BUILD_DATE 20190416
#define __INTEL_OFFLOAD 1
zimmerma at mure:~$ clang -dM -E - < /dev/null | grep clang
#define __clang__ 1
#define __clang_major__ 3
#define __clang_minor__ 8
#define __clang_patchlevel__ 0
#define __clang_version__ "3.8.0 (tags/RELEASE_380/final)"
Paul
More information about the gmp-discuss
mailing list