From c2d37a594d3dfe5047a46a395979edd2641c8ab1 Mon Sep 17 00:00:00 2001 From: Paulo Neves Date: Wed, 7 Sep 2022 12:12:33 +0200 Subject: [PATCH] CMakeLists.txt: Make libnsl optional YP libnsl functionality is already protected by ifdef guards where necessary and there are uses where it is not required. Add USE_LIBNSL as a build system knob. Upstream-Status: Submitted [https://github.com/nfs-ganesha/ntirpc/pull/255] Signed-off-by: Paulo Neves %% original patch: 0001-CMakeLists.txt-Make-libnsl-optional.patch --- CMakeLists.txt | 6 ++++-- config-h.in.cmake | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 737a2ddd3..e822578e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,13 +197,14 @@ set(SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ) -if (NOT BSDBASED) +option(USE_LIBNSL "Enable NSL sockets" ON) +if (USE_LIBNSL) find_package(NSL) # sockets set(SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${NSL_LIBRARY} ) -endif (NOT BSDBASED) +endif (USE_LIBNSL) set(LIBNTIRPC_MAP "${PROJECT_BINARY_DIR}/src/libntirpc.map") # subst files (need add_custom_command for dependency, fyi) @@ -221,6 +222,7 @@ message(STATUS) message(STATUS "-------------------------------------------------------") message(STATUS "TIRPC_EPOLL = ${TIRPC_EPOLL}") message(STATUS "USE_RPC_RDMA = ${USE_RPC_RDMA}") +message(STATUS "USE_LIBNSL = ${USE_LIBNSL}") message(STATUS "USE_GSS = ${USE_GSS}") message(STATUS "USE_PROFILE = ${USE_PROFILE}") message(STATUS "USE_LTTNG_NTIRPC = ${USE_LTTNG_NTIRPC}") diff --git a/config-h.in.cmake b/config-h.in.cmake index 69bf5bf08..b3ac1271f 100644 --- a/config-h.in.cmake +++ b/config-h.in.cmake @@ -20,6 +20,10 @@ #cmakedefine TIRPC_EPOLL 1 #cmakedefine USE_RPC_RDMA 1 #cmakedefine USE_LTTNG_NTIRPC 1 +#cmakedefine USE_LIBNSL 1 +#ifdef USE_LIBNSL +#define YP 1 +#endif /* Package stuff */ #define PACKAGE "libntirpc"