]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gnulib/import/m4/strings_h.m4
Update gnulib
[thirdparty/binutils-gdb.git] / gnulib / import / m4 / strings_h.m4
CommitLineData
32e2770e 1# Configure a replacement for <strings.h>.
dc6c21da 2# serial 9
32e2770e 3
dc6c21da 4# Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc.
32e2770e
MF
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
dc6c21da 9AC_DEFUN_ONCE([gl_STRINGS_H],
32e2770e 10[
dc6c21da
TT
11 dnl Ensure to expand the default settings once only, before all statements
12 dnl that occur in other macros.
13 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
32e2770e
MF
14
15 gl_CHECK_NEXT_HEADERS([strings.h])
16 if test $ac_cv_header_strings_h = yes; then
17 HAVE_STRINGS_H=1
18 else
19 HAVE_STRINGS_H=0
20 fi
21 AC_SUBST([HAVE_STRINGS_H])
22
23 dnl Check for declarations of anything we want to poison if the
24 dnl corresponding gnulib module is not in use.
25 gl_WARN_ON_USE_PREPARE([[
26 /* Minix 3.1.8 has a bug: <sys/types.h> must be included before
27 <strings.h>. */
28 #include <sys/types.h>
29 #include <strings.h>
30 ]], [ffs strcasecmp strncasecmp])
31])
32
dc6c21da
TT
33# gl_STRINGS_MODULE_INDICATOR([modulename])
34# sets the shell variable that indicates the presence of the given module
35# to a C preprocessor expression that will evaluate to 1.
36# This macro invocation must not occur in macros that are AC_REQUIREd.
32e2770e
MF
37AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
38[
dc6c21da
TT
39 dnl Ensure to expand the default settings once only.
40 gl_STRINGS_H_REQUIRE_DEFAULTS
32e2770e
MF
41 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
42])
43
dc6c21da
TT
44# Initializes the default values for AC_SUBSTed shell variables.
45# This macro must not be AC_REQUIREd. It must only be invoked, and only
46# outside of macros or in macros that are not AC_REQUIREd.
47AC_DEFUN([gl_STRINGS_H_REQUIRE_DEFAULTS],
48[
49 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [
50 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS])
51 ])
52 m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS])
53 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
54])
55
56AC_DEFUN([gl_STRINGS_H_DEFAULTS],
32e2770e 57[
32e2770e
MF
58 dnl Assume proper GNU behavior unless another module says otherwise.
59 HAVE_FFS=1; AC_SUBST([HAVE_FFS])
60 HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP])
61 HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
62])