summaryrefslogtreecommitdiff
path: root/gnulib-m4/memchr.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib-m4/memchr.m4')
-rw-r--r--gnulib-m4/memchr.m427
1 files changed, 13 insertions, 14 deletions
diff --git a/gnulib-m4/memchr.m4 b/gnulib-m4/memchr.m4
index 1194bac..ab773b8 100644
--- a/gnulib-m4/memchr.m4
+++ b/gnulib-m4/memchr.m4
@@ -1,5 +1,5 @@
-# memchr.m4 serial 7
-dnl Copyright (C) 2002, 2003, 2004, 2009 Free Software Foundation, Inc.
+# memchr.m4 serial 8
+dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -13,12 +13,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
dnl These days, we assume memchr is present. But just in case...
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- AC_REPLACE_FUNCS([memchr])
- if test $ac_cv_func_memchr = no; then
- gl_PREREQ_MEMCHR
- REPLACE_MEMCHR=1
- fi
-
+ AC_CHECK_FUNCS_ONCE([memchr])
if test $ac_cv_func_memchr = yes; then
# Detect platform-specific bugs in some versions of glibc:
# memchr should not dereference anything with length 0
@@ -53,11 +48,11 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
{
int pagesize = getpagesize ();
char *two_pages =
- (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
- flags, fd, 0);
+ (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
+ flags, fd, 0);
if (two_pages != (char *)(-1)
- && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
- fence = two_pages + pagesize;
+ && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
+ fence = two_pages + pagesize;
}
#endif
if (fence)
@@ -73,10 +68,14 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
[dnl Be pessimistic for now.
gl_cv_func_memchr_works="guessing no"])])
if test "$gl_cv_func_memchr_works" != yes; then
- gl_PREREQ_MEMCHR
REPLACE_MEMCHR=1
- AC_LIBOBJ([memchr])
fi
+ else
+ HAVE_MEMCHR=0
+ fi
+ if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
+ AC_LIBOBJ([memchr])
+ gl_PREREQ_MEMCHR
fi
])