Skip to contentSkip to conversation

configure.ac: autodetect availability of systemd

PATCH Superseded Ulrich Ölmann 1 participant 2 messages Mar 4, 2021 Media (V4L/DVB)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 configure.ac: autodetect availability of systemd

Import systemd's official suggestion [1] how this should be handled in packages using autoconf.

[1] https://www.freedesktop.org/software/systemd/man/daemon.html#Installing%20systemd%20Service%20Files

---
 configure.ac | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
configure.ac +9 -1
index 727730c5ccf4..f62ad7cb25ae 100644
@@ -388,7 +388,15 @@ AC_ARG_WITH(udevdir,
 AC_ARG_WITH(systemdsystemunitdir,
 	AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [set systemd system unit directory]),
 	[],
-	[with_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd || echo /lib/systemd/system`])
+	[with_systemdsystemunitdir=auto])
+AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
+      [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
+       AS_IF([test "x$def_systemdsystemunitdir" = "x"],
+             [AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
+                    [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
+              with_systemdsystemunitdir=no],
+             [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
+AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
 
 # Generic check: works with most distributions
 def_gconv_dir=`for i in /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib; do if @<:@ -d \$i/gconv @:>@; then echo \$i/gconv; break; fi; done`
Signature · 1 line
2.29.2
#1 lore raw

PATCH 2/2 keytable: restrict installation of 50-rc_keymap.conf

It is only needed if BPF is effectively used and the package is compiled for a systemd based target.

---
 utils/keytable/Makefile.am | 4 ++++
 1 file changed, 4 insertions(+)
utils/keytable/Makefile.am +4 -0
index c5eb414acf2f..eee61f0e0551 100644
@@ -3,9 +3,13 @@ man_MANS = ir-keytable.1 rc_keymap.5
 sysconf_DATA = rc_maps.cfg
 keytablesystem_DATA = $(srcdir)/rc_keymaps/*
 udevrules_DATA = 70-infrared.rules
+if WITH_BPF
+if HAVE_SYSTEMD
 if HAVE_UDEVDSYSCALLFILTER
 systemdsystemunit_DATA = 50-rc_keymap.conf
 endif
+endif
+endif
 
 ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h keymap.c keymap.h
 
Signature · 1 line
2.29.2