From: Martin Wilck Subject: [PATCH RESEND 1/3] multipath-tools: Build: properly parse systemd's version Date: Thu, 11 Apr 2019 12:27:12 +0200 Message-ID: <20190411102714.12026-2-mwilck@suse.com> References: <20190411102714.12026-1-mwilck@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190411102714.12026-1-mwilck@suse.com> 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 , Benjamin Marzinski Cc: dm-devel@redhat.com, Xose Vazquez Perez , Martin Wilck , Dominique Leuenberger 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. Acked-by: Benjamin Marzinski Acked-by: Xose Vazquez Perez 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