From 89d25559e0e4920694f2ae9af373094b89546bc0 Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov Date: Thu, 24 Jun 2021 10:06:23 +0200 Subject: [PATCH] hsavmcore: Disable systemd support during build if systemd header not found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check for systemd C header and disable systemd support even if HAVE_SYSTEMD make variable is set to 1. Signed-off-by: Alexander Egorenkov Acked-by: Jan Höppner Signed-off-by: Jan Höppner --- hsavmcore/Makefile | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/hsavmcore/Makefile b/hsavmcore/Makefile index fc10c124..b75fe24c 100644 --- a/hsavmcore/Makefile +++ b/hsavmcore/Makefile @@ -21,26 +21,30 @@ else # HAVE_FUSE # FUSE # ifneq ($(shell sh -c 'command -v pkg-config'),) -FUSE_CFLAGS = $(shell pkg-config --silence-errors --cflags fuse) -FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse) + FUSE_CFLAGS = $(shell pkg-config --silence-errors --cflags fuse) + FUSE_LDLIBS = $(shell pkg-config --silence-errors --libs fuse) else -FUSE_CFLAGS = -I/usr/include/fuse -FUSE_LDLIBS = -lfuse + FUSE_CFLAGS = -I/usr/include/fuse + FUSE_LDLIBS = -lfuse endif # # systemd # ifneq (${HAVE_SYSTEMD},0) -ifneq ($(shell sh -c 'command -v pkg-config'),) -SYSTEMD_CFLAGS = $(shell pkg-config --silence-errors --cflags libsystemd) -SYSTEMD_LDLIBS = $(shell pkg-config --silence-errors --libs libsystemd) -else -SYSTEMD_CFLAGS = -SYSTEMD_LDLIBS = -lsystemd + ifeq ($(call check_header_prereq,"systemd/sd-daemon.h"),yes) + ifneq ($(shell sh -c 'command -v pkg-config'),) + SYSTEMD_CFLAGS = $(shell pkg-config --silence-errors --cflags libsystemd) + SYSTEMD_LDLIBS = $(shell pkg-config --silence-errors --libs libsystemd) + else + SYSTEMD_CFLAGS = + SYSTEMD_LDLIBS = -lsystemd + endif + ALL_CPPFLAGS += -DHAVE_SYSTEMD + else + $(warning "systemd support disabled") + endif endif -ALL_CPPFLAGS += -DHAVE_SYSTEMD -endif # HAVE_SYSTEMD ALL_CPPFLAGS += -D_FILE_OFFSET_BITS=64 ALL_CFLAGS += $(FUSE_CFLAGS) $(SYSTEMD_CFLAGS) @@ -68,13 +72,6 @@ check_dep: "fuse.h", \ "fuse-devel or libfuse-dev", \ "HAVE_FUSE=0") -ifneq (${HAVE_SYSTEMD},0) - $(call check_dep, \ - "hsavmcore", \ - "systemd/sd-daemon.h", \ - "systemd-devel or libsystemd-dev", \ - "HAVE_SYSTEMD=0") -endif hsavmcore: $(OBJECTS) $(libs) $(LINK) $(ALL_LDFLAGS) $^ $(LDLIBS) -o $@