From 822575c6b15777da7c279596aa76ae9e8f392d73 Mon Sep 17 00:00:00 2001 From: Denys Fedoryshchenko Date: Thu, 7 Aug 2025 19:06:36 +0300 Subject: feat(build): Add MUSL detection and conditional linking This commit introduces the ability to detect if the project is being built with the MUSL C library. A new variable `MUSL` is set to `ON` if MUSL is detected, and `OFF` otherwise. This is achieved by checking the output of `ldd --version`. The `accel-pppd/ctrl/pppoe/CMakeLists.txt` file is updated to conditionally link the `connlimit` library only when building with MUSL. Signed-off-by: Denys Fedoryshchenko --- accel-pppd/ctrl/pppoe/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'accel-pppd/ctrl') diff --git a/accel-pppd/ctrl/pppoe/CMakeLists.txt b/accel-pppd/ctrl/pppoe/CMakeLists.txt index fd4f9a36..b6f4a98f 100644 --- a/accel-pppd/ctrl/pppoe/CMakeLists.txt +++ b/accel-pppd/ctrl/pppoe/CMakeLists.txt @@ -13,7 +13,12 @@ SET(sources ${sources} tr101.c) ENDIF(RADIUS) ADD_LIBRARY(pppoe SHARED ${sources}) -TARGET_LINK_LIBRARIES(pppoe vlan-mon connlimit) +# if MUSL is set then we need to link with the connlimit library +IF (MUSL) + TARGET_LINK_LIBRARIES(pppoe vlan-mon connlimit) +ELSE (MUSL) + TARGET_LINK_LIBRARIES(pppoe vlan-mon) +ENDIF (MUSL) set_property(TARGET pppoe PROPERTY CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set_property(TARGET pppoe PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/accel-ppp) -- cgit v1.2.3