summaryrefslogtreecommitdiff
path: root/mkc_check_compiler
blob: 293d059939007139139a917e09b81606f43630a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh

############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
# See COPYRIGHT file in the distribution.
############################################################

set -e

LC_ALL=C
export LC_ALL

##################################################

pathpart=compiler_type
if test "$1" = -x; then
    pathpart=cxx_type
    CC="$CXX"
    export CC
fi

##################################################
checks='
       __clang__   clang
           __ICC   icc
__INTEL_COMPILER   icc
         __PCC__   pcc
        __GNUC__   gcc
        _MSC_VER   msc
        __HP_aCC   hpc
         __HP_cc   hpc
   __SUNPRO_C      sunpro
  __SUNPRO_CC      sunpro
     __IBMCPP__    ibmc
       __IBMC__    ibmc
    __BORLANDC__   bcc
  __WATCOMC__      watcom
       __COMO__    como
         __DECC    decc
       __DECCXX    decc
_COMPILER_VERSION  mipspro
'

check_itself (){
    awk '
BEGIN {
   printf "#"
   for (i=1; i < ARGC; ++i){
      printf "if defined(%s)\ncompiler %s\n#el", ARGV [i], ARGV [i+1]
   }
   printf "se\ncompiler unknown\n#endif\n"
}' $checks | $CC -E - | awk '$1 == "compiler" {print $2}'
}

. mkc_check_common.sh

check_and_cache "checking for compiler type" "$cache"

printme '%s\n' "$ret" 1>&2

echo "$ret"