[openssl-dev] [openssl.org #4142] Fail to detect Xcode 7 for Intel AVX code

Jeffrey Walton noloader at gmail.com
Tue Nov 17 19:01:11 UTC 2015


On Tue, Nov 17, 2015 at 12:43 PM, Jun Sun via RT <rt at openssl.org> wrote:
> Hi,
>
> I just found the perl script for x86_64 assembly failed to detect Xcode 7 environment (Apple LLVM 7.x), and skipped generating AVX code for MAC OS ($avx variable is always false). The reason is Apple since Xcode 7.0 removed string "based on LLVM x.y.z" from version information. Now the clang -v command returns:
>
>
> Apple LLVM version 7.0.0 (clang-700.1.76)
>
> Target: x86_64-apple-darwin15.0.0
>
> Thread model: posix
>
> So the way to detect compiler version becomes to check either "LLVM version" or "clang-". Here is a patch to check the first string (take rsaz-avx2.pl as an example):

Apple has changed these strings a few times over the years.

I'm just bike shedding, but I think the way to proceed s to (1) detect
the Clang version (similar to what you propose), and then (2) look for
__APPLE_CC__ in the preprocessor. If (1) and (2) are met, then you
have an Apple port.

Also be awya that folks like MacPorts and Fink provide Clang compilers
for OS X, too. They *lack* __APPLE_CC__ in the preprocessor. For
example:

$ c++ -x c++ -dM -E - </dev/null | egrep -i "(clang|llvm|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
#define __clang__ 1
#define __clang_major__ 5
#define __clang_minor__ 1
#define __clang_patchlevel__ 0
#define __clang_version__ "5.1 (clang-503.0.40)"
#define __llvm__ 1

Jeff


More information about the openssl-dev mailing list