1 # fnmatch_h.m4 serial 4
2 dnl Copyright (C) 2009-2018 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.
9 AC_DEFUN_ONCE([gl_FNMATCH_H],
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])
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])
22 if test $ac_cv_header_fnmatch_h = yes; then
27 AC_SUBST([HAVE_FNMATCH_H])
29 m4_ifdef([gl_POSIXCHECK],
30 [FNMATCH_H=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.
36 if test $ac_cv_header_fnmatch_h != yes; then
37 dnl Provide a substitute <fnmatch.h> file.
43 AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"])
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>
52 dnl Unconditionally enables the replacement of <fnmatch.h>.
53 AC_DEFUN([gl_REPLACE_FNMATCH_H],
55 AC_REQUIRE([gl_FNMATCH_H_DEFAULTS])
57 AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"])
60 AC_DEFUN([gl_FNMATCH_MODULE_INDICATOR],
62 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
63 AC_REQUIRE([gl_FNMATCH_H_DEFAULTS])
64 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
65 dnl Define it also as a C macro, for the benefit of the unit tests.
66 gl_MODULE_INDICATOR_FOR_TESTS([$1])
69 AC_DEFUN([gl_FNMATCH_H_DEFAULTS],
71 GNULIB_FNMATCH=0; AC_SUBST([GNULIB_FNMATCH])
72 dnl Assume POSIX behavior unless another module says otherwise.
73 HAVE_FNMATCH=1; AC_SUBST([HAVE_FNMATCH])
74 REPLACE_FNMATCH=0; AC_SUBST([REPLACE_FNMATCH])