aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac18
-rw-r--r--contrib/Makefile.am1
-rw-r--r--contrib/systemd/Makefile.am5
-rw-r--r--contrib/systemd/osmo-pcu.service (renamed from contrib/osmo-pcu.service)0
-rw-r--r--debian/osmo-pcu.install1
l---------debian/osmo-pcu.service1
-rwxr-xr-xdebian/rules3
8 files changed, 32 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 7a4e6c0b..240e4ee2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,11 @@
AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6
-SUBDIRS = include src examples tests
+SUBDIRS = include src examples tests contrib
EXTRA_DIST = osmoappdesc.py README.md
+DISTCHECK_CONFIGURE_FLAGS = \
+ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
@RELMAKE@
pkgconfigdir = $(libdir)/pkgconfig
diff --git a/configure.ac b/configure.ac
index 7288c24e..90394e12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,6 +157,22 @@ AM_CONDITIONAL(ENABLE_VTY_TESTS, test "x$enable_vty_tests" = "xyes")
STD_DEFINES_AND_INCLUDES="-Wall"
AC_SUBST(STD_DEFINES_AND_INCLUDES)
+# 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"])
+
AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
AC_MSG_RESULT([CFLAGS="$CFLAGS"])
AC_MSG_RESULT([CXXFLAGS="$CXXFLAGS"])
@@ -168,4 +184,6 @@ AC_OUTPUT(
src/Makefile
examples/Makefile
tests/Makefile
+ contrib/Makefile
+ contrib/systemd/Makefile
Makefile)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
new file mode 100644
index 00000000..3439c97b
--- /dev/null
+++ b/contrib/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = systemd
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am
new file mode 100644
index 00000000..f565234f
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -0,0 +1,5 @@
+if HAVE_SYSTEMD
+EXTRA_DIST = osmo-pcu.service
+systemdsystemunit_DATA = \
+ osmo-pcu.service
+endif
diff --git a/contrib/osmo-pcu.service b/contrib/systemd/osmo-pcu.service
index 6329d31e..6329d31e 100644
--- a/contrib/osmo-pcu.service
+++ b/contrib/systemd/osmo-pcu.service
diff --git a/debian/osmo-pcu.install b/debian/osmo-pcu.install
index 80316ee0..1b82e961 100644
--- a/debian/osmo-pcu.install
+++ b/debian/osmo-pcu.install
@@ -1,4 +1,5 @@
etc/osmocom/osmo-pcu.cfg
+lib/systemd/system/osmo-pcu.service
usr/bin/osmo-pcu
usr/include/osmocom/pcu/pcuif_proto.h
usr/lib/*/pkgconfig/osmo-pcu.pc
diff --git a/debian/osmo-pcu.service b/debian/osmo-pcu.service
deleted file mode 120000
index f0774312..00000000
--- a/debian/osmo-pcu.service
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/osmo-pcu.service \ No newline at end of file
diff --git a/debian/rules b/debian/rules
index cffb6ca0..712dd756 100755
--- a/debian/rules
+++ b/debian/rules
@@ -22,3 +22,6 @@ override_dh_clean:
# Print test results in case of a failure
override_dh_auto_test:
dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false)
+
+override_dh_auto_configure:
+ dh_auto_configure -- --with-systemdsystemunitdir=/lib/systemd/system