How to reliable detect a MacPorts-ported compiler?
noloader at gmail.com
Mon Sep 7 18:43:12 PDT 2015
>> For Apple, we can detect Apple ported gear with:
>> $ clang++ -dM -E - < /dev/null | grep -i apple
>> #define __APPLE_CC__ 6000
>> #define __APPLE__ 1
>> #define __VERSION__ "4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)"
>> #define __apple_build_version__ 5030040
> Well, that's clang, not gcc.
Right, but the APPLE_CC tells me its an Apple port.
>> What strings or bits is MacPorts providing?
> If you want to know if gcc is FSF GCC compiled by MacPOrts, you could inspect the version string:
> $ gcc-mp-6 --version
> gcc-mp-6 (MacPorts gcc6 6-20150830_0+universal) 6.0.0 20150830 (experimental)
> Copyright (C) 2015 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> Note that this includes the string "MacPorts".
More information about the macports-users