On Aug 16, 2012, at 16:41, Ryan Schmidt <[email protected]> wrote:

>> I would also find this useful, as I would like to use the 3.2 macports clang 
>> version as a possible compiler for the ROOT port, to support cling.
>> 
>> As a side question If 3.2 is not released, how does it then related to the 
>> Xcode version of clang with OSX 10.8, which appears to report itself as 
>> version 4.0 ? Or is this just Apple doing its own thing again... Or have I 
>> mis read the versions...
> 
> I'm unclear on why Apple has called their latest clang "4.0". If the clang 
> project decides to match Apple and call the next version 4.0 instead of 3.2 
> then we'll have to rename the clang-3.2 port and the "configure.compiler 
> macports-clang-3.2" option.

clang versioning is all kinds of problematic and confusing.  This is nothing 
new.  Older versions of clang shipped with XCode had different versions than 
the version of llvm they were based on.  This got confusing around the "3.0" 
era because both llvm and Apple's clang had similar version numbers.  I believe 
Apple clang version 3.1 was based on llvm 3.1.

The version reported by clang is entirely driven by branding / marketing / 
arbitrary whims of wizards.  You should not be basing any decision off of the 
version reported.  You should be making decisions based on __has_feature(), 
__has_attribute(), etc.

Part of the problem is that there aren't really versions of clang in the normal 
sense.  The best way to think about it is that there are versions of "Apple 
Clang" and there are versions of "llvm".  clang is developed in tandem with 
llvm; it is branched and tagged according to the llvm roadmap.  Indeed what is 
reported with 'clang --version' is something like "clang version 3.1" but what 
that really means is "llvm 3.1's clang"

I understand the confusion and frustration.  If you really want to know the 
llvm version, check for that in the Apple --version string by doing something 
like this:

#!/bin/bash

CLANG=$1

VERSION=$(${CLANG} --version | head -n 1)

if [[ "${VERSION/Apple/}" == "${VERSION}" ]] ; then
    # Not Apple
    echo "${VERSION}" | sed 's:^.*clang version \([^ ]*\).*$:\1:'
else
    # Apple
    echo "${VERSION}" | sed 's:^.*based on LLVM \([^)]*\).*$:\1:' | sed 
's:svn::'
fi

_______________________________________________
macports-dev mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo/macports-dev

Reply via email to