From a847f0460ccacf6567a57915e5e13a2c5f562ddc Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 28 Nov 2023 11:52:59 +0100 Subject: [PATCH] libjulius: Fix incompatible types in POSIX threads configure checks NULL is not necessarily a valid pthread_t value. Compilers increasingly enforce C type safety, and these configure checks may fail incorrectly with such compilers. POSIX guarantees that pthread_self() returns a valid pthread_t value, so use that instead. --- libjulius/configure | 4 ++-- libjulius/configure.in | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libjulius/configure b/libjulius/configure index e1e56d6..44ffeb7 100755 --- a/libjulius/configure +++ b/libjulius/configure @@ -4532,7 +4532,7 @@ $as_echo_n "checking for linking POSIX threaded process... " >&6; } int main () { -pthread_equal(NULL,NULL); +pthread_equal(pthread_self(),pthread_self()); ; return 0; } @@ -4564,7 +4564,7 @@ $as_echo_n "checking for POSIX thread library in -lpthread... " >&6; } int main () { -pthread_equal(NULL,NULL); +pthread_equal(pthread_self(),pthread_self()); ; return 0; } diff --git a/libjulius/configure.in b/libjulius/configure.in index 978ebca..8086b55 100644 --- a/libjulius/configure.in +++ b/libjulius/configure.in @@ -373,7 +373,8 @@ if test "$want_pthread" = yes; then AC_MSG_CHECKING([for linking POSIX threaded process]) ac_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -pthread" - AC_TRY_LINK([#include ],[pthread_equal(NULL,NULL);], + AC_TRY_LINK([#include ], + [pthread_equal(pthread_self(),pthread_self());], use_pthread=yes AC_DEFINE(HAVE_PTHREAD) CPPFLAGS="$CPPFLAGS -pthread", @@ -388,7 +389,8 @@ if test "$want_pthread" = yes; then AC_MSG_CHECKING([for POSIX thread library in -lpthread]) ac_save_LIBS_p="$LIBS" LIBS="$LIBS -lpthread" - AC_TRY_LINK([#include ],[pthread_equal(NULL,NULL);], + AC_TRY_LINK([#include ], + [pthread_equal(pthread_self(),pthread_self());], use_pthread=yes AC_DEFINE(HAVE_PTHREAD), use_pthread=no