# define MAP_FAILED ((void *) -1)
#endif
-/* Enable system fnmatch only on systems where we know it works:
- currently glibc-based systems and Solaris. One could add more, but
- fnmatch is not that large, so it might be better to play it
- safe. */
-#if defined __GLIBC__ && __GLIBC__ >= 2
-# define SYSTEM_FNMATCH
-#endif
-#ifdef solaris
-# define SYSTEM_FNMATCH
-#endif
+/* Enable system fnmatch only on systems where fnmatch.h is usable and
+ which are known to have a non-broken fnmatch implementation.
+ Currently those include glibc-based systems and Solaris. One could
+ add more, but fnmatch is not that large, so it might be better to
+ play it safe. */
+#ifdef HAVE_FNMATCH_H
+# if defined __GLIBC__ && __GLIBC__ >= 2
+# define SYSTEM_FNMATCH
+# endif
+# ifdef solaris
+# define SYSTEM_FNMATCH
+# endif
+#endif /* HAVE_FNMATCH_H */
#ifdef SYSTEM_FNMATCH
# include <fnmatch.h>