1
2
3dnl Adapted from the predefined _AC_LANG_COMPILER_GNU.
4m4_define([_AC_LANG_COMPILER_INTEL],
5[AC_CACHE_CHECK([whether we are using the INTEL _AC_LANG compiler],
6		[ac_cv_[]_AC_LANG_ABBREV[]_compiler_intel],
7[
8_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef __INTEL_COMPILER
9       choke me
10#endif
11]])],
12		   [ac_compiler_intel=yes],
13		   [ac_compiler_intel=no])
14ac_cv_[]_AC_LANG_ABBREV[]_compiler_intel=$ac_compiler_intel
15])])# _AC_LANG_COMPILER_INTEL
16
17dnl The list of warnings that must be disabled for Spot.
18m4_define([_INTEL_IGNORE_WARNINGS],
19[ 69   dnl Warn when an enum value is used as an int, without any
20       dnl explicit cast.
21  177  dnl Warm when a method was declared but never referenced.
22  279  dnl Warn when a constant expression is used in a control statement.
23  654  dnl Warn when a child does not overload all virtual members of his
24       dnl parents.
25  913  dnl Warn when multibyte character are used (for example "Büchi").
26  1125 dnl Warn when a child member hides a parent member.
27]) # _INTEL_IGNORE_WARNINGS
28
29dnl Add extra flags when icpc is used.
30AC_DEFUN([spot_INTEL],
31[_AC_LANG_COMPILER_INTEL
32AC_CACHE_CHECK([to add extra CXXFLAGS for the INTEL C++ compiler],
33		[ac_cv_intel_cxxflags],
34[ dnl
35  if test x"$ac_cv_[]_AC_LANG_ABBREV[]_compiler_intel" = x"yes"; then
36    disabled_warnings=''
37    for warning in _INTEL_IGNORE_WARNINGS; do
38      disabled_warnings="$disabled_warnings,$warning"
39    done
40
41    # Remove the extra "," and extra whitespaces.
42    disabled_warnings=`echo "$disabled_warnings" | sed "s/^,//;s/[[[:space:]]]//g"`
43
44    INTEL_CXXFLAGS="-w1 -Werror -wd${disabled_warnings}"
45
46    [ac_cv_intel_cxxflags="$INTEL_CXXFLAGS"]
47  else
48    [ac_cv_intel_cxxflags=""]
49  fi])
50
51  if test x"$ac_cv_[]_AC_LANG_ABBREV[]_compiler_intel" = x"yes"; then
52    # -W does not exist for icpc in CXXFLAGS.
53    CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-W[[[:space:]]]//g;s/-W$//'`
54
55    # Even if the icpc preprocessor defines __GNUC__, it is not a GNU compiler.
56    GXX=
57    CXXFLAGS="$CXXFLAGS $ac_cv_intel_cxxflags"
58  fi
59  AC_SUBST([INTEL_CXXFLAGS])
60]) # spot_INTEL
61