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