]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
Fix dependency on systemd
authorSimon A. F. Lund <simon.lund@samsung.com>
Wed, 26 Feb 2020 20:04:24 +0000 (21:04 +0100)
committerSimon A. F. Lund <simon.lund@samsung.com>
Wed, 26 Feb 2020 20:15:39 +0000 (21:15 +0100)
When libsystemd is not installed on the system, then the pkg-config
check would still be true when systemd itself is on the system. Also,
when the library is unavailable then the hard-coded "-lsystemd" would
cause the build to fail. The following changes fix that.

* configure: changed check from "systemd" to the library "libsystemd"

* examples/Makefile: Replaced hard-coded "-lsystemd" with "${LDFLAGS}"
  as defined by "config-host.mak" in examples/Makefile

* src/Makefile: added include of "config-host.mak", removed hard-coded
  "-lsystemd", "-lsystemd" will trickle in from LDFLAGS

Signed-off-by: Simon A. F. Lund <simon.lund@samsung.com>
configure
examples/Makefile
src/Makefile

index 0d6ebc6da9796b51bb60655ebeefcaf254a4fc61..9e63d9e2c9fb60a34b8b08625067fb71028331f5 100755 (executable)
--- a/configure
+++ b/configure
@@ -186,7 +186,7 @@ print_config "libuuid" "${libuuid}"
 ##########################################
 # check for SystemD
 systemd="no"
-pkg-config --exists systemd --atleast-version=232
+pkg-config --exists libsystemd --atleast-version=232
 if [ $? -eq 0 ]; then
   systemd="yes"
 fi
index 8cb7ded58d26fb69b5a9226fc711f97b66af3013..3731d4ac27bb30fca4edd708c6d34e0665bdcd82 100644 (file)
@@ -1,5 +1,5 @@
 CFLAGS ?= -g -O2
-override CFLAGS += -Wall -D_GNU_SOURCE -L../src/ -I../src/ -lsystemd
+override CFLAGS += -Wall -D_GNU_SOURCE -L../src/ -I../src/
 
 include ../Makefile.quiet
 
@@ -12,7 +12,7 @@ all_targets += telemetry-listen display-tree display-columnar discover-loop
 all: $(all_targets)
 
 %: %.c
-       $(QUIET_CC)$(CC) $(CFLAGS) -o $@ $< -lnvme
+       $(QUIET_CC)$(CC) $(CFLAGS) -o $@ $< -lnvme ${LDFLAGS}
 
 clean:
        rm -f $(all_targets)
index 2434f17ccbed904c7a45e40f36a7d42eae2704c1..8977e72a6291a070690cd4b0378480de6ebad854 100644 (file)
@@ -2,6 +2,10 @@ NAME=libnvme
 SPECFILE=$(NAME).spec
 VERSION=$(shell awk '/Version:/ { print $$2 }' $(SPECFILE))
 
+ifneq ($(MAKECMDGOALS),clean)
+include ../config-host.mak
+endif
+
 prefix ?= /usr
 includedir ?= $(prefix)/include
 libdir ?= $(prefix)/lib
@@ -12,7 +16,7 @@ CFLAGS ?= -g -fomit-frame-pointer -O2 -I/usr/include -Invme/ -I$(CCANDIR) -inclu
 override CFLAGS += -Wall -fPIC
 SO_CFLAGS=-shared $(CFLAGS)
 L_CFLAGS=$(CFLAGS)
-LINK_FLAGS= -L /usr/lib64 -lsystemd
+LINK_FLAGS= -L /usr/lib64
 LINK_FLAGS+=$(LDFLAGS)
 ENABLE_SHARED ?= 1
 SED ?= sed