utils: Update guard checks in config.h

Since glibc 2.38 the functions strchrnul and strcasestr have been
exposed by default, rather than being hidden behind _GNU_SOURCE.

We therefore use the GLIBC_PREREQ macro to check the version of
the glibc headers and do not accidentally double-declare these
functions.

Signed-off-by: Daniel Silverstone <dsilvers@netsurf-browser.org>
This commit is contained in:
Daniel Silverstone 2024-05-24 19:14:46 +01:00
parent d3a8bdc060
commit 34239ed89f

View File

@ -43,6 +43,7 @@ char *strndup(const char *s, size_t n);
#endif
#if ((defined(_GNU_SOURCE) || \
(defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2,38)) || \
defined(__APPLE__) || \
defined(__HAIKU__) || \
defined(__NetBSD__) || \
@ -75,6 +76,7 @@ char *strcasestr(const char *haystack, const char *needle);
* UnixLib if building for RISC OS.
*/
#if ((defined(_GNU_SOURCE) && !defined(__APPLE__)) || \
(defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2,38)) || \
defined(__riscos__) || \
defined(NetBSD_v8))
#define HAVE_STRCHRNUL