fix: skip building liblsof when --disable-liblsof is given#357
Merged
jiegec merged 1 commit intolsof-org:masterfrom Mar 13, 2026
Merged
Conversation
Previously, --disable-liblsof only prevented installation but still compiled liblsof as noinst_LTLIBRARIES. Since the lsof binary compiles the library sources directly (not linking against liblsof.la), building the library was unnecessary overhead. Rename liblsof_la_SOURCES to a plain LIBLSOF_SOURCES variable shared by both the lsof binary and liblsof.la, and only define the liblsof.la target when INSTALL_LIBLSOF is set. Guard the LTbasic2 test (which links against liblsof.la) behind the same conditional. Closes lsof-org#324
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
liblsof.lawhen--disable-liblsofis passed to./configureLTbasic2test (which links againstliblsof.la) behind the same conditionalProblem
With
--disable-liblsof, the library was still compiled asnoinst_LTLIBRARIES— just not installed. Since thelsofbinary compiles all the library sources directly (lsof_SOURCES += ...rather thanlsof_LDADD = liblsof.la), this was unnecessary work.Approach
Rename
liblsof_la_SOURCESto a plainLIBLSOF_SOURCESvariable (no automake target magic). Bothlsof_SOURCESandliblsof_la_SOURCESreference this shared list. Theliblsof.lalibrary target, its_CPPFLAGS, and theLTbasic2test are now only defined insideif INSTALL_LIBLSOF.Before (
--disable-liblsof):After (
--disable-liblsof):Test plan
./configure --disable-liblsof && makebuildslsofwithout compilingliblsof.la./configure && makebuilds bothlsofandliblsof.la(default behavior preserved)make checkwith--disable-liblsofskipsLTbasic2and passes remaining testsmake checkwith default config runsLTbasic2and passesCloses #324