diff --git a/buddy/ChangeLog b/buddy/ChangeLog index fa89682fe..d451d8bff 100644 --- a/buddy/ChangeLog +++ b/buddy/ChangeLog @@ -1,3 +1,10 @@ +2009-06-12 Guillaume Sadegh + + Adjust to support the Intel compiler (icc). + + * configure.ac: Adjust to call... + * m4/intel.m4: ...this new macro. + 2008-03-13 Alexandre Duret-Lutz * src/bddtest.cxx: Include to compile with g++-4.3. diff --git a/buddy/configure.ac b/buddy/configure.ac index 57108ad13..37bbf525f 100644 --- a/buddy/configure.ac +++ b/buddy/configure.ac @@ -13,6 +13,7 @@ AC_PROG_CXX AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL +buddy_INTEL buddy_DEBUG_FLAGS AC_CONFIG_HEADERS([config.h]) diff --git a/buddy/m4/intel.m4 b/buddy/m4/intel.m4 new file mode 100644 index 000000000..2a95ad38a --- /dev/null +++ b/buddy/m4/intel.m4 @@ -0,0 +1,50 @@ +dnl Adapted from the predefined _AC_LANG_COMPILER_GNU. +m4_define([_AC_LANG_COMPILER_INTEL], +[AC_CACHE_CHECK([whether we are using the INTEL _AC_LANG compiler], + [ac_cv_[]_AC_LANG_ABBREV[]_compiler_intel], +[ +_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef __INTEL_COMPILER + choke me +#endif +]])], + [ac_compiler_intel=yes], + [ac_compiler_intel=no]) +ac_cv_[]_AC_LANG_ABBREV[]_compiler_intel=$ac_compiler_intel +])])# _AC_LANG_COMPILER_INTEL +dnl The list of warnings that must be disabled. +m4_define([_INTEL_IGNORE_WARNINGS], +[ 522 dnl Remark ``redeclared "inline" after being called'' + 981 dnl Remark ``operands are evaluated in unspecified order'' + 383 dnl Remark ``value copied to temporary, reference to temporary used'' + 279 dnl Remark ``controlling expression is constant'' +]) # _INTEL_IGNORE_WARNINGS + +dnl Add extra flags when icc is used. +AC_DEFUN([buddy_INTEL], +[_AC_LANG_COMPILER_INTEL +AC_CACHE_CHECK([to add extra CFLAGS for the INTEL C compiler], + [ac_cv_intel_cflags], +[ dnl + if test x"$ac_compiler_intel" = x"yes"; then + # -W does not exist for icc in CFLAGS. + CFLAGS=`echo "$CFLAGS" | sed 's/-W[[[:space:]]]//g;s/-W$//'` + + disabled_warnings='' + for warning in _INTEL_IGNORE_WARNINGS; do + disabled_warnings="$disabled_warnings,$warning" + done + + # Remove the extra "," and extra whitespaces. + disabled_warnings=`echo "$disabled_warnings" | sed "s/^,//;s/[[[:space:]]]//g"` + + INTEL_CFLAGS="-w1 -Werror -wd${disabled_warnings}" + + CFLAGS="$CFLAGS $INTEL_CFLAGS" + CXXFLAGS="$CFLAGS $INTEL_CFLAGS" + + [ac_cv_intel_cflags="$INTEL_CFLAGS"] + else + [ac_cv_intel_cflags="no extra flags"] + fi]) + AC_SUBST([INTEL_CFLAGS]) +]) # buddy_INTEL