On 2006-07-04, Roland Levillain <roland(a)lrde.epita.fr> wrote:
Fix C++ compiler identification.
* config/oln.m4 (AC_CXX_FLAGS): Check for the Intel C++ compiler
before the GNU C++ compiler.
Index: 10.227/config/oln.m4
--- 10.227/config/oln.m4 Fri, 30 Jun 2006 16:51:46 +0200 levill_r (oln/j/15_oln.m4
1.38.1.12 600)
+++ 10.227(w)/config/oln.m4 Tue, 04 Jul 2006 11:33:53 +0200 levill_r (oln/j/15_oln.m4
1.38.1.12 600)
@@ -465,15 +465,19 @@
# specifications.
# This macro checks for the following compilers :
+# - Intel C++ (icpc)
# - GNU C++ (g++)
# - Sun WorkShop C++ (Sun/CC)
-# - Intel C++ (icc)
# - Comeau C++ (como)
# and sets the following autoconf variables:
# CXXFLAGS_DEBUG
# CXXFLAGS_STRICT
# CXXFLAGS_STRICT_ERRORS
# CXXFLAGS_OPTIMIZE
+#
+# The Intel C++ compiler is checked before the GNU C++ compiler,
+# because our test for the latter recognizes the former as G++ (i.e.,
+# icpc defines __GNUC__). Perhaps we should use another test for G++.
First off, I thought about using __GNUG__ but icpc also defines it :(
__GNUG__
The GNU C compiler defines this when the compilation language is C++; use
`__GNUG__' to distinguish between GNU C and GNU C++.
icpc defines the following:
#define __GNUG__ 3
#define __GNUC__ 4
#define __GNUC_MINOR__ 0
#define __VERSION__ "Intel(R) C++ gcc 3.0 mode"
How about grepping the result of icpc -E?
<<<< test.cc <<<<
__VERSION__
>>>>>>>>>>>>>>>>
if icpc -E test.cc | grep -i intel >/dev/null; then
echo 'ICPC'
else
echo 'Try something else :)'
fi
--
SIGOURE Benoit aka Tsuna
_____
/EPITA\ Promo 2008.CSI Rock & tRoll