Blitz logo

Blitz Support :

From: Zane Dodson (zdodson_at_[hidden])
Date: 2005-05-18 13:42:13


Hello Julian,

On Wed, May 18, 2005 at 10:41:09AM -0700, Julian Cummings wrote:
| Hi Derrick,
|
| I don't think the problem is that the configure script sees different
| files than the actual code. The real problem here is that the line
|
| #ifdef isnan
|
| does not work as expected. This would detect if isnan were defined to
| be a value like 1 or something. But when it is defined to be a macro
| function, then it is not expanded unless it is followed by an argument
| list. Unfortunately, doing something like
|
| #ifdef isnan(x)
|
| does not work either. I've tried some tricks using concatenation, but
| none of them work quite like I had hoped. I don't think just adding
| another macro will solve this problem. We need to figure out how to get
| the preprocessor to select the simple "return isnan(a);" line when isnan
| is a macro function. There must be a way to do this...

<snip>

Here is what I have used in the past.

dnl === Checks for specific functions

dnl ==== isnan ====
dnl ===== Could be a macro or a function. C99 requires a macro.
AC_LANG_PUSH([C])
AC_CHECK_FUNCS([isnan])
if test $ac_cv_func_isnan = no; then
  # isnan not in default libraries; try as a macro.
  AC_MSG_RESULT([for isnan macro])
  AC_TRY_LINK([#include <math.h>],
              [{int tmp = isnan(0);}],
              [ac_cv_func_isnan=yes],
              [ac_cv_func_isnan=no])
  if test $ac_cv_func_isnan = yes; then
    AC_MSG_RESULT([yes])
    AC_DEFINE([HAVE_ISNAN])
  else
    AC_MSG_RESULT([no])
  fi
fi

Kindest regards,

--
Zane Dodson