Skip to content

Commit

Permalink
add support for installing systemd unit files
Browse files Browse the repository at this point in the history
This patch adds a standard --with-systemdsystemunitdir configure option
that:

  * without explicit options it does nothing with the unit file
  * if --with-systemdsystemunitdir is specified without arguments,
    it tries to autodetect the path using pkg-config
  * if --without-systemdsystemunitdir is specified, it does nothing
  * if --with-systemdsystemunitdir is specified with an argument, it
    uses that directory to install the unit file into


Signed-off-by: Dave Reisner <[email protected]>
Signed-off-by: Balazs Scheidler <[email protected]>
  • Loading branch information
bazsi committed Jul 1, 2011
1 parent d233321 commit db89491
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
23 changes: 22 additions & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ AC_ARG_WITH(ld-library-path,
[ --with-ld-library-path=path Set LD_LIBRARY_PATH during runtime to the value given],
env_ld_library_path=$with_ld_library_path)

AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]))

AC_ARG_ENABLE(debug,
[ --enable-debug Enable debugging code.],, enable_debug="no")

Expand Down Expand Up @@ -877,6 +880,22 @@ if test "x$enable_systemd" = "xauto"; then
else
enable_systemd=no
fi

fi

if test "x$enable_systemd" = "xyes"; then
if test "x$with_systemdsystemunitdir" = "xyes"; then
# no arguments, just --with-systemdsystemunitdir
systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd);
if test "$systemdsystemunitdir" = ""; then
AC_MSG_ERROR([Error autodetecting systemdsystemunitdir, systemd pkg-config file not found?])
fi
elif test "$systemdsystemunitdir" = "no"; then
# --without-systemdsystemunitdir was specified
systemdsystemunitdir=""
else
systemdsystemunitdir="$with_systemdsystemunitdir"
fi
fi

dnl ***************************************************************************
Expand Down Expand Up @@ -1026,6 +1045,7 @@ AC_DEFINE_UNQUOTED(ENABLE_SYSTEMD, `enable_value $enable_systemd`, [Enable syste

AM_CONDITIONAL(ENABLE_ENV_WRAPPER, [test "$enable_env_wrapper" = "yes"])
AM_CONDITIONAL(ENABLE_SYSTEMD, [test "$enable_systemd" = "yes"])
AM_CONDITIONAL(ENABLE_SYSTEMD_UNIT_INSTALL, [test "$systemdsystemunitdir" != ""])
AM_CONDITIONAL(ENABLE_SSL, [test "$enable_ssl" = "yes"])
AM_CONDITIONAL(ENABLE_SQL, [test "$enable_sql" = "yes"])
AM_CONDITIONAL(ENABLE_SUN_STREAMS, [test "$enable_sun_streams" = "yes"])
Expand All @@ -1040,6 +1060,7 @@ AC_SUBST(timezonedir)
AC_SUBST(pidfiledir)
AC_SUBST(moduledir)
AC_SUBST(expanded_sysconfdir)
AC_SUBST(systemdsystemunitdir)
AC_SUBST(SYSLOGNG_LINK)
AC_SUBST(SYSLOGNG_DEPS_LIBS)
AC_SUBST(TOOL_DEPS_LIBS)
Expand Down Expand Up @@ -1135,7 +1156,7 @@ echo " tcp-wrapper support : ${enable_tcp_wrapper:=no}"
echo " Linux capability support : ${enable_linux_caps:=no}"
echo " PCRE support : ${enable_pcre:=no}"
echo " Env wrapper support : ${enable_env_wrapper:=no}"
echo " systemd support : ${enable_systemd:=no}"
echo " systemd support : ${enable_systemd:=no} (unit dir: ${systemdsystemunitdir:=none})"
echo " Modules:"
echo " Module search path : ${module_path}"
echo " Default module list : ${default_modules}"
Expand Down
9 changes: 8 additions & 1 deletion contrib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ EXTRA_DIST = README init.d.solaris init.d.HP-UX init.d.RedHat init.d.SuSE \
balabit-initscripts/init.d \
balabit-initscripts/init.d.freebsd \
balabit-initscripts/init-functions \
upstart/syslog-ng.conf.upstart
upstart/syslog-ng.conf.upstart \
systemd/syslog-ng.service

if ENABLE_SYSTEMD_UNIT_INSTALL

systemdsystemunit_DATA = systemd/syslog-ng.service

endif
11 changes: 11 additions & 0 deletions contrib/systemd/syslog-ng.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=System Logger Daemon

[Service]
Sockets=syslog.socket
ExecStartPre=/bin/systemctl stop systemd-kmsg-syslogd.service
ExecStart=/usr/sbin/syslog-ng -F
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

0 comments on commit db89491

Please sign in to comment.