autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

checking for C++-compiler trouble


From: Alexander Stippler
Subject: checking for C++-compiler trouble
Date: Fri, 12 Dec 2003 12:49:08 +0100
User-agent: Mutt/1.5.4i

Hello,

I'm in trouble with automatically choosing the correct compiler. At the moment,
I'm only interested in icc (version 8.0) and gcc. The problem is that icc 
defines __GNUC__, thus the test for the compiler used will yield incorrect 
results.

There is a command line switch '-no-gcc' to not automatically define the __GNUC_
macro, but I'm not able to set the flags early enough, so that they are used 
for the 
test which compiler is used. I want the following behaviour:

icc is chosen by default.
gcc is only chosen if CXX and CC are given at command line (or externally).

I tried the following code which works for icc, but with gcc it says we are NOT 
using 
gcc. Where am I wrong? How can I handle it?


if test "x$GXX" = "xyes"
then
    CXXFLAGS="$CXXFLAGS -Wall -Werror -pedantic"
else
    CXXFLAGS="$CXXFLAGS -no-gcc -w1 -DHAVE_INHERITED_MEMBER_BUG 
-DHAVE_INTEL_STL"
fi

if test "x$GCC" = "xyes"
then
    CFLAGS="$CFLAGS -Wall -Werror -pedantic"
else
    CFLAGS="$CFLAGS -no-gcc -w1 -DHAVE_INHERITED_MEMBER_BUG -DHAVE_INTEL_STL"
fi

AC_PROG_CXX(icc g++)
AC_PROG_CC(icc gcc)
AC_PROG_CXXCPP

if I put the AC_PROG-lines before the if's the behaviour is just the other way 
round.
How can I make both compilers be detected correctly?

best regards,
    alex




reply via email to

[Prev in Thread] Current Thread [Next in Thread]