Debian Codegraph @

m4/strchrnul.m4

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