Building on Solaris 10 with gcc 3.4.x

Matt Ball
2009-11-24
2013-04-22
  • Matt Ball
    Matt Ball
    2009-11-24

    I've got a Solaris 10u6 sparc and a Solaris 10u8 x86 system, with gcc 3.4.3 and 3.4.5 installed.  After extracting the source and typing './configure' and 'gmake', I get the following error while compiling TestAssert.cpp:

        In file included from TestAssert.cpp:2:
        ../../include/cppunit/portability/FloatingPoint.h: In function `int CppUnit::floatingPointIsFinite(double)':
        ../../include/cppunit/portability/FloatingPoint.h:43: error: `finite' was not declared in this scope

    This is a little strange, because the ./configure script determined that 'finite' worked on this system (and accordingly defined CPPUNIT_HAVE_FINITE).

    I got around this problem by manually changing FloatingPoint.h to not use finite, but the bigger question is why 'configure' thought 'finite' was available.  I couldn't see any obvious way to fix configure so that it correctly identifies 'finite'.

    Anyone else have similar issues compiling on Solaris 10 with gcc 3.4.x?

     
  • I just ran into the same problem, trying to build CppUnit 1.12.1 on Solaris 10 using the Sun CC C++ compiler.

    configure checks for finite with AC\_CHECK\_FUNCS, which only checks that finite is in libc (which it is), but not which header needs to be included (ieeefp.h on Solaris).

    So, I think a fix would be:

        -- cppunit-1.12.1/include/cppunit/portability/FloatingPoint.h
        +++ cppunit-1.12.1/include/cppunit/portability/FloatingPoint.h
        @@ -3,6 +3,11 @@
        
         #include <cppunit/Portability.h>
         #include <math.h>
        +
        +#if defined(__sun) && !defined(CPPUNIT_HAVE_ISFINITE) && defined(CPPUNIT_HAVE_FINITE)
        +#include <ieeefp.h>
        +  // <math.h> is still needed for usage of fabs in TestAssert.cpp
        +#endif
        
         CPPUNIT_NS_BEGIN