| 1 |
# strchrnul.m4 |
| 2 |
# serial 12 |
| 3 |
dnl Copyright (C) 2003, 2007, 2009-2024 Free Software Foundation, Inc. |
| 4 |
dnl This file is free software; the Free Software Foundation |
| 5 |
dnl gives unlimited permission to copy and/or distribute it, |
| 6 |
dnl with or without modifications, as long as this notice is preserved. |
| 7 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
AC_DEFUN([gl_FUNC_STRCHRNUL], |
| 10 |
[ |
| 11 |
dnl Persuade glibc <string.h> to declare strchrnul(). |
| 12 |
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
| 13 |
|
| 14 |
AC_REQUIRE([gl_STRING_H_DEFAULTS]) |
| 15 |
gl_CHECK_FUNCS_ANDROID([strchrnul], [[#include <string.h>]]) |
| 16 |
if test $ac_cv_func_strchrnul = no; then |
| 17 |
HAVE_STRCHRNUL=0 |
| 18 |
case "$gl_cv_onwards_func_strchrnul" in |
| 19 |
future*) REPLACE_STRCHRNUL=1 ;; |
| 20 |
esac |
| 21 |
else |
| 22 |
AC_CACHE_CHECK([whether strchrnul works], |
| 23 |
[gl_cv_func_strchrnul_works], |
| 24 |
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
| 25 |
#include <string.h> /* for strchrnul */ |
| 26 |
]], [[const char *buf = "a"; |
| 27 |
return strchrnul (buf, 'b') != buf + 1; |
| 28 |
]])], |
| 29 |
[gl_cv_func_strchrnul_works=yes], |
| 30 |
[gl_cv_func_strchrnul_works=no], |
| 31 |
[dnl Cygwin 1.7.9 introduced strchrnul, but it was broken until 1.7.10 |
| 32 |
AC_EGREP_CPP([Lucky user], |
| 33 |
[ |
| 34 |
#if defined __CYGWIN__ |
| 35 |
#include <cygwin/version.h> |
| 36 |
#if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 9) |
| 37 |
Lucky user |
| 38 |
#endif |
| 39 |
#else |
| 40 |
Lucky user |
| 41 |
#endif |
| 42 |
], |
| 43 |
[gl_cv_func_strchrnul_works="guessing yes"], |
| 44 |
[gl_cv_func_strchrnul_works="guessing no"]) |
| 45 |
]) |
| 46 |
]) |
| 47 |
case "$gl_cv_func_strchrnul_works" in |
| 48 |
*yes) ;; |
| 49 |
*) REPLACE_STRCHRNUL=1 ;; |
| 50 |
esac |
| 51 |
fi |
| 52 |
]) |
| 53 |
|
| 54 |
# Prerequisites of lib/strchrnul.c. |
| 55 |
AC_DEFUN([gl_PREREQ_STRCHRNUL], [:]) |