strchrnul.m4 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # strchrnul.m4 serial 9
  2. dnl Copyright (C) 2003, 2007, 2009-2013 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_STRCHRNUL],
  7. [
  8. dnl Persuade glibc <string.h> to declare strchrnul().
  9. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
  10. AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
  11. AC_CHECK_FUNCS([strchrnul])
  12. if test $ac_cv_func_strchrnul = no; then
  13. HAVE_STRCHRNUL=0
  14. else
  15. AC_CACHE_CHECK([whether strchrnul works],
  16. [gl_cv_func_strchrnul_works],
  17. [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
  18. #include <string.h> /* for strchrnul */
  19. ]], [[const char *buf = "a";
  20. return strchrnul (buf, 'b') != buf + 1;
  21. ]])],
  22. [gl_cv_func_strchrnul_works=yes],
  23. [gl_cv_func_strchrnul_works=no],
  24. [dnl Cygwin 1.7.9 introduced strchrnul, but it was broken until 1.7.10
  25. AC_EGREP_CPP([Lucky user],
  26. [
  27. #if defined __CYGWIN__
  28. #include <cygwin/version.h>
  29. #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 9)
  30. Lucky user
  31. #endif
  32. #else
  33. Lucky user
  34. #endif
  35. ],
  36. [gl_cv_func_strchrnul_works="guessing yes"],
  37. [gl_cv_func_strchrnul_works="guessing no"])
  38. ])
  39. ])
  40. case "$gl_cv_func_strchrnul_works" in
  41. *yes) ;;
  42. *) REPLACE_STRCHRNUL=1 ;;
  43. esac
  44. fi
  45. ])
  46. # Prerequisites of lib/strchrnul.c.
  47. AC_DEFUN([gl_PREREQ_STRCHRNUL], [:])