diff options
author | Andrew Shadura <andrewsh@debian.org> | 2014-01-05 22:42:41 +0100 |
---|---|---|
committer | Andrew Shadura <andrew@shadura.me> | 2015-07-25 14:44:33 +0200 |
commit | c8659b636be5e763c5dc028a5db7294b1af2648c (patch) | |
tree | 7dacf7580ff8c7d8c64682eaa28350bc47fbd56e /scripts/mkc_check_compiler | |
parent | 004c4cd3db1d9ad252eccbc1e9e6c54ec61a2927 (diff) | |
parent | aba913436a8521abe405a04ed71388989e1d646f (diff) |
Imported Debian patch 0.25.0-1
Diffstat (limited to 'scripts/mkc_check_compiler')
-rwxr-xr-x | scripts/mkc_check_compiler | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/scripts/mkc_check_compiler b/scripts/mkc_check_compiler new file mode 100755 index 0000000..2945f24 --- /dev/null +++ b/scripts/mkc_check_compiler @@ -0,0 +1,69 @@ +#!/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 + 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 >"$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 compiler type" "$cache" + +printme '%s\n' "$ret" 1>&2 + +echo "$ret" |