From: Martin Wilck Subject: [PATCH] multipath-tools: Build: properly parse systemd's version Date: Thu, 7 Mar 2019 15:54:48 +0100 Message-ID: <20190307145448.2470-1-mwilck@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: Christophe Varoqui Cc: Dominique Leuenberger , dm-devel@redhat.com, Martin Wilck List-Id: dm-devel.ids From: Dominique Leuenberger Since systemd 241, systemctl --version no longer 'just' prints out the version, but gives more information like git commit ref and whatnot. In it's shortest form, it gives something like "systemd 241 (241)", which when passed as parameter "-DUSE_SYSTEMD=241 (241)" results in shell errors. Try to retrieve the version from pkg-config instead, and if that fails, discard anything after the first number in "systemctl --version" output. Signed-off-by: Martin Wilck --- Makefile.inc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile.inc b/Makefile.inc index fc728ca9..56c3eda0 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -36,8 +36,13 @@ ifndef RUN endif ifndef SYSTEMD - ifeq ($(shell systemctl --version > /dev/null 2>&1 && echo 1), 1) - SYSTEMD = $(shell systemctl --version 2> /dev/null | sed -n 's/systemd \([0-9]*\)/\1/p') + ifeq ($(shell pkg-config --modversion libsystemd >/dev/null 2>&1 && echo 1), 1) + SYSTEMD = $(shell pkg-config --modversion libsystemd) + else + ifeq ($(shell systemctl --version >/dev/null 2>&1 && echo 1), 1) + SYSTEMD = $(shell systemctl --version 2> /dev/null | \ + sed -n 's/systemd \([0-9]*\).*/\1/p') + endif endif endif -- 2.21.0