From 75b8eb3bcc91c8c0e54ce4b2336e66364cbc1a16 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 4 Mar 2020 17:11:36 +0100 Subject: [PATCH] configure.ac + debian: Add systemd service file support Closes: OS#4326 Change-Id: I0d7b6562c1127f005ddbd47298c03942ac3d241d --- configure.ac | 16 ++++++++++++++++ contrib/systemd/Makefile.am | 7 +++++++ debian/osmo-remsim-bankd.install | 1 + debian/osmo-remsim-client.install | 1 + debian/osmo-remsim-server.install | 1 + 5 files changed, 26 insertions(+) diff --git a/configure.ac b/configure.ac index d2c5e58..0ccb0ba 100644 --- a/configure.ac +++ b/configure.ac @@ -160,6 +160,22 @@ then AC_SUBST([OSMO_GSM_MANUALS_DIR]) fi +# https://www.freedesktop.org/software/systemd/man/daemon.html +AC_ARG_WITH([systemdsystemunitdir], + [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],, + [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"], + [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) + with_systemdsystemunitdir=no], + [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) +AS_IF([test "x$with_systemdsystemunitdir" != "xno"], + [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])]) +AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) + CFLAGS="$CFLAGS -Wall" CPPFLAGS="$CPPFLAGS -Wall" diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am index 642920c..2cc64df 100644 --- a/contrib/systemd/Makefile.am +++ b/contrib/systemd/Makefile.am @@ -1 +1,8 @@ EXTRA_DIST = osmo-remsim-bankd.service osmo-remsim-client@.service osmo-remsim-server.service + +if HAVE_SYSTEMD +systemdsystemunit_DATA = \ + osmo-remsim-bankd.service \ + osmo-remsim-server.service \ + osmo-remsim-client@.service +endif diff --git a/debian/osmo-remsim-bankd.install b/debian/osmo-remsim-bankd.install index d8168d5..58de089 100644 --- a/debian/osmo-remsim-bankd.install +++ b/debian/osmo-remsim-bankd.install @@ -1 +1,2 @@ usr/bin/osmo-remsim-bankd +lib/systemd/system/osmo-remsim-bankd.service diff --git a/debian/osmo-remsim-client.install b/debian/osmo-remsim-client.install index 8e73dc1..85ffb82 100644 --- a/debian/osmo-remsim-client.install +++ b/debian/osmo-remsim-client.install @@ -1 +1,2 @@ usr/bin/osmo-remsim-client* +lib/systemd/system/osmo-remsim-client* diff --git a/debian/osmo-remsim-server.install b/debian/osmo-remsim-server.install index f6f14a1..497f7e1 100644 --- a/debian/osmo-remsim-server.install +++ b/debian/osmo-remsim-server.install @@ -1 +1,2 @@ usr/bin/osmo-remsim-server +lib/systemd/system/osmo-remsim-server.service