Install systemd services with autotools

Change-Id: Ie4c7e81495181059d1dff1c194d52d11fb72ed03
This commit is contained in:
Pau Espin 2018-09-10 13:28:25 +02:00
parent 3e9c071aa6
commit 516697e29a
8 changed files with 32 additions and 2 deletions

View File

@ -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

View File

@ -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)

1
contrib/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS = systemd

View File

@ -0,0 +1,5 @@
if HAVE_SYSTEMD
EXTRA_DIST = osmo-pcu.service
systemdsystemunit_DATA = \
osmo-pcu.service
endif

View File

@ -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

View File

@ -1 +0,0 @@
../contrib/osmo-pcu.service

3
debian/rules vendored
View File

@ -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