Proper systemd support
Follow the directions on integrating systemd with autotools provided by the systemd documentation itself: https://www.freedesktop.org/software/systemd/man/daemon.html#Installing%20systemd%20Service%20Files The snippet has been adapted to better match our coding style, e.g. directly use of `if` instead of `AS_IF`.
This commit is contained in:
parent
779437feef
commit
1d65f6617f
|
|
@ -29,6 +29,9 @@
|
|||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
AM_DISTCHECK_CONFIGURE_FLAGS = \
|
||||
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
|
||||
|
||||
SUBDIRS = \
|
||||
include \
|
||||
script
|
||||
|
|
|
|||
30
configure.ac
30
configure.ac
|
|
@ -45,6 +45,7 @@ AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2 subdir-objects])
|
|||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_SRCDIR([config.h.in])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
PKG_PROG_PKG_CONFIG
|
||||
PKG_INSTALLDIR()
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
@ -1078,6 +1079,35 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# systemd service support
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_WITH([systemdsystemunitdir],
|
||||
AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
|
||||
[Directory for systemd service files]),
|
||||
,
|
||||
[with_systemdsystemunitdir=auto]
|
||||
)
|
||||
|
||||
case "${with_systemdsystemunitdir}" in
|
||||
yes)
|
||||
with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
|
||||
if test "x$with_systemdsystemunitdir" = "x"; then
|
||||
AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])
|
||||
fi
|
||||
;;
|
||||
no)
|
||||
with_systemdsystemunitdir=
|
||||
;;
|
||||
auto)
|
||||
with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
|
||||
;;
|
||||
esac
|
||||
|
||||
AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "x")
|
||||
AC_SUBST(systemdsystemunitdir,[$with_systemdsystemunitdir])
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
|
|
|
|||
|
|
@ -35,9 +35,6 @@ SUBDIRS = init.d sysconfig
|
|||
|
||||
sbin_SCRIPTS = ethercatctl
|
||||
|
||||
systemddir = $(libdir)/systemd/system
|
||||
systemd_DATA = ethercat.service
|
||||
|
||||
dist_sysconf_DATA = ethercat.conf
|
||||
|
||||
EXTRA_DIST = \
|
||||
|
|
@ -49,4 +46,8 @@ BUILT_SOURCES = \
|
|||
ethercatctl \
|
||||
ethercat.service
|
||||
|
||||
if HAVE_SYSTEMD
|
||||
systemdsystemunit_DATA = ethercat.service
|
||||
endif
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue