diff options
author | Bruno Haible <bruno@clisp.org> | 2020-07-08 03:19:54 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-07-08 03:19:54 +0200 |
commit | 707090c9ed6a16bc4b152be300578761e34b2bed (patch) | |
tree | 285ceb1cfcf1caa1e8c759406631b8f37ccbf0b4 /m4 | |
parent | cfcb5fc6b95ca04bd3c8637d4027641d07c15cbe (diff) | |
download | gnulib-707090c9ed6a16bc4b152be300578761e34b2bed.tar.gz |
memchr: Remove support for some very old platforms.
* m4/memchr-obsolete.m4: Remove file.
* modules/memchr-obsolete: Remove file.
* m4/memchr.m4 (gl_FUNC_MEMCHR): Assume module 'memchr-obsolete' is
absent. Don't define HAVE_MEMCHR.
* lib/string.in.h (memchr): Assume HAVE_MEMCHR is 1.
* modules/memchr (Depends-on): Remove memchr-obsolete.
(configure.ac): Assume HAVE_MEMCHR is 1.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Don't initialize
HAVE_MEMCHR.
* modules/string (Makefile.am): Don't substitute HAVE_MEMCHR.
* doc/posix-functions/memchr.texi: Don't mention module
'memchr-obsolete'.
* m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Assume HAVE_MEMCHR is 1.
* m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Assume HAVE_MEMCHR is 1.
* modules/strnlen (Depends-on): Remove memchr-obsolete.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/memchr-obsolete.m4 | 11 | ||||
-rw-r--r-- | m4/memchr.m4 | 66 | ||||
-rw-r--r-- | m4/strcasestr.m4 | 4 | ||||
-rw-r--r-- | m4/string_h.m4 | 3 | ||||
-rw-r--r-- | m4/strstr.m4 | 4 |
5 files changed, 33 insertions, 55 deletions
diff --git a/m4/memchr-obsolete.m4 b/m4/memchr-obsolete.m4 deleted file mode 100644 index 7305a77e46..0000000000 --- a/m4/memchr-obsolete.m4 +++ /dev/null @@ -1,11 +0,0 @@ -# memchr-obsolete.m4 serial 1 -dnl Copyright (C) 2011-2020 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([gl_FUNC_MEMCHR_OBSOLETE], -[ - dnl The real code is in memchr.m4. - : -]) diff --git a/m4/memchr.m4 b/m4/memchr.m4 index 91eec88e09..81e8f985df 100644 --- a/m4/memchr.m4 +++ b/m4/memchr.m4 @@ -1,4 +1,4 @@ -# memchr.m4 serial 15 +# memchr.m4 serial 16 dnl Copyright (C) 2002-2004, 2009-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -14,26 +14,17 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], AC_CHECK_FUNCS_ONCE([mprotect]) AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - 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 - # https://bugzilla.redhat.com/show_bug.cgi?id=499689 - # memchr should not dereference overestimated length after a match - # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 - # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 - # memchr should cast the second argument to 'unsigned char'. - # This bug exists in Android 4.3. - # 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([[ + # Detect platform-specific bugs in some versions of glibc: + # memchr should not dereference anything with length 0 + # https://bugzilla.redhat.com/show_bug.cgi?id=499689 + # memchr should not dereference overestimated length after a match + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 + # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 + # memchr should cast the second argument to 'unsigned char'. + # This bug exists in Android 4.3. + # 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([[ #include <string.h> #if HAVE_SYS_MMAN_H # include <fcntl.h> @@ -87,23 +78,22 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], } return result; ]])], - [gl_cv_func_memchr_works=yes], - [gl_cv_func_memchr_works=no], - [case "$host_os" in - # Guess no on Android. - linux*-android*) gl_cv_func_memchr_works="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_memchr_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; - esac - ]) - ]) - case "$gl_cv_func_memchr_works" in - *yes) ;; - *) REPLACE_MEMCHR=1 ;; - esac - fi + [gl_cv_func_memchr_works=yes], + [gl_cv_func_memchr_works=no], + [case "$host_os" in + # Guess no on Android. + linux*-android*) gl_cv_func_memchr_works="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_memchr_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case "$gl_cv_func_memchr_works" in + *yes) ;; + *) REPLACE_MEMCHR=1 ;; + esac ]) # Prerequisites of lib/memchr.c. diff --git a/m4/strcasestr.m4 b/m4/strcasestr.m4 index 4c2275fc71..ee2287321d 100644 --- a/m4/strcasestr.m4 +++ b/m4/strcasestr.m4 @@ -1,4 +1,4 @@ -# strcasestr.m4 serial 25 +# strcasestr.m4 serial 26 dnl Copyright (C) 2005, 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], if test $ac_cv_func_strcasestr = no; then HAVE_STRCASESTR=0 else - if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then + if test $REPLACE_MEMCHR = 1; then REPLACE_STRCASESTR=1 else dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092 diff --git a/m4/string_h.m4 b/m4/string_h.m4 index cc51337f0d..516b346b31 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -5,7 +5,7 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 23 +# serial 24 # Written by Paul Eggert. @@ -87,7 +87,6 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO]) HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) - HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) diff --git a/m4/strstr.m4 b/m4/strstr.m4 index a2ec337f17..529110793c 100644 --- a/m4/strstr.m4 +++ b/m4/strstr.m4 @@ -1,4 +1,4 @@ -# strstr.m4 serial 21 +# strstr.m4 serial 22 dnl Copyright (C) 2008-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], [ AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MEMCHR]) - if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then + if test $REPLACE_MEMCHR = 1; then REPLACE_STRSTR=1 else dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092 |