summaryrefslogtreecommitdiffstats
path: root/gl/m4/strcasestr.m4
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2021-11-17 01:05:54 +0100
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-07-24 19:35:11 +0200
commita405fc138596f552581d2011fd6de02d5c8186c4 (patch)
tree4c084700b5cb5e9fcedf982a2d921bbc41d9935a /gl/m4/strcasestr.m4
parent9f2a9ca3d72023ff9b5707d1872c54d65edc9017 (diff)
downloadmonitoring-plugins-a405fc138596f552581d2011fd6de02d5c8186c4.tar.gz
Sync with the latest Gnulib code (1a268176f)
Diffstat (limited to 'gl/m4/strcasestr.m4')
-rw-r--r--gl/m4/strcasestr.m461
1 files changed, 37 insertions, 24 deletions
diff --git a/gl/m4/strcasestr.m4 b/gl/m4/strcasestr.m4
index 8681a6a4..6939144b 100644
--- a/gl/m4/strcasestr.m4
+++ b/gl/m4/strcasestr.m4
@@ -1,5 +1,5 @@
1# strcasestr.m4 serial 21 1# strcasestr.m4 serial 28
2dnl Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2007-2021 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
7dnl Check that strcasestr is present and works. 7dnl Check that strcasestr is present and works.
8AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], 8AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE],
9[ 9[
10 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) 10 AC_REQUIRE([gl_STRING_H_DEFAULTS])
11 11
12 dnl Persuade glibc <string.h> to declare strcasestr(). 12 dnl Persuade glibc <string.h> to declare strcasestr().
13 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) 13 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
@@ -17,28 +17,38 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE],
17 if test $ac_cv_func_strcasestr = no; then 17 if test $ac_cv_func_strcasestr = no; then
18 HAVE_STRCASESTR=0 18 HAVE_STRCASESTR=0
19 else 19 else
20 if test "$gl_cv_func_memchr_works" != yes; then 20 if test $REPLACE_MEMCHR = 1; then
21 REPLACE_STRCASESTR=1 21 REPLACE_STRCASESTR=1
22 else 22 else
23 dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092. 23 dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092
24 dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637.
24 AC_CACHE_CHECK([whether strcasestr works], 25 AC_CACHE_CHECK([whether strcasestr works],
25 [gl_cv_func_strcasestr_works_always], 26 [gl_cv_func_strcasestr_works_always],
26 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 27 [AC_RUN_IFELSE(
27#include <string.h> /* for strcasestr */ 28 [AC_LANG_PROGRAM([[
29#include <string.h> /* for __GNU_LIBRARY__, strcasestr */
30#ifdef __GNU_LIBRARY__
31 #include <features.h>
32 #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28
33 Unlucky user
34 #endif
35#endif
28#define P "_EF_BF_BD" 36#define P "_EF_BF_BD"
29#define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P 37#define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P
30#define NEEDLE P P P P P 38#define NEEDLE P P P P P
31]], [[return !!strcasestr (HAYSTACK, NEEDLE); 39]],
32 ]])], 40 [[return !!strcasestr (HAYSTACK, NEEDLE);
33 [gl_cv_func_strcasestr_works_always=yes], 41 ]])],
34 [gl_cv_func_strcasestr_works_always=no], 42 [gl_cv_func_strcasestr_works_always=yes],
35 [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not 43 [gl_cv_func_strcasestr_works_always=no],
36 dnl affected, since it uses different source code for strcasestr 44 [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not
37 dnl than glibc. 45 dnl affected, since it uses different source code for strcasestr
38 dnl Assume that it works on all other platforms, even if it is not 46 dnl than glibc.
39 dnl linear. 47 dnl Assume that it works on all other platforms, even if it is not
40 AC_EGREP_CPP([Lucky user], 48 dnl linear.
41 [ 49 AC_EGREP_CPP([Lucky user],
50 [
51#include <string.h> /* for __GNU_LIBRARY__ */
42#ifdef __GNU_LIBRARY__ 52#ifdef __GNU_LIBRARY__
43 #include <features.h> 53 #include <features.h>
44 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ 54 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \
@@ -53,10 +63,10 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE],
53#else 63#else
54 Lucky user 64 Lucky user
55#endif 65#endif
56 ], 66 ],
57 [gl_cv_func_strcasestr_works_always="guessing yes"], 67 [gl_cv_func_strcasestr_works_always="guessing yes"],
58 [gl_cv_func_strcasestr_works_always="guessing no"]) 68 [gl_cv_func_strcasestr_works_always="$gl_cross_guess_normal"])
59 ]) 69 ])
60 ]) 70 ])
61 case "$gl_cv_func_strcasestr_works_always" in 71 case "$gl_cv_func_strcasestr_works_always" in
62 *yes) ;; 72 *yes) ;;
@@ -80,7 +90,7 @@ AC_DEFUN([gl_FUNC_STRCASESTR],
80#include <string.h> /* for strcasestr */ 90#include <string.h> /* for strcasestr */
81#include <stdlib.h> /* for malloc */ 91#include <stdlib.h> /* for malloc */
82#include <unistd.h> /* for alarm */ 92#include <unistd.h> /* for alarm */
83static void quit (int sig) { exit (sig + 128); } 93static void quit (int sig) { _exit (sig + 128); }
84]], [[ 94]], [[
85 int result = 0; 95 int result = 0;
86 size_t m = 1000000; 96 size_t m = 1000000;
@@ -102,6 +112,9 @@ static void quit (int sig) { exit (sig + 128); }
102 if (!strcasestr (haystack, needle)) 112 if (!strcasestr (haystack, needle))
103 result |= 1; 113 result |= 1;
104 } 114 }
115 /* Free allocated memory, in case some sanitizer is watching. */
116 free (haystack);
117 free (needle);
105 return result; 118 return result;
106 ]])], 119 ]])],
107 [gl_cv_func_strcasestr_linear=yes], [gl_cv_func_strcasestr_linear=no], 120 [gl_cv_func_strcasestr_linear=yes], [gl_cv_func_strcasestr_linear=no],
@@ -124,7 +137,7 @@ static void quit (int sig) { exit (sig + 128); }
124#endif 137#endif
125 ], 138 ],
126 [gl_cv_func_strcasestr_linear="guessing yes"], 139 [gl_cv_func_strcasestr_linear="guessing yes"],
127 [gl_cv_func_strcasestr_linear="guessing no"]) 140 [gl_cv_func_strcasestr_linear="$gl_cross_guess_normal"])
128 ]) 141 ])
129 ]) 142 ])
130 case "$gl_cv_func_strcasestr_linear" in 143 case "$gl_cv_func_strcasestr_linear" in