From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id r8OUO0H2/GoYOhoAWB0awg (envelope-from ) for ; Tue, 17 Nov 2026 19:50:10 -0500 Received: by simark.ca (Postfix, from userid 112) id DA6CF1E091; Tue, 17 Nov 2026 19:50:09 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 288431E023 for ; Tue, 17 Nov 2026 19:50:08 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AE3D74BA2E3B for ; Wed, 18 Nov 2026 00:50:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE3D74BA2E3B Received: from mail.esperi.org.uk (icebox.esperi.org.uk [81.187.191.129]) by sourceware.org (Postfix) with ESMTPS id A93FF4BA2E15 for ; Wed, 18 Nov 2026 00:49:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A93FF4BA2E15 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=esperi.org.uk Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=esperi.org.uk ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A93FF4BA2E15 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=81.187.191.129 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794962979; cv=none; b=qtB7u3rE0OPrPTEldRa+ccMyorvzgq7Mp7WuS6VgDdXJpncGBkLkugTQKGE6suVzR/6vGJKeVuQXS0bHYizNc1+YwHsRGVHN6+Y0ejpsQ6EMpEBium0sxDkO8T/naSYHvE0Y9QndFbc2HIHEs+xQ6vO7rdGYVR34Bw0bGYj9W3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1794962979; c=relaxed/simple; bh=LJuhBGnX6ROBBPn7xEDiPm4vaRVbeNxivki4catFZW8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=l8VcmhlwSNJhTaOKjdTfRfd/C7nQPdu+c6VxTiR9SNsuFAZqOZOFNSJPGWOT1SY++O3JZihaVyoTvKx1etTfi723PZOP08T4qMqbZVrtZl8gN7qbuUaS9hpEEkepAb6WYLv+fqEqIppqa86Y0QprUYPkx9QyAy8dsyQKZXT0hU8= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A93FF4BA2E15 Received: from esperi.org.uk (oranix@sidle.srvr.nix [192.168.14.8]) by mail.esperi.org.uk (8.17.2/8.17.2) with ESMTPS id 6AI0nan0028490 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 18 Nov 2026 00:49:36 GMT Received: (from oranix@localhost) by esperi.org.uk (8.17.2/8.17.2/Submit) id 6AI0naTF006421; Wed, 18 Nov 2026 00:49:36 GMT From: Nick Alcock To: binutils@sourceware.org Cc: gdb-patches@sourceware.org, iain@sandoe.co.uk Subject: [PATCH] Fix libiberty.h inclusion on non-glibc hosts tree-wide Date: Wed, 18 Nov 2026 00:49:26 +0000 Message-ID: <20261118004926.6404-1-nix@esperi.org.uk> X-Mailer: git-send-email 2.56.1.291.g6a80de6356 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DCC-wuwien-Metrics: loom 1290; Body=3 Fuz1=3 Fuz2=3 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org In 2025, Iain Sandoe added memrchr support to libiberty.h. This requires a new AC_CHECK_FUNCS of memrchr in every project that transitively includes it, or builds on non-glibc, non-Linux hosts will fail (observed on FreeBSD 15). Fix trivial, but a tad invasive, since a lot of projects include libiberty.h, and it shows up a few places that don't include config.h at all (including some that include ansidecl.h, which requires config.h for proper operation). All relevant configury regenerated. Also touches GDB machinery, so gdb-patches is Cc:ed. Iain Sandoe Cc:ed: Iain, if you disagree with my rather nasty approach here, I'd be interested in anything better. (The need to use %top in binutils/arlex.l is slightly worrying. It's not in POSIX, but we need something like it or we can't include config.h before the system headers it must precede. (Including config.h in libiberty.h won't work for the same reason.) But if you don't do this, you can't compile binutils/arlex.c on FreeBSD any more (or any non-Linux, non-glibc system). bfd/ * configure.ac: Check for memrchr. * config.in: Regenerate. * configure: Likewise. binutils/ * configure.ac: Check for memrchr. * demanguse.c: Include config.h. * arlex.l: Likewise. * config.in: Regenerate. * configure: Likewise. gas/ * configure.ac: Check for memrchr. * config.in: Regenerate. * configure: Likewise. gdbsupport/ * libiberty.m4: Check for memrchr. * config.in: Regenerate. * configure: Likewise. sim/ * config.h.in: Regenerate. * configure: Likewise. gdb/ * config.in: Regenerate. * configure: Likewise. gdbserver/ * config.in: Regenerate. * configure: Likewise. gprofng/ * configure.ac: Check for memrchr. * common/config.h.in: Regenerate. * configure: Likewise. gold/ * configure.ac: Check for memrchr. * config.in: Regenerate. * configure: Likewise. ld/ * configure.ac: Check for memrchr. * config.in: Regenerate. * configure: Likewise. libctf/ * configure.ac: Check for memrchr. * config.h.in: Regenerate. * configure: Likewise. opcodes/ * configure.ac: Check for memrchr. * config.in: Regenerate. * configure: Likewise. --- bfd/config.in | 3 +++ bfd/configure | 2 +- bfd/configure.ac | 2 +- binutils/arlex.l | 4 ++++ binutils/config.in | 3 +++ binutils/configure | 2 +- binutils/configure.ac | 2 +- binutils/demanguse.c | 1 + gas/config.in | 3 +++ gas/configure | 9 +++++---- gas/configure.ac | 2 +- gdb/config.in | 3 +++ gdb/configure | 11 +++++++++++ gdbserver/config.in | 3 +++ gdbserver/configure | 11 +++++++++++ gdbsupport/config.in | 3 +++ gdbsupport/configure | 11 +++++++++++ gdbsupport/libiberty.m4 | 1 + gold/config.in | 3 +++ gold/configure | 2 +- gold/configure.ac | 2 +- gprofng/common/config.h.in | 3 +++ gprofng/configure | 2 +- gprofng/configure.ac | 2 +- ld/config.in | 3 +++ ld/configure | 2 +- ld/configure.ac | 2 +- libctf/config.h.in | 3 +++ libctf/configure | 9 +++++---- libctf/configure.ac | 2 +- opcodes/config.in | 3 +++ opcodes/configure | 11 +++++++++++ opcodes/configure.ac | 1 + sim/config.h.in | 3 +++ sim/configure | 11 +++++++++++ 35 files changed, 120 insertions(+), 20 deletions(-) diff --git a/bfd/config.in b/bfd/config.in index 3efd3dc3ce1..0443944891f 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -165,6 +165,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP diff --git a/bfd/configure b/bfd/configure index d010a3f9aa6..30331907315 100755 --- a/bfd/configure +++ b/bfd/configure @@ -15129,7 +15129,7 @@ done for ac_func in fcntl fdopen fileno fls getgid getpagesize getrlimit getuid \ - sysconf + sysconf memrchr do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/bfd/configure.ac b/bfd/configure.ac index 0630973a11d..d3f761fb158 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -220,7 +220,7 @@ AC_CHECK_HEADERS(fcntl.h sys/file.h sys/resource.h sys/stat.h sys/types.h \ unistd.h) AC_CHECK_FUNCS(fcntl fdopen fileno fls getgid getpagesize getrlimit getuid \ - sysconf) + sysconf memrchr) AC_CHECK_DECLS([basename, ffs, stpcpy, asprintf, vasprintf, strnlen, strtoull]) AC_CHECK_DECLS([___lc_codepage_func], [], [], [[#include ]]) diff --git a/binutils/arlex.l b/binutils/arlex.l index 1005aabfced..e8b43e90673 100644 --- a/binutils/arlex.l +++ b/binutils/arlex.l @@ -39,6 +39,10 @@ extern int yylex (void); int linenumber; %} +%top{ +#include "config.h" +} + %a 10000 %o 25000 diff --git a/binutils/config.in b/binutils/config.in index 3c3b547e320..c8c7af66bd1 100644 --- a/binutils/config.in +++ b/binutils/config.in @@ -117,6 +117,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define to 1 if you have the `mkdtemp' function. */ #undef HAVE_MKDTEMP diff --git a/binutils/configure b/binutils/configure index c455cb4c0d9..81e0037e8a2 100755 --- a/binutils/configure +++ b/binutils/configure @@ -15516,7 +15516,7 @@ rm -f conftest.mmap conftest.txt ASAN_OPTIONS="$save_ASAN_OPTIONS" -for ac_func in fseeko fseeko64 getc_unlocked mkdtemp mkstemp utimensat utimes +for ac_func in fseeko fseeko64 getc_unlocked mkdtemp mkstemp utimensat utimes memrchr do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/binutils/configure.ac b/binutils/configure.ac index e9fda4f42bb..e2e6f416670 100644 --- a/binutils/configure.ac +++ b/binutils/configure.ac @@ -198,7 +198,7 @@ AC_CHECK_HEADERS(fcntl.h inttypes.h stdint.h sys/file.h \ sys/stat.h sys/time.h sys/types.h unistd.h) AC_HEADER_SYS_WAIT GCC_AC_FUNC_MMAP -AC_CHECK_FUNCS(fseeko fseeko64 getc_unlocked mkdtemp mkstemp utimensat utimes) +AC_CHECK_FUNCS(fseeko fseeko64 getc_unlocked mkdtemp mkstemp utimensat utimes memrchr) AC_MSG_CHECKING([for mbstate_t]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], diff --git a/binutils/demanguse.c b/binutils/demanguse.c index f5cfefdaf9f..07156d9e29a 100644 --- a/binutils/demanguse.c +++ b/binutils/demanguse.c @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "config.h" #include #include #include "demangle.h" diff --git a/gas/config.in b/gas/config.in index 33482aa73dc..54fc965a676 100644 --- a/gas/config.in +++ b/gas/config.in @@ -122,6 +122,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H diff --git a/gas/configure b/gas/configure index bf3ccf3006d..dd2a89f976a 100755 --- a/gas/configure +++ b/gas/configure @@ -15659,12 +15659,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_gas" >&5 $as_echo "$cross_gas" >&6; } -for ac_func in strsignal +for ac_func in strsignal memrchr do : - ac_fn_c_check_func "$LINENO" "strsignal" "ac_cv_func_strsignal" -if test "x$ac_cv_func_strsignal" = xyes; then : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define HAVE_STRSIGNAL 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi diff --git a/gas/configure.ac b/gas/configure.ac index 09089b395c5..caecef436c5 100644 --- a/gas/configure.ac +++ b/gas/configure.ac @@ -977,7 +977,7 @@ else fi AC_MSG_RESULT($cross_gas) -AC_CHECK_FUNCS(strsignal) +AC_CHECK_FUNCS([strsignal memrchr]) AM_LC_MESSAGES diff --git a/gdb/config.in b/gdb/config.in index 2e42440d4cc..e86bcce7966 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -316,6 +316,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP diff --git a/gdb/configure b/gdb/configure index e747ffce49f..62fc7c0d962 100755 --- a/gdb/configure +++ b/gdb/configure @@ -29676,6 +29676,17 @@ _ACEOF + for ac_func in memrchr +do : + ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr" +if test "x$ac_cv_func_memrchr" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MEMRCHR 1 +_ACEOF + +fi +done + diff --git a/gdbserver/config.in b/gdbserver/config.in index cf6ebe0a4f2..dd18566aa00 100644 --- a/gdbserver/config.in +++ b/gdbserver/config.in @@ -168,6 +168,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP diff --git a/gdbserver/configure b/gdbserver/configure index e00e1e1c1c5..712e417e9fe 100755 --- a/gdbserver/configure +++ b/gdbserver/configure @@ -13249,6 +13249,17 @@ _ACEOF + for ac_func in memrchr +do : + ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr" +if test "x$ac_cv_func_memrchr" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MEMRCHR 1 +_ACEOF + +fi +done + ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include diff --git a/gdbsupport/config.in b/gdbsupport/config.in index ff84ab0d600..00f281f6a65 100644 --- a/gdbsupport/config.in +++ b/gdbsupport/config.in @@ -147,6 +147,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP diff --git a/gdbsupport/configure b/gdbsupport/configure index 7ed4e259ffe..aeb0246bf98 100755 --- a/gdbsupport/configure +++ b/gdbsupport/configure @@ -10587,6 +10587,17 @@ _ACEOF + for ac_func in memrchr +do : + ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr" +if test "x$ac_cv_func_memrchr" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MEMRCHR 1 +_ACEOF + +fi +done + ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : diff --git a/gdbsupport/libiberty.m4 b/gdbsupport/libiberty.m4 index 6c4a83c59a3..4ba571a6d19 100644 --- a/gdbsupport/libiberty.m4 +++ b/gdbsupport/libiberty.m4 @@ -28,4 +28,5 @@ AC_DEFUN([libiberty_INIT], AC_CHECK_DECLS_ONCE([ffs, asprintf, vasprintf, snprintf, vsnprintf]) AC_CHECK_DECLS_ONCE([strtol, strtoul, strtoll, strtoull]) AC_CHECK_DECLS_ONCE([strverscmp]) + AC_CHECK_FUNCS([memrchr]) ]) diff --git a/gold/config.in b/gold/config.in index 3dcb30da9f4..52920b606a2 100644 --- a/gold/config.in +++ b/gold/config.in @@ -154,6 +154,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define to 1 if you have the `mkdtemp' function. */ #undef HAVE_MKDTEMP diff --git a/gold/configure b/gold/configure index 36fb3a0085c..c524494279f 100755 --- a/gold/configure +++ b/gold/configure @@ -9764,7 +9764,7 @@ fi done -for ac_func in chsize mmap link +for ac_func in chsize mmap link memrchr do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/gold/configure.ac b/gold/configure.ac index 89348b660be..7159034928c 100644 --- a/gold/configure.ac +++ b/gold/configure.ac @@ -547,7 +547,7 @@ LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" AC_SUBST(LFS_CFLAGS) AC_CHECK_HEADERS(sys/mman.h) -AC_CHECK_FUNCS(chsize mmap link) +AC_CHECK_FUNCS(chsize mmap link memrchr) AC_REPLACE_FUNCS(pread ftruncate ffsll) AC_CACHE_CHECK([mremap with MREMAP_MAYMOVE], [gold_cv_lib_mremap_maymove], diff --git a/gprofng/common/config.h.in b/gprofng/common/config.h.in index 5f2c1278c95..9a2f42a830d 100644 --- a/gprofng/common/config.h.in +++ b/gprofng/common/config.h.in @@ -28,6 +28,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD diff --git a/gprofng/configure b/gprofng/configure index 0888933579b..6fe67f23ee6 100755 --- a/gprofng/configure +++ b/gprofng/configure @@ -17614,7 +17614,7 @@ cat >>confdefs.h <<_ACEOF #define HAVE_DECL_BASENAME $ac_have_decl _ACEOF -for ac_func in clock_gettime strsignal +for ac_func in clock_gettime strsignal memrchr do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/gprofng/configure.ac b/gprofng/configure.ac index 3a2eb0265dd..2cb4b9a4c7f 100644 --- a/gprofng/configure.ac +++ b/gprofng/configure.ac @@ -246,7 +246,7 @@ AC_SUBST(GPROFNG_CPPFLAGS, [${gprofng_cppflags}]) AC_SUBST(NOLTO_CFLAGS, [${nolto_cflags}]) AC_CHECK_DECLS([basename]) -AC_CHECK_FUNCS(clock_gettime strsignal) +AC_CHECK_FUNCS([clock_gettime strsignal memrchr]) # For riscv builds inside incomplete environments such as during intermediate # steps of cross toolchain building, or with outdated Linux headers. diff --git a/ld/config.in b/ld/config.in index 1353370340d..4dd2cb1ad49 100644 --- a/ld/config.in +++ b/ld/config.in @@ -173,6 +173,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define to 1 if you have the `mkstemp' function. */ #undef HAVE_MKSTEMP diff --git a/ld/configure b/ld/configure index cbf80648e1b..f7778869520 100755 --- a/ld/configure +++ b/ld/configure @@ -18690,7 +18690,7 @@ fi done -for ac_func in close getrusage glob lseek mkstemp open realpath waitpid mallinfo mallinfo2 +for ac_func in close getrusage glob lseek mkstemp open realpath waitpid mallinfo mallinfo2 memrchr do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/ld/configure.ac b/ld/configure.ac index 8c5e9606ac0..bf7976e202b 100644 --- a/ld/configure.ac +++ b/ld/configure.ac @@ -447,7 +447,7 @@ AC_SUBST(NATIVE_LIB_DIRS) AC_CHECK_HEADERS(fcntl.h elf-hints.h limits.h inttypes.h stdint.h \ sys/file.h sys/mman.h sys/param.h sys/stat.h sys/time.h \ sys/types.h unistd.h) -AC_CHECK_FUNCS(close getrusage glob lseek mkstemp open realpath waitpid mallinfo mallinfo2) +AC_CHECK_FUNCS(close getrusage glob lseek mkstemp open realpath waitpid mallinfo mallinfo2 memrchr) BFD_BINARY_FOPEN diff --git a/libctf/config.h.in b/libctf/config.h.in index 359f1f5ae1d..f213e4d60c7 100644 --- a/libctf/config.h.in +++ b/libctf/config.h.in @@ -73,6 +73,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP diff --git a/libctf/configure b/libctf/configure index 8ccc9ac4ee1..584ce040694 100755 --- a/libctf/configure +++ b/libctf/configure @@ -16949,12 +16949,13 @@ fi done -for ac_func in pread +for ac_func in pread memrchr do : - ac_fn_c_check_func "$LINENO" "pread" "ac_cv_func_pread" -if test "x$ac_cv_func_pread" = xyes; then : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define HAVE_PREAD 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi diff --git a/libctf/configure.ac b/libctf/configure.ac index 1e1b429c98e..31b73f66cae 100644 --- a/libctf/configure.ac +++ b/libctf/configure.ac @@ -118,7 +118,7 @@ fi AC_C_BIGENDIAN AC_CHECK_HEADERS(byteswap.h endian.h valgrind/valgrind.h) -AC_CHECK_FUNCS(pread) +AC_CHECK_FUNCS([pread memrchr]) dnl Check for bswap_{16,32,64} AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64], [], [], [[#include ]]) diff --git a/opcodes/config.in b/opcodes/config.in index 36e654292b2..d69ae43f675 100644 --- a/opcodes/config.in +++ b/opcodes/config.in @@ -65,6 +65,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define if sigsetjmp is available. */ #undef HAVE_SIGSETJMP diff --git a/opcodes/configure b/opcodes/configure index 2ae65d00cbd..1d630c79ccf 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -14032,6 +14032,17 @@ cat >>confdefs.h <<_ACEOF #define HAVE_DECL_VSNPRINTF $ac_have_decl _ACEOF +for ac_func in memrchr +do : + ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr" +if test "x$ac_cv_func_memrchr" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MEMRCHR 1 +_ACEOF + +fi +done + # Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do # since sigsetjmp might only be defined as a macro. diff --git a/opcodes/configure.ac b/opcodes/configure.ac index c6d8972aa0a..71d236516ea 100644 --- a/opcodes/configure.ac +++ b/opcodes/configure.ac @@ -97,6 +97,7 @@ AC_SUBST(HDEFINES) AC_PROG_INSTALL AC_CHECK_DECLS([asprintf, basename, snprintf, stpcpy, strtoull, vsnprintf]) +AC_CHECK_FUNCS([memrchr]) # Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do # since sigsetjmp might only be defined as a macro. diff --git a/sim/config.h.in b/sim/config.h.in index 44ff51580c7..8a850202fef 100644 --- a/sim/config.h.in +++ b/sim/config.h.in @@ -187,6 +187,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define to 1 if you have the `memrchr' function. */ +#undef HAVE_MEMRCHR + /* Define to 1 if you have the `mkdir' function. */ #undef HAVE_MKDIR diff --git a/sim/configure b/sim/configure index da4caa57aa1..490d725aaed 100755 --- a/sim/configure +++ b/sim/configure @@ -14444,6 +14444,17 @@ _ACEOF + for ac_func in memrchr +do : + ac_fn_c_check_func "$LINENO" "memrchr" "ac_cv_func_memrchr" +if test "x$ac_cv_func_memrchr" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MEMRCHR 1 +_ACEOF + +fi +done + base-commit: 5678a7bfceb3a6ea18bcde1ae68f7e96c43c998b prerequisite-patch-id: 6bb7a1f3d29820aec4c1fe7c2b30a99b1c33b604 -- 2.56.1.291.g6a80de6356