package/ntp: fix build with GCC 14.x

Fix pthread_detach() detection that is broken when building
with GCC 14.x:

checking for pthread_kill... yes
checking for pthread_rwlock_destroy with <pthread.h>... yes
checking for pthread_detach with <pthread.h>... no
configure: error: could not locate pthread_detach()
make[1]: *** [package/pkg-generic.mk:273:
/home/user/buildroot/bsp-barebox/build/ntp-4.2.8p17/.stamp_configured]
Error 1
make: *** [Makefile:82: _all] Error 2

Reference: https://bugs.ntp.org/show_bug.cgi?id=3926

Additionally, refresh patch 0002 to fix the offset of hunk 1.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
(cherry picked from commit 40d0797027)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Yegor Yefremov 2024-06-03 15:43:58 +02:00 committed by Peter Korsgaard
parent d115b01859
commit c8198f6e0f
2 changed files with 31 additions and 4 deletions

View File

@ -8,10 +8,11 @@ Signed-off-by: James Knight <james.knight@rockwellcollins.com>
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1523,11 +1523,11 @@ AC_CACHE_CHECK(
Index: ntp-4.2.8p17/configure.ac
===================================================================
--- ntp-4.2.8p17.orig/configure.ac
+++ ntp-4.2.8p17/configure.ac
@@ -1472,11 +1472,11 @@ AC_CACHE_CHECK(
[ntp_cv_var_ntp_syscalls],
[
ntp_cv_var_ntp_syscalls=no

View File

@ -0,0 +1,26 @@
fix pthread_detach check
Upstream: https://bugs.ntp.org/show_bug.cgi?id=3926
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
sntp/m4/openldap-thread-check.m4 | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Index: ntp-4.2.8p17/sntp/m4/openldap-thread-check.m4
===================================================================
--- ntp-4.2.8p17.orig/sntp/m4/openldap-thread-check.m4
+++ ntp-4.2.8p17/sntp/m4/openldap-thread-check.m4
@@ -262,10 +262,8 @@ pthread_rwlock_t rwlock;
dnl save the flags
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <pthread.h>
-#ifndef NULL
-#define NULL (void*)0
-#endif
-]], [[pthread_detach(NULL);]])],[ol_cv_func_pthread_detach=yes],[ol_cv_func_pthread_detach=no])
+pthread_t thread;
+]], [[pthread_detach(thread);]])],[ol_cv_func_pthread_detach=yes],[ol_cv_func_pthread_detach=no])
])
if test $ol_cv_func_pthread_detach = no ; then