[Top][All Lists]

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

[Bug-gsl] gsl infnan.c configure/build bug

From: Richard Smith
Subject: [Bug-gsl] gsl infnan.c configure/build bug
Date: Tue, 24 Jul 2007 10:24:22 +1000
User-agent: Thunderbird (X11/20070508)

infnan.c currently fails to compile on Solaris with Sun Studio 12 compilers
when using default compiler options as generated by running configure with
no options. Here is an extract of the output when running make:

/bin/bash ../libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I../../sys
-I.. -I..     -g -c -o infnan.lo ../../sys/infnan.c
cc -DHAVE_CONFIG_H -I. -I../../sys -I.. -I.. -g -c ../../sys/infnan.c -KPIC -D
PIC -o .libs/infnan.o
"/usr/include/ieeefp.h", line 74: syntax error before or at: __builtin_isfinite
cc: acomp failed for ../../sys/infnan.c

The problem seems to occur as a result of the following combination of things:
1. "finite" function is used in various source files
2. configure.ac checks for <ieeefp.h> and finds it
3. On Solaris, "finite" is defined in <ieeefp.h>
4. configure.ac only checks <math.h> for "finite", and doesn't find it.
5. Since its a c99 environment, "isfinite" is found.
6. config.h ends up containing amongst other things the following lines:
#define finite isfinite
#define finite gsl_finite
  This means that "finite" macro has the value "isfinite"
7. "isfinite" is a macro, ultimately defined in <iso/math_c99.h>:
#define        isfinite(x)     __builtin_isfinite(x)
8. <ieeefp.h> declares "finite" function:
extern int      finite(double);
9. After macro expansion the compiler sees
extern int      __builtin_isfinite ( double ) ;
and complains with an error.

There's probably multiple ways of overcoming the problem. A workaround is
to force the compiler not to use a C99 environment e.g. -xc99=%none. However
since it would be desirable to have configure work well by default, maybe
the test in configure.ac for "finite" should be something like:
AC_CHECK_DECLS(finite,,,[#include <math.h>
# include <ieeefp.h>

Alternatively all uses of "finite" could be changed to use "isfinite", and
the configuration/build be based around assuming a C99 environment, with
substitute functions and macros being provided where the necessary C99
facilities are missing. On Linux, the BSD floating point classification
functions are documented as being obsolete, so their use should probably
be avoided.

  ,-_|\   Richard Smith - Technical Specialist
 /     \  Sun Microsystems Australia         Phone : +61 3 9869 6200
address@hidden                        Direct : +61 3 9869 6224
 \_,-._/  476 St Kilda Road                    Fax : +61 3 9869 6290
      v   Melbourne Vic 3004 Australia

reply via email to

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