1
# strchrnul.m4 serial 9
2
dnl Copyright (C) 2003, 2007, 2009-2012 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.
7
AC_DEFUN([gl_FUNC_STRCHRNUL],
9
dnl Persuade glibc <string.h> to declare strchrnul().
10
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
12
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
13
AC_CHECK_FUNCS([strchrnul])
14
if test $ac_cv_func_strchrnul = no; then
17
AC_CACHE_CHECK([whether strchrnul works],
18
[gl_cv_func_strchrnul_works],
19
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
20
#include <string.h> /* for strchrnul */
21
]], [[const char *buf = "a";
22
return strchrnul (buf, 'b') != buf + 1;
24
[gl_cv_func_strchrnul_works=yes],
25
[gl_cv_func_strchrnul_works=no],
26
[dnl Cygwin 1.7.9 introduced strchrnul, but it was broken until 1.7.10
27
AC_EGREP_CPP([Lucky user],
29
#if defined __CYGWIN__
30
#include <cygwin/version.h>
31
#if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 9)
38
[gl_cv_func_strchrnul_works="guessing yes"],
39
[gl_cv_func_strchrnul_works="guessing no"])
42
case "$gl_cv_func_strchrnul_works" in
44
*) REPLACE_STRCHRNUL=1 ;;
49
# Prerequisites of lib/strchrnul.c.
50
AC_DEFUN([gl_PREREQ_STRCHRNUL], [:])