diff options
author | Xi Ruoyao <xry111@xry111.site> | 2023-03-28 01:48:02 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2023-03-28 15:26:14 +0800 |
commit | 21c74b6ea41d21ef96813b34bfa55c51a82d6c99 (patch) | |
tree | 62a78f9ea160bc80175ee60be1ffc5539235e6f0 /fixincludes/configure | |
parent | 33312336d576a0aaa4f425686d652b09151a7c24 (diff) | |
download | gcc-21c74b6ea41d21ef96813b34bfa55c51a82d6c99.zip gcc-21c74b6ea41d21ef96813b34bfa55c51a82d6c99.tar.gz gcc-21c74b6ea41d21ef96813b34bfa55c51a82d6c99.tar.bz2 |
fixincludes: Declare memmem if it's not declared in system headers [PR109293]
memmem is not POSIX so the system may lack it. Then libiberty will
provide an implementation, but it's a "supplemental function" and not
declared in libiberty.h. We need to declare the prototype to use it
then.
See libiberty doc at
https://gcc.gnu.org/onlinedocs/libiberty/Supplemental-Functions.html.
Tested by bootstrapping GCC in the following container environments on
x86_64-linux-gnu:
1. "Vanilla" system with memmem in Glibc.
2. memmem removed from string.h.
3. memmem removed from both string.h and libc.so.
For 3, also verified that memmem from libiberty is linked into fixincl
executable.
Ok for trunk?
fixincludes/ChangeLog:
PR other/109293
* configure.ac (AC_CHECK_DECLS): Add memmem.
* configure: Regenerate.
* config.h.in: Regenerate.
* system.h (memmem): Declare if HAVE_DECL_MEMMEM is zero.
Diffstat (limited to 'fixincludes/configure')
-rwxr-xr-x | fixincludes/configure | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fixincludes/configure b/fixincludes/configure index b3bca66..bdcc41f 100755 --- a/fixincludes/configure +++ b/fixincludes/configure @@ -5043,6 +5043,16 @@ fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_VASPRINTF $ac_have_decl _ACEOF +ac_fn_c_check_decl "$LINENO" "memmem" "ac_cv_have_decl_memmem" "$ac_includes_default" +if test "x$ac_cv_have_decl_memmem" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MEMMEM $ac_have_decl +_ACEOF ac_fn_c_check_decl "$LINENO" "clearerr_unlocked" "ac_cv_have_decl_clearerr_unlocked" "$ac_includes_default" if test "x$ac_cv_have_decl_clearerr_unlocked" = xyes; then : |