1
############################################################################
3
# SIM_AC_COMPILER_CPLUSPLUS_FATAL_ERRORS
6
# Check for the known causes that would make the current C++ compiler
7
# unusable for building Coin or Coin-related projects.
9
# Exits the configure script if any of them fail.
12
AC_DEFUN([SIM_AC_COMPILER_CPLUSPLUS_FATAL_ERRORS], [
13
SIM_AC_COMPILER_INLINE_FOR
14
SIM_AC_COMPILER_SWITCH_IN_VIRTUAL_DESTRUCTOR
15
SIM_AC_COMPILER_CRAZY_GCC296_BUG
20
############################################################################
22
# SIM_AC_COMPILER_INLINE_FOR( [ACTION-IF-OK [, ACTION-IF-FAILS ] ] )
25
# Check if the compiler supports for(;;){} loops inside inlined
28
# This smokes out the useless HPUX 10.20 CC compiler.
31
AC_DEFUN([SIM_AC_COMPILER_INLINE_FOR], [
34
[if the compiler handles for() loops in inlined constructors],
42
inline TestClass::TestClass(int) { for (int i=0; i<1; i++) i=0; }
45
[sim_cv_c_inlinefor=yes],
46
[sim_cv_c_inlinefor=no])
49
if test x"$sim_cv_c_inlinefor" = x"yes"; then
50
ifelse([$1], , :, [$1])
52
SIM_AC_ERROR([c--inlinefor])
58
############################################################################
60
# SIM_AC_COMPILER_SWITCH_IN_VIRTUAL_DESTRUCTOR( [ACTION-IF-OK [, ACTION-IF-FAILS ] ] )
63
# Check if the compiler crashes on switch() statements inside virtual
66
# This smokes out a particular patch-level version of the CC compiler
67
# for Sun WorkShop 6 (update 1 C++ 5.2 Patch 109508-01 2001/01/31).
70
AC_DEFUN([SIM_AC_COMPILER_SWITCH_IN_VIRTUAL_DESTRUCTOR], [
73
[if the compiler handles switch statements in virtual destructors],
74
sim_cv_c_virtualdestrswitch,
76
class hepp { virtual ~hepp(); };
77
hepp::~hepp() { switch(0) { } }
80
[sim_cv_c_virtualdestrswitch=yes],
81
[sim_cv_c_virtualdestrswitch=no])])
83
if test x"$sim_cv_c_virtualdestrswitch" = x"yes"; then
84
ifelse([$1], , :, [$1])
86
SIM_AC_ERROR([c--vdest])
92
############################################################################
94
# SIM_AC_COMPILER_CRAZY_GCC296_BUG([ACTION-IF-OK [, ACTION-IF-FAILS ]])
97
# Tries to smoke out some completely fubar bug in g++ of GCC 2.96
98
# (at least) when -O2 (or higher, probably) optimization on. The reason
99
# we check specifically for this bug is because this compiler version
100
# is pretty well spread because it was part of a Red Hat Linux release.
103
AC_DEFUN([SIM_AC_COMPILER_CRAZY_GCC296_BUG], [
106
[if this is a version of GCC with a known nasty optimization bug],
107
sim_cv_c_gcctwonightysixbug,
118
hepp(const float v0, const float v1)
123
proj.ref() = -(v1+v0);
137
myclass proj = hepp(2.0f, 4.0f);
138
return (proj.ref() < 0.0f) ? 0 : 1;
141
[sim_cv_c_gcctwonightysixbug=false],
142
[sim_cv_c_gcctwonightysixbug=true],
143
[sim_cv_c_gcctwonightysixbug=false
144
AC_MSG_WARN([can't check for GCC bug when cross-compiling, assuming it's ok])])
148
if $sim_cv_c_gcctwonightysixbug; then
149
SIM_AC_ERROR(c--gcc296bug)
152
ifelse([$1], , :, [$1])