From ee35681421a303546f158507d8b18a5cc8e28896 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 14 Aug 2018 02:00:05 +0200 Subject: [PATCH] fnmatch, fnmatch-gnu: Fix compilation error on Mac OS X. Reported by Jeroen Meijer in and by Paul J. Lucas in . * 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. --- ChangeLog | 13 ++++++++++++- m4/fnmatch.m4 | 3 ++- m4/fnmatch_h.m4 | 26 ++++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 33b1c35e48..1f39653aeb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2018-08-13 Bruno Haible + + fnmatch, fnmatch-gnu: Fix compilation error on Mac OS X. + Reported by Jeroen Meijer in + + and by Paul J. Lucas in + . + * 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. + 2018-08-11 Bruno Haible setlocale: Trivial simplification. @@ -11,7 +22,7 @@ 2018-08-10 Bruno Haible - fnmatch: Fix compilation error in C++ namespace mode on Mac OS X. + fnmatch-gnu: Fix compilation error in C++ namespace mode on Mac OS X. * modules/fnmatch-gnu (configure.ac): Invoke gl_MODULE_INDICATOR. * lib/fnmatch.in.h (fnmatch): Skip _GL_CXXALIASWARN if module 'fnmatch-gnu' is in use. diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4 index e6eb9f9d94..2dbfa04475 100644 --- a/m4/fnmatch.m4 +++ b/m4/fnmatch.m4 @@ -1,4 +1,4 @@ -# Check for fnmatch - serial 10. -*- coding: utf-8 -*- +# Check for fnmatch - serial 11. -*- coding: utf-8 -*- # Copyright (C) 2000-2007, 2009-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -135,6 +135,7 @@ AC_DEFUN([gl_FUNC_FNMATCH_GNU], [ m4_divert_text([INIT_PREPARE], [gl_fnmatch_required=GNU]) + AC_REQUIRE([gl_FNMATCH_H_GNU]) AC_REQUIRE([gl_FUNC_FNMATCH_POSIX]) ]) 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 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 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 has the GNU extensions], + [gl_cv_header_fnmatch_h_gnu], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[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. -- 2.39.5