From 5111c57c3710b53e1db01fd58afe85292b882a47 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 4 Nov 2000 22:07:50 +0000 Subject: [PATCH] (AC_FUNC_FNMATCH): Add a test to detect the d*/*1 vs d/s/1 bug. Add a couple more test cases to catch bugs in glibc 2.1.95. Include fnmatch.h unconditionally Mention the GNU C library. From Paul Eggert. --- acfunctions.m4 | 24 +++++++++++------------- lib/autoconf/functions.m4 | 24 +++++++++++------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/acfunctions.m4 b/acfunctions.m4 index 41c5cb22..04da6ff7 100644 --- a/acfunctions.m4 +++ b/acfunctions.m4 @@ -343,20 +343,18 @@ fi # --------------- # We look for fnmatch.h to avoid that the test fails in C++. AC_DEFUN([AC_FUNC_FNMATCH], -[AC_CHECK_HEADERS(fnmatch.h) -AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works, -# Some versions of Solaris or SCO have a broken fnmatch function. +[AC_CACHE_CHECK(for working GNU-style fnmatch, ac_cv_func_fnmatch_works, +# Some versions of Solaris, SCO, and the GNU C Library +# have a broken or incompatible fnmatch. # So we run a test program. If we are cross-compiling, take no chance. -# Thanks to John Oleynick and Franc,ois Pinard for this test. -[AC_TRY_RUN( -[#if HAVE_FNMATCH_H -# include -#endif - -int -main () -{ - exit (fnmatch ("a*", "abc", 0) != 0); +# Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test. +[AC_TRY_RUN([#include +main() { + exit (fnmatch ("a*", "abc", 0) != 0 + || fnmatch("d*/*1", "d/s/1", FNM_FILE_NAME) != FNM_NOMATCH + || fnmatch("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR) != 0 + || fnmatch("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) != 0 + || fnmatch("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR) != 0); }], ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no, ac_cv_func_fnmatch_works=no)]) diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index 41c5cb22..04da6ff7 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -343,20 +343,18 @@ fi # --------------- # We look for fnmatch.h to avoid that the test fails in C++. AC_DEFUN([AC_FUNC_FNMATCH], -[AC_CHECK_HEADERS(fnmatch.h) -AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works, -# Some versions of Solaris or SCO have a broken fnmatch function. +[AC_CACHE_CHECK(for working GNU-style fnmatch, ac_cv_func_fnmatch_works, +# Some versions of Solaris, SCO, and the GNU C Library +# have a broken or incompatible fnmatch. # So we run a test program. If we are cross-compiling, take no chance. -# Thanks to John Oleynick and Franc,ois Pinard for this test. -[AC_TRY_RUN( -[#if HAVE_FNMATCH_H -# include -#endif - -int -main () -{ - exit (fnmatch ("a*", "abc", 0) != 0); +# Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test. +[AC_TRY_RUN([#include +main() { + exit (fnmatch ("a*", "abc", 0) != 0 + || fnmatch("d*/*1", "d/s/1", FNM_FILE_NAME) != FNM_NOMATCH + || fnmatch("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR) != 0 + || fnmatch("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) != 0 + || fnmatch("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR) != 0); }], ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no, ac_cv_func_fnmatch_works=no)])