build: make logger and its man page optional

There are other packages that provide a logger program like util-linux
We should respekt that

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
This commit is contained in:
Lars Wendler 2019-11-18 12:08:26 +01:00
parent b22e1339c9
commit 227008ec0f
No known key found for this signature in database
GPG Key ID: 571DD2D0343C6039
3 changed files with 22 additions and 2 deletions

View File

@ -65,6 +65,10 @@ AC_ARG_WITH(systemd,
[AS_HELP_STRING([--with-systemd=DIR], [Directory for systemd service files])],,
[with_systemd=auto])
AC_ARG_WITH(logger,
AS_HELP_STRING([--without-logger], [Do not build/install logger binary and man page, default: enabled]),
[logger=$withval], [logger='yes'])
AS_IF([test "x$klogd" != "xno"],
with_klogd="yes"
AC_DEFINE(KLOGD, 1, [Build with klogd, default: built-in /dev/kmsg support in syslogd]),
@ -97,6 +101,12 @@ AS_IF([test "x$with_systemd" != "xno"],
[AC_SUBST([systemddir], [$with_systemd])])
AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemd" != "xno"])
AS_IF([test "x$logger" != "xno"], [
with_logger="yes"
AC_DEFINE(LOGGER, 1, [Build with logger])],
with_logger="no")
AM_CONDITIONAL([ENABLE_LOGGER], [test "x$with_logger" != "xno"])
# Expand $sbindir early, into $SBINDIR, for systemd unit file
# NOTE: This does *not* take prefix/exec_prefix override at "make
# install" into account, unfortunately.

View File

@ -1,4 +1,4 @@
dist_man1_MANS = logger.1
dist_man1_MANS =
dist_man3_MANS = syslogp.3
dist_man5_MANS = syslog.conf.5
dist_man8_MANS = syslogd.8
@ -6,3 +6,7 @@ dist_man8_MANS = syslogd.8
if ENABLE_KLOGD
dist_man8_MANS += klogd.8
endif
if ENABLE_LOGGER
dist_man1_MANS += logger.1
endif

View File

@ -16,7 +16,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bin_PROGRAMS = logger
bin_PROGRAMS =
sbin_PROGRAMS = syslogd
lib_LTLIBRARIES = libsyslog.la
noinst_LTLIBRARIES = libcompat.la
@ -25,6 +25,10 @@ if ENABLE_KLOGD
sbin_PROGRAMS += klogd
endif
if ENABLE_LOGGER
bin_PROGRAMS += logger
endif
AM_CFLAGS = -W -Wall -Wextra
AM_CFLAGS += -Wno-unused-result -Wno-unused-parameter -fno-strict-aliasing
AM_CPPFLAGS = -DSYSCONFDIR=\"@sysconfdir@\" -DLOCALSTATEDIR=\"@localstatedir@\"
@ -39,10 +43,12 @@ klogd_CPPFLAGS = $(AM_CPPFLAGS)
klogd_LDADD = $(LIBS) $(LIBOBJS)
klogd_LDADD += libsyslog.la
if ENABLE_LOGGER
logger_SOURCES = logger.c syslog.h
logger_CPPFLAGS = $(AM_CPPFLAGS) -D_XOPEN_SOURCE=600
logger_LDADD = $(LIBS) $(LIBOBJS)
logger_LDADD += libsyslog.la
endif
# Convenience library for libsyslog instead of linking with $(LTLIBOBJS),
# which would pull in pidfile() and other (strong) symbols as well.