summaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-09-10 14:10:29 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-09-13 12:06:08 +0200
commit422492998660ba40d3d7986fd43e1d7aafa3774a (patch)
treede0be8bc7dd9a2afcdae65c9ffe7b0d9547233ed /openbsc
parentac1b03c8e59408336d07527e2597171cb99ed654 (diff)
Install systemd services with autotools
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/Makefile.am4
-rw-r--r--openbsc/configure.ac18
-rw-r--r--openbsc/contrib/Makefile.am1
-rw-r--r--openbsc/contrib/systemd/Makefile.am14
l---------openbsc/debian/osmo-bsc-mgcp.service1
5 files changed, 37 insertions, 1 deletions
diff --git a/openbsc/Makefile.am b/openbsc/Makefile.am
index dc5392907..792dcf20d 100644
--- a/openbsc/Makefile.am
+++ b/openbsc/Makefile.am
@@ -13,6 +13,7 @@ SUBDIRS = \
include \
src \
tests \
+ contrib \
$(NULL)
pkgconfigdir = $(libdir)/pkgconfig
@@ -21,6 +22,9 @@ pkgconfig_DATA = openbsc.pc
BUILT_SOURCES = $(top_srcdir)/.version
EXTRA_DIST = git-version-gen osmoappdesc.py .version
+DISTCHECK_CONFIGURE_FLAGS = \
+ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
@RELMAKE@
$(top_srcdir)/.version:
diff --git a/openbsc/configure.ac b/openbsc/configure.ac
index c3615d6a5..75dd5d33f 100644
--- a/openbsc/configure.ac
+++ b/openbsc/configure.ac
@@ -220,6 +220,22 @@ AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
AC_MSG_RESULT([$enable_ext_tests])
AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
+# 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([CFLAGS="$CFLAGS"])
AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
@@ -262,4 +278,6 @@ AC_OUTPUT(
tests/nanobts_omlattr/Makefile
doc/Makefile
doc/examples/Makefile
+ contrib/Makefile
+ contrib/systemd/Makefile
Makefile)
diff --git a/openbsc/contrib/Makefile.am b/openbsc/contrib/Makefile.am
new file mode 100644
index 000000000..3439c97be
--- /dev/null
+++ b/openbsc/contrib/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = systemd
diff --git a/openbsc/contrib/systemd/Makefile.am b/openbsc/contrib/systemd/Makefile.am
new file mode 100644
index 000000000..69f973e5e
--- /dev/null
+++ b/openbsc/contrib/systemd/Makefile.am
@@ -0,0 +1,14 @@
+if HAVE_SYSTEMD
+SYSTEMD_SERVICES = osmo-nitb.service osmo-bsc-mgcp.service
+
+if BUILD_NAT
+SYSTEMD_SERVICES += osmo-bsc-nat.service
+endif
+
+if BUILD_BSC
+SYSTEMD_SERVICES += osmo-bsc-sccplite.service
+endif
+
+EXTRA_DIST = $(SYSTEMD_SERVICES)
+systemdsystemunit_DATA = $(SYSTEMD_SERVICES)
+endif # HAVE_SYSTEMD
diff --git a/openbsc/debian/osmo-bsc-mgcp.service b/openbsc/debian/osmo-bsc-mgcp.service
deleted file mode 120000
index eb73b7b70..000000000
--- a/openbsc/debian/osmo-bsc-mgcp.service
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/systemd/osmo-bsc-mgcp.service \ No newline at end of file