Import new gnulib.
This commit is contained in:
parent
93cd84df63
commit
053cfcddf1
255 changed files with 12578 additions and 4948 deletions
31
m4/memchr.m4
31
m4/memchr.m4
|
@ -1,5 +1,5 @@
|
|||
# memchr.m4 serial 9
|
||||
dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc.
|
||||
# memchr.m4 serial 12
|
||||
dnl Copyright (C) 2002-2004, 2009-2013 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.
|
||||
|
@ -11,10 +11,16 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
|
|||
AC_CHECK_HEADERS_ONCE([sys/mman.h])
|
||||
AC_CHECK_FUNCS_ONCE([mprotect])
|
||||
|
||||
dnl These days, we assume memchr is present. But just in case...
|
||||
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
|
||||
AC_CHECK_FUNCS_ONCE([memchr])
|
||||
if test $ac_cv_func_memchr = yes; then
|
||||
m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [
|
||||
dnl These days, we assume memchr is present. But if support for old
|
||||
dnl platforms is desired:
|
||||
AC_CHECK_FUNCS_ONCE([memchr])
|
||||
if test $ac_cv_func_memchr = no; then
|
||||
HAVE_MEMCHR=0
|
||||
fi
|
||||
])
|
||||
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
|
||||
|
@ -35,6 +41,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
|
|||
# endif
|
||||
#endif
|
||||
]], [[
|
||||
int result = 0;
|
||||
char *fence = NULL;
|
||||
#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
|
||||
# if HAVE_MAP_ANONYMOUS
|
||||
|
@ -58,26 +65,20 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
|
|||
if (fence)
|
||||
{
|
||||
if (memchr (fence, 0, 0))
|
||||
return 1;
|
||||
result |= 1;
|
||||
strcpy (fence - 9, "12345678");
|
||||
if (memchr (fence - 9, 0, 79) != fence - 1)
|
||||
return 2;
|
||||
result |= 2;
|
||||
if (memchr (fence - 1, 0, 3) != fence - 1)
|
||||
return 3;
|
||||
result |= 4;
|
||||
}
|
||||
return 0;
|
||||
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
|
||||
else
|
||||
HAVE_MEMCHR=0
|
||||
fi
|
||||
if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
|
||||
AC_LIBOBJ([memchr])
|
||||
gl_PREREQ_MEMCHR
|
||||
fi
|
||||
])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue