Debian Codegraph @

m4/strings_h.m4

raw
1 # strings_h.m4
2 # serial 14
3 dnl Copyright (C) 2007, 2009-2026 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 # Configure a replacement for <strings.h>.
10
11 AC_DEFUN_ONCE([gl_STRINGS_H],
12 [
13 dnl Ensure to expand the default settings once only, before all statements
14 dnl that occur in other macros.
15 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
16
17 gl_CHECK_NEXT_HEADERS([strings.h])
18 if test $ac_cv_header_strings_h = yes; then
19 HAVE_STRINGS_H=1
20 else
21 HAVE_STRINGS_H=0
22 fi
23 AC_SUBST([HAVE_STRINGS_H])
24
25 dnl Check for declarations of anything we want to poison if the
26 dnl corresponding gnulib module is not in use.
27 gl_WARN_ON_USE_PREPARE([[
28 /* Minix 3.1.8 has a bug: <sys/types.h> must be included before
29 <strings.h>. */
30 #include <sys/types.h>
31 #include <strings.h>
32 ]], [ffs strcasecmp strcasecmp_l strncasecmp strncasecmp_l])
33 ])
34
35 # gl_STRINGS_MODULE_INDICATOR([modulename])
36 # sets the shell variable that indicates the presence of the given module
37 # to a C preprocessor expression that will evaluate to 1.
38 # This macro invocation must not occur in macros that are AC_REQUIREd.
39 AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
40 [
41 dnl Ensure to expand the default settings once only.
42 gl_STRINGS_H_REQUIRE_DEFAULTS
43 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
44 ])
45
46 # Initializes the default values for AC_SUBSTed shell variables.
47 # This macro must not be AC_REQUIREd. It must only be invoked, and only
48 # outside of macros or in macros that are not AC_REQUIREd.
49 AC_DEFUN([gl_STRINGS_H_REQUIRE_DEFAULTS],
50 [
51 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [
52 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS])
53 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP])
54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP_L])
55 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP])
56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP_L])
57 ])
58 m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS])
59 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
60 ])
61
62 AC_DEFUN([gl_STRINGS_H_DEFAULTS],
63 [
64 dnl Assume proper GNU behavior unless another module says otherwise.
65 HAVE_FFS=1; AC_SUBST([HAVE_FFS])
66 HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP])
67 HAVE_STRCASECMP_L=1; AC_SUBST([HAVE_STRCASECMP_L])
68 HAVE_STRNCASECMP=1; AC_SUBST([HAVE_STRNCASECMP])
69 HAVE_STRNCASECMP_L=1; AC_SUBST([HAVE_STRNCASECMP_L])
70 HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
71 REPLACE_STRCASECMP=0; AC_SUBST([REPLACE_STRCASECMP])
72 REPLACE_STRCASECMP_L=0; AC_SUBST([REPLACE_STRCASECMP_L])
73 REPLACE_STRNCASECMP=0; AC_SUBST([REPLACE_STRNCASECMP])
74 REPLACE_STRNCASECMP_L=0; AC_SUBST([REPLACE_STRNCASECMP_L])
75 ])