home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / automake-1.1e-bin.lha / share / aclocal / AM_FUNC_STRTOD.m4 < prev    next >
Encoding:
M4 Source File  |  1996-10-12  |  1.2 KB  |  51 lines

  1. dnl From Jim Meyering.
  2.  
  3. # serial 1
  4.  
  5. # @defmac AC_FUNC_STRTOD
  6. # @maindex FUNC_STRTOD
  7. # @ovindex LIBOBJS
  8. # If the @code{strtod} function is not available, or does not work
  9. # correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output
  10. # variable @code{LIBOBJS}.
  11. # @end defmac
  12.  
  13. AC_DEFUN(AM_FUNC_STRTOD,
  14. [AC_CACHE_CHECK(for working strtod, am_cv_func_strtod,
  15. [AC_TRY_RUN([
  16. double strtod ();
  17. int
  18. main()
  19. {
  20.   {
  21.     /* Some versions of Linux strtod mis-parse strings with leading '+'.  */
  22.     char *string = " +69";
  23.     char *term;
  24.     double value;
  25.     value = strtod (string, &term);
  26.     if (value != 69 || term != (string + 4))
  27.       exit (1);
  28.   }
  29.  
  30.   {
  31.     /* Under Solaris 2.4, strtod returns the wrong value for the
  32.        terminating character under some conditions.  */
  33.     char *string = "NaN";
  34.     char *term;
  35.     strtod (string, &term);
  36.     if (term != string && *(term - 1) == 0)
  37.       exit (1);
  38.   }
  39.   exit (0);
  40. }
  41. ], am_cv_func_strtod=yes, am_cv_func_strtod=no, am_cv_func_strtod=no)])
  42. test $am_cv_func_strtod = no && LIBOBJS="$LIBOBJS strtod.o"
  43. AC_SUBST(LIBOBJS)dnl
  44. if test $am_cv_func_strtod = no; then
  45.   AC_CHECK_FUNCS(pow)
  46.   if test $am_cv_func_pow = no; then
  47.     AC_CHECK_LIB(m, pow)
  48.   fi
  49. fi
  50. ])
  51.