summaryrefslogtreecommitdiff
path: root/gnulib-m4/string_h.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib-m4/string_h.m4')
-rw-r--r--gnulib-m4/string_h.m4135
1 files changed, 79 insertions, 56 deletions
diff --git a/gnulib-m4/string_h.m4 b/gnulib-m4/string_h.m4
index 97c80dcc..9e09b96e 100644
--- a/gnulib-m4/string_h.m4
+++ b/gnulib-m4/string_h.m4
@@ -1,25 +1,19 @@
# Configure a GNU-like replacement for <string.h>.
-# Copyright (C) 2007-2018 Free Software Foundation, Inc.
+# Copyright (C) 2007-2022 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 22
+# serial 34
# Written by Paul Eggert.
-AC_DEFUN([gl_HEADER_STRING_H],
+AC_DEFUN_ONCE([gl_STRING_H],
[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_HEADER_STRING_H_BODY])
-])
-
-AC_DEFUN([gl_HEADER_STRING_H_BODY],
-[
- AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only, before all statements
+ dnl that occur in other macros.
+ AC_REQUIRE([gl_STRING_H_DEFAULTS])
gl_NEXT_HEADERS([string.h])
dnl Check for declarations of anything we want to poison if the
@@ -29,64 +23,88 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
]],
[ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul
strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
- strerror_r strsignal strverscmp])
+ strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp])
+
+ AC_REQUIRE([AC_C_RESTRICT])
])
+# gl_STRING_MODULE_INDICATOR([modulename])
+# sets the shell variable that indicates the presence of the given module
+# to a C preprocessor expression that will evaluate to 1.
+# This macro invocation must not occur in macros that are AC_REQUIREd.
AC_DEFUN([gl_STRING_MODULE_INDICATOR],
[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
+ dnl Ensure to expand the default settings once only.
+ gl_STRING_H_REQUIRE_DEFAULTS
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
dnl Define it also as a C macro, for the benefit of the unit tests.
gl_MODULE_INDICATOR_FOR_TESTS([$1])
])
-AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
+# Initializes the default values for AC_SUBSTed shell variables.
+# This macro must not be AC_REQUIREd. It must only be invoked, and only
+# outside of macros or in macros that are not AC_REQUIREd.
+AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
+[
+ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS], [
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPLICIT_BZERO])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSLL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSEP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRCHR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSTR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASECMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNCASECMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPCASECMP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASESTR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCSPN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPBRK])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSIGNAL])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRVERSCMP])
+ dnl Support Microsoft deprecated alias function names by default.
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MEMCCPY], [1])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_STRDUP], [1])
+ ])
+ m4_require(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS])
+ dnl Make sure the shell variable for GNULIB_FREE_POSIX is initialized.
+ gl_STDLIB_H_REQUIRE_DEFAULTS
+ AC_REQUIRE([gl_STRING_H_DEFAULTS])
+])
+
+AC_DEFUN([gl_STRING_H_DEFAULTS],
[
- GNULIB_EXPLICIT_BZERO=0; AC_SUBST([GNULIB_EXPLICIT_BZERO])
- GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL])
- GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL])
- GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR])
- GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM])
- GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY])
- GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR])
- GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR])
- GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY])
- GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY])
- GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL])
- GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP])
- GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT])
- GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP])
- GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN])
- GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK])
- GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP])
- GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR])
- GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR])
- GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R])
- GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN])
- GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN])
- GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR])
- GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR])
- GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR])
- GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP])
- GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP])
- GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP])
- GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR])
- GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN])
- GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK])
- GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN])
- GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP])
- GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
- GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
- GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R])
- GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
- GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
- HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
+ HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO])
HAVE_FFSL=1; AC_SUBST([HAVE_FFSL])
HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL])
- HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR])
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
@@ -102,8 +120,12 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
+ HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP])
+ HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP])
+ HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP])
HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP])
+ REPLACE_FFSLL=0; AC_SUBST([REPLACE_FFSLL])
REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR])
REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY])
@@ -117,6 +139,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
+ REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP])
REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R])
])