diff -ruN gc-8.2.2.orig/configure.ac gc-8.2.2/configure.ac --- gc-8.2.2.orig/configure.ac 2022-08-26 20:44:49.000000000 +0200 +++ gc-8.2.2/configure.ac 2023-01-17 10:24:04.342866823 +0100 @@ -833,13 +833,15 @@ AS_IF([test "$THREADS" = posix], [AC_MSG_CHECKING(for pthread_setname_np) old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $CFLAGS_EXTRA -Werror" - AC_TRY_COMPILE([#include ], + CFLAGS="$CFLAGS $CFLAGS_EXTRA -Werror -pthread" + AC_TRY_COMPILE([#define _GNU_SOURCE + #include ], [pthread_setname_np("thread-name")], [AC_MSG_RESULT([yes (w/o tid)]) AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID], [1], [Define to use 'pthread_setname_np(const char*)' function.])], - [AC_TRY_COMPILE([#include ], + [AC_TRY_COMPILE([#define _GNU_SOURCE + #include ], [pthread_setname_np(pthread_self(), "thread-name-%u", 0)], [AC_MSG_RESULT([yes (with tid and arg)]) AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG], [1],