Skip to content

Commit

Permalink
CMakeLists.txt: Make libnsl optional
Browse files Browse the repository at this point in the history
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 [#255]

Signed-off-by: Paulo Neves <[email protected]>

%% original patch: 0001-CMakeLists.txt-Make-libnsl-optional.patch
  • Loading branch information
ptsneves committed Sep 14, 2022
1 parent f10d11a commit c2d37a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}")
Expand Down
4 changes: 4 additions & 0 deletions config-h.in.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c2d37a5

Please sign in to comment.