3 # This is a modified version of autoconf's AC_FUNC_FNMATCH;
4 # it also checks for FNM_CASEFOLD or FNM_IGNORECASE.
6 # Copyright (C) 2000, 2001 Free Software Foundation, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 # We look for fnmatch.h to avoid that the test fails in C++.
26 AC_DEFUN([AC_FUNC_FNMATCH],
27 [AC_CACHE_CHECK([for working GNU-style fnmatch],
28 [ac_cv_func_fnmatch_works],
29 # Some versions of Solaris, SCO, and the GNU C Library
30 # have a broken or incompatible fnmatch.
31 # So we run a test program. If we are cross-compiling, take no chance.
32 # Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test.
33 [AC_RUN_IFELSE([AC_LANG_PROGRAM([@%:@include <fnmatch.h>],
34 [exit (fnmatch ("a*", "abc", 0) != 0
35 || fnmatch ("xxXX", "xXxX", FNM_CASEFOLD) != 0
36 || fnmatch ("d*/*1", "d/s/1", FNM_FILE_NAME) != FNM_NOMATCH
37 || fnmatch ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR) != 0
38 || fnmatch ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) != 0
39 || fnmatch ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR) != 0);])],
40 [ac_cv_func_fnmatch_works=yes],
41 [ac_cv_func_fnmatch_works=no],
42 [ac_cv_func_fnmatch_works=no])])
43 if test $ac_cv_func_fnmatch_works = yes; then
44 AC_DEFINE(HAVE_FNMATCH, 1,
45 [Define to 1 if your system has a working `fnmatch' function.])