From 28a2ef7c5f28dea8ce9b5d2f14b366ada0353e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Mon, 15 Apr 2024 02:56:07 +0200 Subject: [PATCH] tdm: Allow to detect pthread_setname_np. Add linking pthread. This relates to issue #473. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- tdm/ConfigureChecks.cmake | 4 ++++ tdm/backend/CMakeLists.txt | 2 +- tdm/backend/dm.c | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tdm/ConfigureChecks.cmake b/tdm/ConfigureChecks.cmake index 8ebba8e6d..d0080f4f1 100644 --- a/tdm/ConfigureChecks.cmake +++ b/tdm/ConfigureChecks.cmake @@ -18,7 +18,11 @@ check_function_exists( getdomainname HAVE_GETDOMAINNAME ) check_function_exists( initgroups HAVE_INITGROUPS ) check_function_exists( mkstemp HAVE_MKSTEMP ) check_function_exists( setproctitle HAVE_SETPROCTITLE ) +tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE" "-D__BSD_VISIBLE=1" ) +tde_save_and_set( CMAKE_REQUIRED_LIBRARIES "pthread" ) check_function_exists( pthread_setname_np HAVE_PTHREAD_SETNAME_NP ) +tde_restore( CMAKE_REQUIRED_DEFINITIONS ) +tde_restore( CMAKE_REQUIRED_LIBRARIES ) check_function_exists( sysinfo HAVE_SYSINFO ) check_function_exists( strnlen HAVE_STRNLEN ) check_function_exists( getifaddrs HAVE_GETIFADDRS ) diff --git a/tdm/backend/CMakeLists.txt b/tdm/backend/CMakeLists.txt index f09704486..cb0cd3d3f 100644 --- a/tdm/backend/CMakeLists.txt +++ b/tdm/backend/CMakeLists.txt @@ -49,6 +49,6 @@ tde_add_executable( tdm process.c protodpy.c reset.c resource.c rpcauth.c server.c session.c sessreg.c socket.c streams.c util.c xdmauth.c xdmcp.c - LINK X11 ${XAU_LIBRARIES} ${DBUS_LIBRARIES} ${CRYPT_LIBRARY} ${PAM_LIBRARY} ${UTIL_LIBRARY} ${XDMCP_LIBRARIES} + LINK X11 pthread ${XAU_LIBRARIES} ${DBUS_LIBRARIES} ${CRYPT_LIBRARY} ${PAM_LIBRARY} ${UTIL_LIBRARY} ${XDMCP_LIBRARIES} DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/tdm/backend/dm.c b/tdm/backend/dm.c index 627d2c23d..9168b88b5 100644 --- a/tdm/backend/dm.c +++ b/tdm/backend/dm.c @@ -54,6 +54,8 @@ from the copyright holder. #endif #ifdef HAVE_PTHREAD_SETNAME_NP +#define _GNU_SOURCE +#define __BSD_VISIBLE 1 #include #endif /* pthread_setname_np() */