On May 1, 2013, at 12:48 AM, Igor Galić <i.ga...@brainsware.org> wrote:

> 
> Following this basic idea here
> 
>  
> http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros
> 
> I'd like to add a build/base_compiler.m4 - that runs this program:
> 
>    # include <stdio.h>
>    int main (void) {
>      printf (
>    #if defined(__clang__)
>      "clang"
>    #elif defined (__GNUC__) || defined (__GNUG__)
>      "gcc"
>    #elif defined (__SUNPRO_C) || defined (__SUNPRO_CC)
>      "sunproc"
>    #elif defined (__ICC) || defined(__INTEL_COMPILER)
>      "icc"
>    #endif
>      );
>      return 0;
>    }
> 
> To normalize our base_cc which we then can use as before:
> 
>    igalic@tynix /tmp % gcc comp.cc
>    igalic@tynix /tmp % ./a.out
>    gcc%
>    igalic@tynix /tmp % clang comp.cc
>    igalic@tynix /tmp % ./a.out
>    clang%
>    igalic@tynix /tmp %
> 
> 
> Objections?

This is a great idea. You should be able to implement it with only compilation; 
running a program makes life harder for cross compiling ...


> 
> ----- Original Message -----
>> On Apr 29, 2013, at 11:22 PM, Igor Galić <i.ga...@brainsware.org>
>> wrote:
>> 
>>> 
>>> 
>>> ----- Original Message -----
>>>> Updated Branches:
>>>> refs/heads/master 54b532b64 -> d8c526233
>>>> 
>>>> 
>>>> TS-1864 Rearrange some of the autoconf code, order matters
>>> [snip]
>>>> Branch: refs/heads/master
>>>> Commit: d8c5262331e0654097640982100f43731e7e8f6d
>>>> Parents: 54b532b
>>>> Author: Leif Hedstrom <zw...@apache.org>
>>>> Authored: Mon Apr 29 17:00:51 2013 -0600
>>>> Committer: Leif Hedstrom <zw...@apache.org>
>>>> Committed: Mon Apr 29 22:07:27 2013 -0600
>>> 
>>>> --- a/configure.ac
>>>> +++ b/configure.ac
>>>> @@ -674,10 +720,10 @@ AM_CONDITIONAL([BUILD_HAVE_LIBCXX], [ false
>>>> ])
>>>> 
>>>> base_cc=`basename $CC`
>>>> # These are shortcuts used in combination for the compiler options
>>>> below
>>> 
>>> 
>>> I hope we can all agree that using the compilers name on the
>>> filesystem is a BAD way determine which compiler we're dealing
>>> with.
>> 
>> Yep. Amongst other things, this behaves really badly with clang's
>> scan-build. We have https://issues.apache.org/jira/browse/TS-1838
>> open to address this.
>> 
>> J
> 
> -- 
> Igor Galić
> 
> Tel: +43 (0) 664 886 22 883
> Mail: i.ga...@brainsware.org
> URL: http://brainsware.org/
> GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE

Reply via email to