summaryrefslogtreecommitdiff
path: root/m4/fnmatch_h.m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2018-08-14 02:00:05 +0200
committerBruno Haible <bruno@clisp.org>2018-08-14 02:10:45 +0200
commitee35681421a303546f158507d8b18a5cc8e28896 (patch)
tree202fa6dd82562d4c5f3ed87349b211af8b4b0cdb /m4/fnmatch_h.m4
parent5ff4c9ba8b2002538380e3930dfc6b0bd5f4b297 (diff)
downloadgnulib-ee35681421a303546f158507d8b18a5cc8e28896.tar.gz
fnmatch, fnmatch-gnu: Fix compilation error on Mac OS X.
Reported by Jeroen Meijer <jjgmeijer@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00046.html> and by Paul J. Lucas <paul@lucasmail.org> in <https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00069.html>. * m4/fnmatch_h.m4 (gl_FNMATCH_H): Define through AC_DEFUN_ONCE. (gl_FNMATCH_H_GNU): New macro. * m4/fnmatch.m4 (gl_FUNC_FNMATCH_GNU): Require gl_FNMATCH_H_GNU.
Diffstat (limited to 'm4/fnmatch_h.m4')
-rw-r--r--m4/fnmatch_h.m426
1 files changed, 24 insertions, 2 deletions
diff --git a/m4/fnmatch_h.m4 b/m4/fnmatch_h.m4
index c40d0a713b..f36557822a 100644
--- a/m4/fnmatch_h.m4
+++ b/m4/fnmatch_h.m4
@@ -1,4 +1,4 @@
-# fnmatch_h.m4 serial 2
+# fnmatch_h.m4 serial 3
dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,8 @@ dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
-AC_DEFUN([gl_FNMATCH_H],
+# Request a POSIX compliant <fnmatch.h> include file.
+AC_DEFUN_ONCE([gl_FNMATCH_H],
[
AC_REQUIRE([gl_FNMATCH_H_DEFAULTS])
m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
@@ -49,6 +50,27 @@ AC_DEFUN([gl_FNMATCH_H],
[fnmatch])
])
+# Request a POSIX compliant <fnmatch.h> include file with GNU extensions.
+AC_DEFUN([gl_FNMATCH_H_GNU],
+[
+ AC_REQUIRE([gl_FNMATCH_H])
+ if test -z "$FNMATCH_H"; then
+ AC_CACHE_CHECK([whether <fnmatch.h> has the GNU extensions],
+ [gl_cv_header_fnmatch_h_gnu],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <fnmatch.h>]],
+ [[int gnu_flags = FNM_FILE_NAME | FNM_LEADING_DIR | FNM_CASEFOLD | FNM_EXTMATCH;]])],
+ [gl_cv_header_fnmatch_h_gnu=yes],
+ [gl_cv_header_fnmatch_h_gnu=no])
+ ])
+ if test $gl_cv_header_fnmatch_h_gnu != yes; then
+ FNMATCH_H=fnmatch.h
+ AM_CONDITIONAL([GL_GENERATE_FNMATCH_H], [test -n "$FNMATCH_H"])
+ fi
+ fi
+])
+
AC_DEFUN([gl_FNMATCH_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.