Skip to content

Commit

Permalink
Make proper autoconf test for availability of posix nan function inst…
Browse files Browse the repository at this point in the history
…ead of fudging with the NAN macro.

darcs-hash:20090202232049-ac50b-0176955677ff39fdd05eeefa20dca883863c34e6.gz
  • Loading branch information
liljencrantz committed Feb 2, 2009
1 parent 72025a6 commit 35258bf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ double timef()

if( time_res )
{
return NAN;
return nan(0);
}

return (double)tv.tv_sec + 0.000001*tv.tv_usec;
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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( 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( [nan], [m], [AC_DEFINE( [HAVE_NAN], [1], [Define to 1 if you have the nan function])] )
LIBS_SHARED=$LIBS
LIBS=$LIBS_COMMON

Expand Down
7 changes: 7 additions & 0 deletions fallback.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,5 +1183,12 @@ long sysconf(int name)
return -1;

}
#endif

#ifndef HAVE_NAN
double nan(char *tagp)
{
return 0.0/0.0;
}
#endif

5 changes: 3 additions & 2 deletions fallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,9 @@ long sysconf(int name);

#endif

#ifndef NAN
#define NAN (0.0/0.0)
#ifndef HAVE_NAN
double nan(char *tagp);
#endif


#endif

0 comments on commit 35258bf

Please sign in to comment.