1 | # fnmatch_h.m4 serial 7
|
---|
2 | dnl Copyright (C) 2009-2021 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 | [FNMATCH_H=fnmatch.h],
|
---|
31 | [FNMATCH_H=''
|
---|
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 | FNMATCH_H=fnmatch.h
|
---|
35 | else
|
---|
36 | if test $ac_cv_header_fnmatch_h != yes; then
|
---|
37 | dnl Provide a substitute <fnmatch.h> file.
|
---|
38 | FNMATCH_H=fnmatch.h
|
---|
39 | fi
|
---|
40 | fi
|
---|
41 | ])
|
---|
42 | AC_SUBST([FNMATCH_H])
|
---|
43 | AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"])
|
---|
44 |
|
---|
45 | dnl Check for declarations of anything we want to poison if the
|
---|
46 | dnl corresponding gnulib module is not in use.
|
---|
47 | gl_WARN_ON_USE_PREPARE([[#include <fnmatch.h>
|
---|
48 | ]],
|
---|
49 | [fnmatch])
|
---|
50 | ])
|
---|
51 |
|
---|
52 | dnl Unconditionally enables the replacement of <fnmatch.h>.
|
---|
53 | AC_DEFUN([gl_REPLACE_FNMATCH_H],
|
---|
54 | [
|
---|
55 | gl_FNMATCH_H_REQUIRE_DEFAULTS
|
---|
56 | FNMATCH_H='fnmatch.h'
|
---|
57 | AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"])
|
---|
58 | ])
|
---|
59 |
|
---|
60 | # gl_FNMATCH_MODULE_INDICATOR([modulename])
|
---|
61 | # sets the shell variable that indicates the presence of the given module
|
---|
62 | # to a C preprocessor expression that will evaluate to 1.
|
---|
63 | # This macro invocation must not occur in macros that are AC_REQUIREd.
|
---|
64 | AC_DEFUN([gl_FNMATCH_MODULE_INDICATOR],
|
---|
65 | [
|
---|
66 | dnl Ensure to expand the default settings once only.
|
---|
67 | gl_FNMATCH_H_REQUIRE_DEFAULTS
|
---|
68 | gl_MODULE_INDICATOR_SET_VARIABLE([$1])
|
---|
69 | dnl Define it also as a C macro, for the benefit of the unit tests.
|
---|
70 | gl_MODULE_INDICATOR_FOR_TESTS([$1])
|
---|
71 | ])
|
---|
72 |
|
---|
73 | # Initializes the default values for AC_SUBSTed shell variables.
|
---|
74 | # This macro must not be AC_REQUIREd. It must only be invoked, and only
|
---|
75 | # outside of macros or in macros that are not AC_REQUIREd.
|
---|
76 | AC_DEFUN([gl_FNMATCH_H_REQUIRE_DEFAULTS],
|
---|
77 | [
|
---|
78 | m4_defun(GL_MODULE_INDICATOR_PREFIX[_FNMATCH_H_MODULE_INDICATOR_DEFAULTS], [
|
---|
79 | gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FNMATCH])
|
---|
80 | ])
|
---|
81 | m4_require(GL_MODULE_INDICATOR_PREFIX[_FNMATCH_H_MODULE_INDICATOR_DEFAULTS])
|
---|
82 | AC_REQUIRE([gl_FNMATCH_H_DEFAULTS])
|
---|
83 | ])
|
---|
84 |
|
---|
85 | AC_DEFUN([gl_FNMATCH_H_DEFAULTS],
|
---|
86 | [
|
---|
87 | dnl Assume POSIX behavior unless another module says otherwise.
|
---|
88 | HAVE_FNMATCH=1; AC_SUBST([HAVE_FNMATCH])
|
---|
89 | REPLACE_FNMATCH=0; AC_SUBST([REPLACE_FNMATCH])
|
---|
90 | ])
|
---|