diff --git a/Makefile.am b/Makefile.am index 2f0a78694..9f3644f29 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,12 +12,16 @@ SUBDIRS = \ doc \ include \ src \ + contrib \ tests \ $(NULL) 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/configure.ac b/configure.ac index 03acc0ccf..2d8dc425e 100644 --- a/configure.ac +++ b/configure.ac @@ -181,6 +181,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"]) @@ -203,4 +219,6 @@ AC_OUTPUT( tests/msc_vlr/Makefile doc/Makefile doc/examples/Makefile + contrib/Makefile + contrib/systemd/Makefile Makefile) diff --git a/contrib/Makefile.am b/contrib/Makefile.am new file mode 100644 index 000000000..3439c97be --- /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 000000000..86481725f --- /dev/null +++ b/contrib/systemd/Makefile.am @@ -0,0 +1,5 @@ +if HAVE_SYSTEMD +EXTRA_DIST = osmo-msc.service +systemdsystemunit_DATA = \ + osmo-msc.service +endif diff --git a/debian/osmo-msc.install b/debian/osmo-msc.install index 6b84b8f14..1e7f22f2a 100644 --- a/debian/osmo-msc.install +++ b/debian/osmo-msc.install @@ -1,3 +1,4 @@ +lib/systemd/system/osmo-msc.service usr/bin/osmo-msc usr/share/doc/osmo-msc/examples/osmo-msc/osmo-msc.cfg usr/share/doc/osmo-msc/examples usr/share/doc/osmo-msc/examples/osmo-msc/osmo-msc_custom-sccp.cfg usr/share/doc/osmo-msc/examples diff --git a/debian/osmo-msc.service b/debian/osmo-msc.service deleted file mode 120000 index 784b8b51d..000000000 --- a/debian/osmo-msc.service +++ /dev/null @@ -1 +0,0 @@ -../contrib/systemd/osmo-msc.service \ No newline at end of file diff --git a/debian/rules b/debian/rules index 15e79dae4..1cf3a355e 100755 --- a/debian/rules +++ b/debian/rules @@ -42,11 +42,11 @@ # main packaging script based on dh7 syntax %: - dh $@ --with autoreconf + dh $@ --with autoreconf # debmake generated override targets # Set options for ./configure -CONFIGURE_FLAGS += --enable-iu --enable-smpp +CONFIGURE_FLAGS += --enable-iu --enable-smpp --with-systemdsystemunitdir=/lib/systemd/system override_dh_auto_configure: dh_auto_configure -- $(CONFIGURE_FLAGS) #