|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Problem with configure isfinite/finite detectionCompilation of CppUnit currently fails on both Solaris 10 (CC 5.8) & Suse
Linux 9.3 (g++ 3.3.5). configure detects either isfinite() or finite(), but compilation fails when attempting to use that function in CppUnit. Below are the relevant part of configure/config-auto and compilation failure message. I don't know how configure detects the presence of those function, but my guess is that it is not done the same way as we compile CppUnit. Linux man page state that isfinite() is only available in standard C99 mode (which does not seem to be combinable with C++). Solaris man page state that finite() requires include of <ieeefp.h>. isfinite() is also present but I guess it is also only when compiling C (did not manage to use it by changing the code). Are the configure tests compiled in C or C++? Here is the relevant data: * Suse Linux 9.3 with g++ 3.3.5: - configure: checking for isfinite... yes checking for finite... yes - config-auto.h matches configure output: /* Define to 1 if you have the `finite' function. */ #ifndef CPPUNIT_HAVE_FINITE #define CPPUNIT_HAVE_FINITE 1 #endif /* define if compiler has isfinite */ #ifndef CPPUNIT_HAVE_ISFINITE #define CPPUNIT_HAVE_ISFINITE 1 #endif - but compilation fails: g++ -DHAVE_CONFIG_H -I. -I../../../src/cppunit -I../../config -I../../include - I../../../include -g -O2 -MT TestAssert.lo -MD -MP -MF .deps/TestAssert.Tpo -c . ./../../src/cppunit/TestAssert.cpp -fPIC -DPIC -o .libs/TestAssert.o In file included from ../../../src/cppunit/TestAssert.cpp:2: ../../../include/cppunit/portability/FloatingPoint.h: In function `bool CppUnit::floatingPointIsFinite(double)': ../../../include/cppunit/portability/FloatingPoint.h:38: error: `isfinite' undeclared (first use this function) ../../../include/cppunit/portability/FloatingPoint.h:38: error: (Each undeclared identifier is reported only once for each function it appears in.) * Solaris 10 (CC 5.8): - configure: checking for isfinite... no checking for finite... yes - config-auto.h matches configure output: /* Define to 1 if you have the `finite' function. */ #ifndef CPPUNIT_HAVE_FINITE #define CPPUNIT_HAVE_FINITE 1 #endif /* define if compiler has isfinite */ /* #undef CPPUNIT_HAVE_ISFINITE */ - but compilation fails: CC -DHAVE_CONFIG_H -I. -I. -I../../config -I../../include -I../../include -pta -mt -xtarget=generic -g -features=no%transitions -xildoff -c TestAssert.cpp -o TestAssert.o "../../include/cppunit/portability/FloatingPoint.h", line 40: Error: The function "finite" must have a prototype. 1 Error(s) detected. Baptiste. --- Baptiste Lepilleur <blep@...> CppUnit maintainer OpenTest and CppUnit 2 developer. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Cppunit-devel mailing list Cppunit-devel@... https://lists.sourceforge.net/lists/listinfo/cppunit-devel |
|
|
|
|
|
Re: Problem with configure isfinite/finite detectionThe problem is not that it doesn't find isfinite (it shouldn't on Solaris 10 from what I saw), but that configure does find finite when it should not find that either. My fix for this was to comment out line 21700 in configure for cppunit-1.12.1:
//char $ac_func(); This line causes the configure test compilation to find finite() even though it is not defined in any Solaris 10 header I can find. I've tried to understand the comment attempting to describe why that line is there, but I'm still confused as to what was trying to be solved. Hope that helps, Carlos
|
|
|
Re: Problem with configure isfinite/finite detectionI've hit this issue on SuSE Linux 9.3. In my case the problem is due to
cmath replacing the isfinite function (see here for a discussion: http://lists.apple.com/archives/Darwin-development/2002/Aug/msg00485.html). Updating the include/cppunit/portability/FloatingPoint.h file to call std::isfinite when CPPUNIT_HAVE_CMATH is defined worked for me. Here's the diff: --- FloatingPoint.h.orig 2008-04-11 09:56:04.000000000 -0700 +++ FloatingPoint.h 2008-04-11 09:52:27.000000000 -0700 @@ -2,7 +2,10 @@ #define CPPUNIT_PORTABILITY_FLOATINGPOINT_H_INCLUDED #include <cppunit/Portability.h> + +#if not defined(CPPUNIT_HAVE_CMATH) #include <math.h> +#endif CPPUNIT_NS_BEGIN @@ -37,7 +40,9 @@ /// @return \c true if x is neither a NaN, nor +inf, nor -inf, \c false otherwise. inline int floatingPointIsFinite( double x ) { -#if defined(CPPUNIT_HAVE_ISFINITE) +#if defined(CPPUNIT_HAVE_CMATH) + return std::isfinite( x ); +#elif defined(CPPUNIT_HAVE_ISFINITE) return isfinite( x ); #elif defined(CPPUNIT_HAVE_FINITE) return finite( x ); |
| Free embeddable forum powered by Nabble | Forum Help |