c-strtod.m4 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # c-strtod.m4 serial 14
  2. # Copyright (C) 2004-2006, 2009-2011 Free Software Foundation, Inc.
  3. # This file is free software; the Free Software Foundation
  4. # gives unlimited permission to copy and/or distribute it,
  5. # with or without modifications, as long as this notice is preserved.
  6. # Written by Paul Eggert.
  7. AC_DEFUN([gl_C99_STRTOLD],
  8. [
  9. AC_CACHE_CHECK([whether strtold conforms to C99],
  10. [gl_cv_func_c99_strtold],
  11. [AC_LINK_IFELSE(
  12. [AC_LANG_PROGRAM(
  13. [[/* On HP-UX before 11.23, strtold returns a struct instead of
  14. long double. Reject implementations like that, by requiring
  15. compatibility with the C99 prototype. */
  16. #include <stdlib.h>
  17. static long double (*p) (char const *, char **) = strtold;
  18. static long double
  19. test (char const *nptr, char **endptr)
  20. {
  21. long double r;
  22. r = strtold (nptr, endptr);
  23. return r;
  24. }]],
  25. [[return test ("1.0", NULL) != 1 || p ("1.0", NULL) != 1;]])],
  26. [gl_cv_func_c99_strtold=yes],
  27. [gl_cv_func_c99_strtold=no])])
  28. if test $gl_cv_func_c99_strtold = yes; then
  29. AC_DEFINE([HAVE_C99_STRTOLD], [1], [Define to 1 if strtold conforms to C99.])
  30. fi
  31. ])
  32. dnl Prerequisites of lib/c-strtod.c.
  33. AC_DEFUN([gl_C_STRTOD],
  34. [
  35. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
  36. AC_CHECK_FUNCS([strtod_l])
  37. AC_REQUIRE([AC_C_INLINE])
  38. :
  39. ])
  40. dnl Prerequisites of lib/c-strtold.c.
  41. AC_DEFUN([gl_C_STRTOLD],
  42. [
  43. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
  44. AC_REQUIRE([gl_C99_STRTOLD])
  45. AC_CHECK_FUNCS([strtold_l])
  46. AC_REQUIRE([AC_C_INLINE])
  47. :
  48. ])