Move some declarations from acl.h to acl-internal.h.
[gnulib.git] / m4 / memmem.m4
index 383ed4b..d8c1230 100644 (file)
@@ -1,4 +1,4 @@
-# memmem.m4 serial 10
+# memmem.m4 serial 12
 dnl Copyright (C) 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -49,9 +49,27 @@ AC_DEFUN([gl_FUNC_MEMMEM],
     /* Check for empty needle behavior.  */
     return !result || !memmem ("a", 1, 0, 0);]])],
        [gl_cv_func_memmem_works=yes], [gl_cv_func_memmem_works=no],
-       [dnl pessimistically assume the worst, since even glibc 2.6.1
-        dnl has quadratic complexity in its memmem
-        gl_cv_func_memmem_works="guessing no"])])
+       [dnl Only glibc >= 2.9 and cygwin >= 1.7.0 are known to have a
+        dnl memmem that works in linear time.
+        AC_EGREP_CPP([Lucky user],
+          [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 9) || (__GLIBC__ > 2)
+  Lucky user
+ #endif
+#endif
+#ifdef __CYGWIN__
+ #include <cygwin/version.h>
+ #if CYGWIN_VERSION_DLL_MAJOR >= 1007
+  Lucky user
+ #endif
+#endif
+          ],
+          [gl_cv_func_memmem_works=yes],
+          [gl_cv_func_memmem_works="guessing no"])
+       ])
+      ])
     if test "$gl_cv_func_memmem_works" != yes; then
       REPLACE_MEMMEM=1
       AC_LIBOBJ([memmem])