Debian Codegraph @

m4/fnmatch_h.m4

raw
1 # fnmatch_h.m4 serial 8
2 dnl Copyright (C) 2009-2022 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 dnl From Bruno Haible.
8
9 AC_DEFUN_ONCE([gl_FNMATCH_H],
10 [
11 AC_REQUIRE([gl_FNMATCH_H_DEFAULTS])
12 m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
13 AC_CHECK_HEADERS_ONCE([fnmatch.h])
14 gl_CHECK_NEXT_HEADERS([fnmatch.h])
15
16 dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc.
17 dnl This is only needed if gl_fnmatch_required = GNU. It would be possible
18 dnl to avoid this dependency for gl_FUNC_FNMATCH_POSIX by putting
19 dnl gl_FUNC_FNMATCH_GNU into a separate .m4 file.
20 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
21
22 if test $ac_cv_header_fnmatch_h = yes; then
23 HAVE_FNMATCH_H=1
24 else
25 HAVE_FNMATCH_H=0
26 fi
27 AC_SUBST([HAVE_FNMATCH_H])
28
29 m4_ifdef([gl_POSIXCHECK],
30 [GL_GENERATE_FNMATCH_H=true],
31 [GL_GENERATE_FNMATCH_H=false
32 if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then
33 dnl Override <fnmatch.h> always, to support the C++ GNULIB_NAMESPACE.
34 GL_GENERATE_FNMATCH_H=true
35 else
36 if test $ac_cv_header_fnmatch_h != yes; then
37 dnl Provide a substitute <fnmatch.h> file.
38 GL_GENERATE_FNMATCH_H=true
39 fi
40 fi
41 ])
42
43 dnl Check for declarations of anything we want to poison if the
44 dnl corresponding gnulib module is not in use.
45 gl_WARN_ON_USE_PREPARE([[#include <fnmatch.h>
46 ]],
47 [fnmatch])
48 ])
49
50 dnl Unconditionally enables the replacement of <fnmatch.h>.
51 AC_DEFUN([gl_REPLACE_FNMATCH_H],
52 [
53 gl_FNMATCH_H_REQUIRE_DEFAULTS
54 GL_GENERATE_FNMATCH_H=true
55 ])
56
57 # gl_FNMATCH_MODULE_INDICATOR([modulename])
58 # sets the shell variable that indicates the presence of the given module
59 # to a C preprocessor expression that will evaluate to 1.
60 # This macro invocation must not occur in macros that are AC_REQUIREd.
61 AC_DEFUN([gl_FNMATCH_MODULE_INDICATOR],
62 [
63 dnl Ensure to expand the default settings once only.
64 gl_FNMATCH_H_REQUIRE_DEFAULTS
65 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
66 dnl Define it also as a C macro, for the benefit of the unit tests.
67 gl_MODULE_INDICATOR_FOR_TESTS([$1])
68 ])
69
70 # Initializes the default values for AC_SUBSTed shell variables.
71 # This macro must not be AC_REQUIREd. It must only be invoked, and only
72 # outside of macros or in macros that are not AC_REQUIREd.
73 AC_DEFUN([gl_FNMATCH_H_REQUIRE_DEFAULTS],
74 [
75 m4_defun(GL_MODULE_INDICATOR_PREFIX[_FNMATCH_H_MODULE_INDICATOR_DEFAULTS], [
76 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FNMATCH])
77 ])
78 m4_require(GL_MODULE_INDICATOR_PREFIX[_FNMATCH_H_MODULE_INDICATOR_DEFAULTS])
79 AC_REQUIRE([gl_FNMATCH_H_DEFAULTS])
80 ])
81
82 AC_DEFUN([gl_FNMATCH_H_DEFAULTS],
83 [
84 dnl Assume POSIX behavior unless another module says otherwise.
85 HAVE_FNMATCH=1; AC_SUBST([HAVE_FNMATCH])
86 REPLACE_FNMATCH=0; AC_SUBST([REPLACE_FNMATCH])
87 ])