[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AC_FUNC_MATCH: use a `run' test to detect bugs in C libraries

From: Jim Meyering
Subject: AC_FUNC_MATCH: use a `run' test to detect bugs in C libraries
Date: 03 Nov 2000 12:03:28 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7

The only difference between this function
and the one in tar-1.13.18 is that here HAVE_FNMATCH is quoted:

        * acfunctions.m4 (AC_FUNC_FNMATCH): Add a `run' 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.
        Define HAVE_FNMATCH if all tests pass.
        From Paul Eggert.

Index: acfunctions.m4
RCS file: /cvs/autoconf/acfunctions.m4,v
retrieving revision 1.13
diff -u -p -r1.13 acfunctions.m4
--- acfunctions.m4      2000/10/27 23:10:18     1.13
+++ acfunctions.m4      2000/11/03 10:29:36
@@ -342,16 +342,26 @@ fi
 # ---------------
 # We look for fnmatch.h to avoid that the test fails in C++.
-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.
-# include <fnmatch.h>
+# Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test.
+[AC_TRY_RUN([#include <fnmatch.h>
+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,
+if test $ac_cv_func_fnmatch_works = yes; then
 main ()

reply via email to

[Prev in Thread] Current Thread [Next in Thread]