#!/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"