strerror.m4 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # strerror.m4 serial 7
  2. dnl Copyright (C) 2002, 2007 Free Software Foundation, Inc.
  3. dnl This file is free software; the Free Software Foundation
  4. dnl gives unlimited permission to copy and/or distribute it,
  5. dnl with or without modifications, as long as this notice is preserved.
  6. AC_DEFUN([gl_FUNC_STRERROR],
  7. [
  8. AC_REQUIRE([gl_FUNC_STRERROR_SEPARATE])
  9. if test $gl_cv_func_working_strerror = no; then
  10. AC_LIBOBJ([strerror])
  11. AC_DEFINE_UNQUOTED([REPLACE_STRERROR], [$REPLACE_STRERROR],
  12. [Define this to 1 if strerror is broken.])
  13. fi
  14. ])
  15. # Like gl_FUNC_STRERROR, except prepare for separate compilation (no AC_LIBOBJ).
  16. AC_DEFUN([gl_FUNC_STRERROR_SEPARATE],
  17. [
  18. AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
  19. AC_CACHE_CHECK([for working strerror function],
  20. [gl_cv_func_working_strerror],
  21. [AC_RUN_IFELSE(
  22. [AC_LANG_PROGRAM(
  23. [#include <string.h>
  24. ],
  25. [return !*strerror (-2);])],
  26. [gl_cv_func_working_strerror=yes],
  27. [gl_cv_func_working_strerror=no],
  28. [dnl Assume crossbuild works if it compiles.
  29. AC_COMPILE_IFELSE(
  30. [AC_LANG_PROGRAM(
  31. [#include <string.h>
  32. ],
  33. [return !*strerror (-2);])],
  34. [gl_cv_func_working_strerror=yes],
  35. [gl_cv_func_working_strerror=no])])])
  36. if test $gl_cv_func_working_strerror = no ; then
  37. REPLACE_STRERROR=1
  38. gl_PREREQ_STRERROR
  39. fi
  40. ])
  41. # Prerequisites of lib/strerror.c.
  42. AC_DEFUN([gl_PREREQ_STRERROR], [
  43. AC_CHECK_DECLS([strerror])
  44. ])