From 8a2bdd6e5ced238fd0a13c67ea35ff1e72244ddb Mon Sep 17 00:00:00 2001 From: Subhaditya Nath Date: Tue, 14 Nov 2023 17:21:59 +0530 Subject: [PATCH] Add configuration flag for enabling liblsof (#299) --- Makefile.am | 11 ++++++++--- configure.ac | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index c777a99f..df7126f3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,9 +1,14 @@ # liblsof -lib_LTLIBRARIES = liblsof.la - liblsof_la_SOURCES = lib/ckkv.c lib/cvfs.c lib/dvch.c lib/fino.c lib/isfn.c lib/lkud.c lib/lsof.c lib/misc.c lib/node.c lib/pdvn.c lib/prfp.c lib/print.c lib/proc.c lib/ptti.c lib/rdev.c lib/rnmt.c lib/rmnt.c lib/rnam.c lib/rnch.c lib/rnmh.c liblsof_la_SOURCES += lib/common.h lib/proto.h lib/hash.h + +if INSTALL_LIBLSOF +lib_LTLIBRARIES = liblsof.la include_HEADERS = include/lsof.h include/lsof_fields.h +else +noinst_LTLIBRARIES = liblsof.la +# nodist_include_HEADERS = include/lsof.h include/lsof_fields.h +endif # Hide internal functions AM_CFLAGS = -fvisibility=hidden @@ -217,4 +222,4 @@ EXTRA_DIST += Lsof.8 clean-local: rm -rf lsof.man distclean-local: - rm -rf lockf_owner.h lockf.h \ No newline at end of file + rm -rf lockf_owner.h lockf.h diff --git a/configure.ac b/configure.ac index 83490926..9723ca78 100644 --- a/configure.ac +++ b/configure.ac @@ -253,6 +253,11 @@ AC_SUBST([LSOF_DIALECT_DIR]) AC_DEFINE([API_EXPORT], [__attribute__ ((visibility ("default")))], [Set visibility to default for exported API functions.]) +# --enable-liblsof to install liblsof +AC_ARG_ENABLE(liblsof, AS_HELP_STRING([--enable-liblsof], + [build and install liblsof @<:@default=no@:>@]), [], [enable_liblsof=no]) +AM_CONDITIONAL([INSTALL_LIBLSOF], [test "x$enable_liblsof" = xyes]) + # --enable-security to define HASSECURITY AC_ARG_ENABLE(security, AS_HELP_STRING([--enable-security], [allow only the root user to list all open files @<:@default=no@:>@]), [], [enable_security=no])