Make proper autoconf test for availability of posix nan function instead of fudging with the NAN macro.

darcs-hash:20090202232049-ac50b-0176955677ff39fdd05eeefa20dca883863c34e6.gz
This commit is contained in:
axel 2009-02-03 09:20:49 +10:00
parent 72025a6a38
commit 35258bf1fb
4 changed files with 13 additions and 4 deletions

View file

@ -1815,7 +1815,7 @@ double timef()
if( time_res ) if( time_res )
{ {
return NAN; return nan(0);
} }
return (double)tv.tv_sec + 0.000001*tv.tv_usec; return (double)tv.tv_sec + 0.000001*tv.tv_usec;

View file

@ -505,6 +505,7 @@ LIBS=""
AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] ) AC_SEARCH_LIBS( connect, socket, , [AC_MSG_ERROR([Cannot find the socket library, needed to build this package.] )] )
AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] ) AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] ) AC_SEARCH_LIBS( setupterm, [ncurses curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
AC_SEARCH_LIBS( [nan], [m], [AC_DEFINE( [HAVE_NAN], [1], [Define to 1 if you have the nan function])] )
LIBS_SHARED=$LIBS LIBS_SHARED=$LIBS
LIBS=$LIBS_COMMON LIBS=$LIBS_COMMON

View file

@ -1183,5 +1183,12 @@ long sysconf(int name)
return -1; return -1;
} }
#endif #endif
#ifndef HAVE_NAN
double nan(char *tagp)
{
return 0.0/0.0;
}
#endif

View file

@ -469,8 +469,9 @@ long sysconf(int name);
#endif #endif
#ifndef NAN #ifndef HAVE_NAN
#define NAN (0.0/0.0) double nan(char *tagp);
#endif #endif
#endif #endif