summaryrefslogtreecommitdiff
path: root/gnulib-m4/memchr.m4
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-02 10:30:25 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-12-02 10:30:25 +0100
commit44a3eaeba04ef78835ca741592c376428ada5f71 (patch)
tree29cc935fd475678dcbe38972bfa77fdc68ffb10d /gnulib-m4/memchr.m4
parent6b73edd95d603e27d55d4905134ac1327d426534 (diff)
New upstream version 0.9.8upstream/0.9.8
Diffstat (limited to 'gnulib-m4/memchr.m4')
-rw-r--r--gnulib-m4/memchr.m433
1 files changed, 22 insertions, 11 deletions
diff --git a/gnulib-m4/memchr.m4 b/gnulib-m4/memchr.m4
index 25d32f0e..0cca69d6 100644
--- a/gnulib-m4/memchr.m4
+++ b/gnulib-m4/memchr.m4
@@ -1,11 +1,13 @@
-# memchr.m4 serial 12
-dnl Copyright (C) 2002-2004, 2009-2016 Free Software Foundation, Inc.
+# memchr.m4 serial 13
+dnl Copyright (C) 2002-2004, 2009-2017 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.
AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
[
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
dnl Check for prerequisites for memory fence checks.
gl_FUNC_MMAP_ANON
AC_CHECK_HEADERS_ONCE([sys/mman.h])
@@ -23,10 +25,10 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
if test $HAVE_MEMCHR = 1; then
# Detect platform-specific bugs in some versions of glibc:
# memchr should not dereference anything with length 0
- # http://bugzilla.redhat.com/499689
+ # https://bugzilla.redhat.com/show_bug.cgi?id=499689
# memchr should not dereference overestimated length after a match
- # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737
- # http://sourceware.org/bugzilla/show_bug.cgi?id=10162
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=10162
# Assume that memchr works on platforms that lack mprotect.
AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
@@ -73,12 +75,21 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
result |= 4;
}
return result;
-]])], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no],
- [dnl Be pessimistic for now.
- gl_cv_func_memchr_works="guessing no"])])
- if test "$gl_cv_func_memchr_works" != yes; then
- REPLACE_MEMCHR=1
- fi
+]])],
+ [gl_cv_func_memchr_works=yes],
+ [gl_cv_func_memchr_works=no],
+ [case "$host_os" in
+ # Guess yes on native Windows.
+ mingw*) gl_cv_func_memchr_works="guessing yes" ;;
+ # Be pessimistic for now.
+ *) gl_cv_func_memchr_works="guessing no" ;;
+ esac
+ ])
+ ])
+ case "$gl_cv_func_memchr_works" in
+ *yes) ;;
+ *) REPLACE_MEMCHR=1 ;;
+ esac
fi
])