1# fnmatch_h.m4 serial 4 2dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. 3dnl This file is free software; the Free Software Foundation 4dnl gives unlimited permission to copy and/or distribute it, 5dnl with or without modifications, as long as this notice is preserved. 6 7dnl From Bruno Haible. 8 9AC_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 52dnl Unconditionally enables the replacement of <fnmatch.h>. 53AC_DEFUN([gl_REPLACE_FNMATCH_H], 54[ 55 AC_REQUIRE([gl_FNMATCH_H_DEFAULTS]) 56 FNMATCH_H='fnmatch.h' 57 AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"]) 58]) 59 60AC_DEFUN([gl_FNMATCH_MODULE_INDICATOR], 61[ 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]) 67]) 68 69AC_DEFUN([gl_FNMATCH_H_DEFAULTS], 70[ 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]) 75]) 76