Skip to content

fix: skip building liblsof when --disable-liblsof is given#357

Merged
jiegec merged 1 commit intolsof-org:masterfrom
kurok:fix/skip-liblsof-build-when-disabled
Mar 13, 2026
Merged

fix: skip building liblsof when --disable-liblsof is given#357
jiegec merged 1 commit intolsof-org:masterfrom
kurok:fix/skip-liblsof-build-when-disabled

Conversation

@kurok
Copy link
Contributor

@kurok kurok commented Mar 13, 2026

Summary

  • Stop compiling liblsof.la when --disable-liblsof is passed to ./configure
  • Guard the LTbasic2 test (which links against liblsof.la) behind the same conditional

Problem

With --disable-liblsof, the library was still compiled as noinst_LTLIBRARIES — just not installed. Since the lsof binary compiles all the library sources directly (lsof_SOURCES += ... rather than lsof_LDADD = liblsof.la), this was unnecessary work.

Approach

Rename liblsof_la_SOURCES to a plain LIBLSOF_SOURCES variable (no automake target magic). Both lsof_SOURCES and liblsof_la_SOURCES reference this shared list. The liblsof.la library target, its _CPPFLAGS, and the LTbasic2 test are now only defined inside if INSTALL_LIBLSOF.

Before (--disable-liblsof):

noinst_LTLIBRARIES = liblsof.la   # compiled but not installed

After (--disable-liblsof):

# liblsof.la is not defined at all — not compiled, not installed

Test plan

  • ./configure --disable-liblsof && make builds lsof without compiling liblsof.la
  • ./configure && make builds both lsof and liblsof.la (default behavior preserved)
  • make check with --disable-liblsof skips LTbasic2 and passes remaining tests
  • make check with default config runs LTbasic2 and passes

Closes #324

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
@jiegec jiegec merged commit f2c00df into lsof-org:master Mar 13, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unnecessary building liblsof

2 participants