blob: 6930a2f7291e55ac4dd291de86193bda6ba92451 (
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
63
64
65
66
67
68
69
70
71
72
|
#!/bin/sh
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
############################################################
set -e
LC_ALL=C
export LC_ALL
: ${TMPDIR:=/tmp}
tmpfile="$TMPDIR/mk-c.$$.c"
trap 'rm -f "$tmpfile"' 0
##################################################
pathpart=compiler_type
if test "$1" = -x; then
pathpart=cxx_type
langname='C++'
CC="$CXX"
export CC
else
langname='C'
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 >"$tmpfile"
$CC -E "$tmpfile" |
awk 'BEGIN { ret="unknown"} $1 == "compiler" {ret=$2; exit} END {print ret}'
}
. mkc_check_common.sh
check_and_cache "checking for $langname compiler type" "$cache"
printme '%s\n' "$ret" 1>&2
echo "$ret"
|