INN commit: branches/2.6 (15 files)

INN Commit rra at isc.org
Mon Jan 4 07:12:28 UTC 2021


    Date: Sunday, January 3, 2021 @ 23:12:27
  Author: iulius
Revision: 10483

Added preliminary support for systemd notifications

Integrate necessary Autoconf macros and portability headers to use
systemd.  Right now, only notifications of innd startup and mode changes
are notified to the unit system.

Thanks to Marco d'Itri for this first systemd integration into INN.

Added:
  branches/2.6/include/portable/sd-daemon.h
    (from rev 10474, trunk/include/portable/sd-daemon.h)
  branches/2.6/m4/pkg.m4
    (from rev 10474, trunk/m4/pkg.m4)
  branches/2.6/m4/systemd.m4
    (from rev 10474, trunk/m4/systemd.m4)
Modified:
  branches/2.6/MANIFEST
  branches/2.6/Makefile.global.in
  branches/2.6/configure.ac
  branches/2.6/doc/pod/hacking.pod
  branches/2.6/doc/pod/install.pod
  branches/2.6/doc/pod/news.pod
  branches/2.6/innd/Makefile
  branches/2.6/innd/cc.c
  branches/2.6/innd/innd.c
  branches/2.6/innd/innd.h
  branches/2.6/support/getrra-c-util
  branches/2.6/tests/Makefile

------------------------------+
 MANIFEST                     |    3 
 Makefile.global.in           |    5 
 configure.ac                 |    3 
 doc/pod/hacking.pod          |   24 ++-
 doc/pod/install.pod          |    7 +
 doc/pod/news.pod             |    7 +
 include/portable/sd-daemon.h |   37 +++++
 innd/Makefile                |  247 +++++++++++++++++++-----------------
 innd/cc.c                    |   56 ++++++++
 innd/innd.c                  |    6 
 innd/innd.h                  |    1 
 m4/pkg.m4                    |  275 +++++++++++++++++++++++++++++++++++++++++
 m4/systemd.m4                |   61 +++++++++
 support/getrra-c-util        |    2 
 tests/Makefile               |    3 
 15 files changed, 611 insertions(+), 126 deletions(-)

Modified: MANIFEST
===================================================================
--- MANIFEST	2021-01-04 07:03:51 UTC (rev 10482)
+++ MANIFEST	2021-01-04 07:12:27 UTC (rev 10483)
@@ -422,6 +422,7 @@
 include/portable/getnameinfo.h        getnameinfo replacement header
 include/portable/macros.h             Set of portability macros
 include/portable/mmap.h               Wrapper for <sys/mman.h>
+include/portable/sd-daemon.h          Portable setup for systemd-daemon
 include/portable/setproctitle.h       Portable setup for setproctitle
 include/portable/socket-unix.h        Wrapper for <sys/un.h> and SUN_LEN
 include/portable/socket.h             Wrapper for <sys/socket.h> and friends
@@ -587,6 +588,7 @@
 m4/pam-const.m4                       Autoconf macro for PAM using const
 m4/paths.m4                           Autoconf macro for installation paths
 m4/perl.m4                            Autoconf macro for Perl support
+m4/pkg.m4                             Autoconf macro to use pkg-config
 m4/prog-ensure.m4                     Autoconf macro for finding programs
 m4/python.m4                          Autoconf macro for Python support
 m4/sasl.m4                            Autoconf macro for SASL libraries
@@ -596,6 +598,7 @@
 m4/socket-unix.m4                     Autoconf macros to check UNIX domain sockets
 m4/socket.m4                          Autoconf macros to check socket support
 m4/syslog.m4                          Autoconf macro for syslog facility
+m4/systemd.m4                         Autoconf macros for systemd support
 m4/users.m4                           Autoconf macro for INN users
 m4/vamacros.m4                        Autoconf macro to check variadic macros
 m4/zlib.m4                            Autoconf macro for zlib

Modified: Makefile.global.in
===================================================================
--- Makefile.global.in	2021-01-04 07:03:51 UTC (rev 10482)
+++ Makefile.global.in	2021-01-04 07:12:27 UTC (rev 10483)
@@ -201,6 +201,11 @@
 KRB5_LDFLAGS	= @KRB5_LDFLAGS@
 KRB5_LIBS	= @KRB5_LIBS@
 
+##  Systemd support.  Additional flags and libraries used when compiling or
+##  linking code that contains systemd support.
+SYSTEMD_CFLAGS	= @SYSTEMD_CFLAGS@
+SYSTEMD_LIBS	= @SYSTEMD_LIBS@
+
 ##  Missing functions.	If non-empty, configure detected that your system
 ##  was missing some standard functions, and INN will be providing its own
 ##  replacements from the lib directory.

Modified: configure.ac
===================================================================
--- configure.ac	2021-01-04 07:03:51 UTC (rev 10482)
+++ configure.ac	2021-01-04 07:12:27 UTC (rev 10483)
@@ -57,6 +57,7 @@
 m4_include([m4/pam-const.m4])
 m4_include([m4/paths.m4])
 m4_include([m4/perl.m4])
+m4_include([m4/pkg.m4])
 m4_include([m4/prog-ensure.m4])
 m4_include([m4/python.m4])
 m4_include([m4/sasl.m4])
@@ -66,6 +67,7 @@
 m4_include([m4/socket-unix.m4])
 m4_include([m4/socket.m4])
 m4_include([m4/syslog.m4])
+m4_include([m4/systemd.m4])
 m4_include([m4/users.m4])
 m4_include([m4/vamacros.m4])
 m4_include([m4/zlib.m4])
@@ -429,6 +431,7 @@
 INN_LIB_KRB5_OPTIONAL
 INN_LIB_OPENSSL_OPTIONAL
 INN_LIB_SASL_OPTIONAL
+INN_LIB_SYSTEMD_DAEMON_OPTIONAL
 INN_LIB_ZLIB_OPTIONAL
 
 dnl If Kerberos is found, define KRB5_AUTH to auth_krb5 so as to build

Modified: doc/pod/hacking.pod
===================================================================
--- doc/pod/hacking.pod	2021-01-04 07:03:51 UTC (rev 10482)
+++ doc/pod/hacking.pod	2021-01-04 07:12:27 UTC (rev 10483)
@@ -75,7 +75,8 @@
 B<debuild -us -uc>); the canonical versions of the former two files
 are available from L<ftp://ftp.gnu.org/gnu/config/> (which currently
 redirects to L<http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree>).
-In addition, F<m4/libtool.m4> and a few others m4 files used
+
+In addition, F<m4/libtool.m4> and a few other m4 files used
 by INN are just a copy of the corresponding files in the
 F<debian/tmp/usr/share/aclocal> subdirectory of the Debian
 package of the libtool distribution.  (Using libtool without
@@ -83,11 +84,16 @@
 should be checked in periodically when available.  There are no
 INN-specific modifications to those files except for F<ltmain.sh>
 which recognizes the additional B<-S> flag that INN's B<install-sh>
-script uses.  This script should also be updated at the same time from
+script uses, and a fix for a proper handling of circular dependencies.
+
+This B<install-sh> script should also be updated at the same time from
 L<http://git.savannah.gnu.org/gitweb/?p=automake.git;a=tree;f=lib>;
-it similarly contains local modifications mentioned in a comment
+it similarly contains a local modification mentioned in a comment
 at the beginning of the file.
 
+Finally, the F<m4/pkg.m4> macro should be updated from
+L<https://cgit.freedesktop.org/pkg-config/tree/>.
+
 =head1 Autobuilds
 
 Automatic build logs on several platforms are available at
@@ -652,10 +658,11 @@
 =item *
 
 Make sure that F<support/config.guess>, F<support/config.sub>,
-F<support/install-sh>, F<support/ltmain.sh> and libtool m4 files
+F<support/install-sh>, F<support/ltmain.sh>, libtool m4 files
 (F<libtool.m4>, F<ltoptions.m4>, F<ltsugar.m4>, F<ltversion.m4> and
-F<lt~obsolete.m4>) are the latest versions.  See the instructions in
-L<"Configuring and Portability"> for details on how to update these files.
+F<lt~obsolete.m4>) and F<m4/pkg.m4> are the latest versions.  See the
+instructions in L<"Configuring and Portability"> for details on how to
+update these files.
 
 =item *
 
@@ -724,6 +731,11 @@
 warnings on (C<make warnings>) and run the test suite (C<make tests>).
 Fix any errors.
 
+Several builds with different configure-time options should be tested,
+so as to be sure they work fine (especially B<--enable-shared=no>,
+B<--enable-tagged-hash>, B<--enable-keywords>, B<--enable-largefiles>
+and B<--enable-reduced-depends>).
+
 =item 3.
 
 Update copyright years in F<LICENSE>.

Modified: doc/pod/install.pod
===================================================================
--- doc/pod/install.pod	2021-01-04 07:03:51 UTC (rev 10482)
+++ doc/pod/install.pod	2021-01-04 07:12:27 UTC (rev 10483)
@@ -139,6 +139,13 @@
 
 =item *
 
+If you want to use systemd notifications, you'll need to have
+B<pkg-config> and B<libsystemd> (along with its F<libsystemd.pc>
+configuration) installed so that this feature is enabled at configure
+time.
+
+=item *
+
 Many of INN's optional features require other packages (primarily
 libraries) be installed.  If you wish to use any of these optional
 features, you will need to install those packages first.  Here is a table

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2021-01-04 07:03:51 UTC (rev 10482)
+++ doc/pod/news.pod	2021-01-04 07:12:27 UTC (rev 10483)
@@ -51,6 +51,13 @@
 
 =item *
 
+Added preliminary support for systemd notifications.  Use of more
+features provided by systemd, including more notifications, will come
+in future releases.  Thanks to Marco d'Itri for this first systemd
+integration into INN.
+
+=item *
+
 Added new B<--enable-hardening-flags> configure-time option,
 enabled by default, to use hardening build flags like C<-fPIE> and
 C<-fstack-protector-strong>.  This option can easily be disabled if the

Copied: branches/2.6/include/portable/sd-daemon.h (from rev 10474, trunk/include/portable/sd-daemon.h)
===================================================================
--- include/portable/sd-daemon.h	                        (rev 0)
+++ include/portable/sd-daemon.h	2021-01-04 07:12:27 UTC (rev 10483)
@@ -0,0 +1,37 @@
+/* $Id$
+ *
+ * Portability wrapper around systemd-daemon headers.
+ *
+ * Currently, only sd_listen_fds and sd_notify are guaranteed to be provided
+ * by this interface.  This takes the approach of stubbing out these functions
+ * if the libsystemd-daemon library is not available, rather than providing a
+ * local implementation, on the grounds that anyone who wants systemd status
+ * reporting should be able to build with the systemd libraries.
+ *
+ * The canonical version of this file is maintained in the rra-c-util package,
+ * which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
+ *
+ * Written by Russ Allbery <eagle at eyrie.org>
+ * Copyright 2014
+ *     The Board of Trustees of the Leland Stanford Junior University
+ *
+ * Copying and distribution of this file, with or without modification, are
+ * permitted in any medium without royalty provided the copyright notice and
+ * this notice are preserved.  This file is offered as-is, without any
+ * warranty.
+ *
+ * SPDX-License-Identifier: FSFAP
+ */
+
+#ifndef PORTABLE_SD_DAEMON_H
+#define PORTABLE_SD_DAEMON_H 1
+
+#ifdef HAVE_SD_NOTIFY
+#    include <systemd/sd-daemon.h>
+#else
+#    define SD_LISTEN_FDS_START 3
+#    define sd_listen_fds(u)    0
+#    define sd_notify(u, s)     0
+#endif
+
+#endif /* !PORTABLE_SD_DAEMON_H */

Modified: innd/Makefile
===================================================================
--- innd/Makefile	2021-01-04 07:03:51 UTC (rev 10482)
+++ innd/Makefile	2021-01-04 07:12:27 UTC (rev 10483)
@@ -3,7 +3,7 @@
 include ../Makefile.global
 
 top	        = ..
-CFLAGS		= $(GCFLAGS) $(TCLINC)
+CFLAGS		= $(GCFLAGS) $(TCLINC) $(SYSTEMD_CFLAGS)
 
 ALL		= innd tinyleaf
 
@@ -34,6 +34,7 @@
 ##  Compilation rules.
 
 INNDLIBS 	= $(LIBSTORAGE) $(LIBHIST) $(LIBINN) $(STORAGE_LIBS) \
+		  $(SYSTEMD_LIBS) \
 		  $(PERL_LIBS) $(PYTHON_LIBS) $(REGEX_LIBS) $(LIBS)
 
 perl.o:		perl.c   ; $(CC) $(CFLAGS) $(PERL_CPPFLAGS) -c perl.c
@@ -77,13 +78,13 @@
   ../include/portable/stdbool.h ../include/portable/macros.h \
   ../include/inn/innconf.h ../include/inn/md5.h ../include/inn/ov.h \
   ../include/inn/history.h ../include/inn/storage.h \
-  ../include/inn/options.h ../include/inn/storage.h \
-  ../include/inn/vector.h ../include/inn/wire.h innd.h \
-  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
-  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
-  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
-  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
-  ../include/inn/nntp.h ../include/inn/paths.h
+  ../include/inn/options.h ../include/inn/overview.h \
+  ../include/inn/storage.h ../include/inn/vector.h ../include/inn/wire.h \
+  innd.h ../include/portable/sd-daemon.h ../include/portable/socket.h \
+  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
+  ../include/inn/buffer.h ../include/inn/messages.h ../include/inn/timer.h \
+  ../include/inn/libinn.h ../include/inn/concat.h ../include/inn/xmalloc.h \
+  ../include/inn/xwrite.h ../include/inn/nntp.h ../include/inn/paths.h
 cc.o: cc.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -91,14 +92,14 @@
   ../include/config.h ../include/inn/macros.h \
   ../include/portable/stdbool.h ../include/portable/socket-unix.h \
   ../include/inn/innconf.h ../include/inn/qio.h innd.h \
-  ../include/portable/macros.h ../include/portable/socket.h \
-  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/inn/buffer.h ../include/inn/history.h \
-  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
-  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
-  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
-  ../include/inn/options.h ../include/inn/vector.h \
-  ../include/inn/inndcomm.h ../include/innperl.h
+  ../include/portable/macros.h ../include/portable/sd-daemon.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
+  ../include/inn/history.h ../include/inn/messages.h \
+  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
+  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
+  ../include/inn/vector.h ../include/inn/inndcomm.h ../include/innperl.h
 chan.o: chan.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -108,12 +109,12 @@
   ../include/inn/portable-socket.h ../include/inn/portable-getaddrinfo.h \
   ../include/inn/portable-getnameinfo.h ../include/inn/innconf.h \
   ../include/inn/network.h innd.h ../include/portable/macros.h \
-  ../include/portable/socket.h ../include/inn/buffer.h \
-  ../include/inn/history.h ../include/inn/messages.h \
-  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
-  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
-  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
-  ../include/inn/vector.h
+  ../include/portable/sd-daemon.h ../include/portable/socket.h \
+  ../include/inn/buffer.h ../include/inn/history.h \
+  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
+  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
+  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
+  ../include/inn/options.h ../include/inn/vector.h
 icd.o: icd.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -124,12 +125,13 @@
   ../include/inn/portable-getaddrinfo.h \
   ../include/inn/portable-getnameinfo.h ../include/inn/innconf.h \
   ../include/inn/mmap.h innd.h ../include/portable/macros.h \
-  ../include/portable/socket.h ../include/inn/buffer.h \
-  ../include/inn/history.h ../include/inn/messages.h \
-  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
-  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
-  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
-  ../include/inn/vector.h ../include/inn/ov.h ../include/inn/storage.h
+  ../include/portable/sd-daemon.h ../include/portable/socket.h \
+  ../include/inn/buffer.h ../include/inn/history.h \
+  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
+  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
+  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
+  ../include/inn/options.h ../include/inn/vector.h ../include/inn/ov.h \
+  ../include/inn/storage.h
 innd.o: innd.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -137,13 +139,14 @@
   ../include/config.h ../include/inn/macros.h \
   ../include/portable/stdbool.h ../include/inn/innconf.h \
   ../include/inn/messages.h ../include/inn/newsuser.h ../include/innperl.h \
-  innd.h ../include/portable/macros.h ../include/portable/socket.h \
-  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/inn/buffer.h ../include/inn/history.h ../include/inn/timer.h \
-  ../include/inn/libinn.h ../include/inn/concat.h ../include/inn/xmalloc.h \
-  ../include/inn/xwrite.h ../include/inn/nntp.h ../include/inn/paths.h \
-  ../include/inn/storage.h ../include/inn/options.h \
-  ../include/inn/vector.h ../include/inn/ov.h ../include/inn/storage.h
+  innd.h ../include/portable/macros.h ../include/portable/sd-daemon.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
+  ../include/inn/history.h ../include/inn/timer.h ../include/inn/libinn.h \
+  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
+  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
+  ../include/inn/options.h ../include/inn/vector.h ../include/inn/ov.h \
+  ../include/inn/storage.h
 keywords.o: keywords.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -152,11 +155,11 @@
   ../include/portable/stdbool.h ../include/inn/libinn.h \
   ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
   ../include/inn/innconf.h innd.h ../include/portable/macros.h \
-  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
-  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
-  ../include/inn/history.h ../include/inn/messages.h \
-  ../include/inn/timer.h ../include/inn/nntp.h ../include/inn/paths.h \
-  ../include/inn/storage.h ../include/inn/options.h \
+  ../include/portable/sd-daemon.h ../include/portable/socket.h \
+  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
+  ../include/inn/buffer.h ../include/inn/history.h \
+  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/nntp.h \
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
   ../include/inn/vector.h
 lc.o: lc.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
@@ -164,14 +167,14 @@
   ../include/inn/defines.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/macros.h \
   ../include/portable/stdbool.h ../include/inn/innconf.h innd.h \
-  ../include/portable/macros.h ../include/portable/socket.h \
-  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/inn/buffer.h ../include/inn/history.h \
-  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
-  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
-  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
-  ../include/inn/options.h ../include/inn/vector.h \
-  ../include/portable/socket-unix.h
+  ../include/portable/macros.h ../include/portable/sd-daemon.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
+  ../include/inn/history.h ../include/inn/messages.h \
+  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
+  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
+  ../include/inn/vector.h ../include/portable/socket-unix.h
 nc.o: nc.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -179,13 +182,14 @@
   ../include/config.h ../include/inn/macros.h \
   ../include/portable/stdbool.h ../include/inn/innconf.h \
   ../include/inn/qio.h ../include/inn/version.h innd.h \
-  ../include/portable/macros.h ../include/portable/socket.h \
-  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/inn/buffer.h ../include/inn/history.h \
-  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
-  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
-  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
-  ../include/inn/options.h ../include/inn/vector.h
+  ../include/portable/macros.h ../include/portable/sd-daemon.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
+  ../include/inn/history.h ../include/inn/messages.h \
+  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
+  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
+  ../include/inn/vector.h
 newsfeeds.o: newsfeeds.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -192,13 +196,14 @@
   ../include/inn/defines.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/macros.h \
   ../include/portable/stdbool.h ../include/inn/innconf.h innd.h \
-  ../include/portable/macros.h ../include/portable/socket.h \
-  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/inn/buffer.h ../include/inn/history.h \
-  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
-  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
-  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
-  ../include/inn/options.h ../include/inn/vector.h
+  ../include/portable/macros.h ../include/portable/sd-daemon.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
+  ../include/inn/history.h ../include/inn/messages.h \
+  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
+  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
+  ../include/inn/vector.h
 ng.o: ng.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -205,14 +210,14 @@
   ../include/inn/defines.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/macros.h \
   ../include/portable/stdbool.h ../include/inn/innconf.h innd.h \
-  ../include/portable/macros.h ../include/portable/socket.h \
-  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/inn/buffer.h ../include/inn/history.h \
-  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
-  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
-  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
-  ../include/inn/options.h ../include/inn/vector.h ../include/inn/ov.h \
-  ../include/inn/storage.h
+  ../include/portable/macros.h ../include/portable/sd-daemon.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
+  ../include/inn/history.h ../include/inn/messages.h \
+  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
+  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
+  ../include/inn/vector.h ../include/inn/ov.h ../include/inn/storage.h
 perl.o: perl.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -219,13 +224,14 @@
   ../include/inn/defines.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/macros.h \
   ../include/portable/stdbool.h ../include/inn/wire.h innd.h \
-  ../include/portable/macros.h ../include/portable/socket.h \
-  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/inn/buffer.h ../include/inn/history.h \
-  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
-  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
-  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
-  ../include/inn/options.h ../include/inn/vector.h \
+  ../include/portable/macros.h ../include/portable/sd-daemon.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
+  ../include/inn/history.h ../include/inn/messages.h \
+  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
+  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
+  ../include/inn/vector.h \
   ../include/ppport.h \
   ../include/innperl.h
 proc.o: proc.c ../include/config.h ../include/inn/defines.h \
@@ -234,13 +240,13 @@
   ../include/inn/defines.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/macros.h \
   ../include/portable/stdbool.h innd.h ../include/portable/macros.h \
-  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
-  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
-  ../include/inn/history.h ../include/inn/messages.h \
-  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
-  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
-  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
-  ../include/inn/vector.h
+  ../include/portable/sd-daemon.h ../include/portable/socket.h \
+  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
+  ../include/inn/buffer.h ../include/inn/history.h \
+  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
+  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
+  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
+  ../include/inn/options.h ../include/inn/vector.h
 python.o: python.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -248,13 +254,13 @@
   ../include/clibrary.h ../include/config.h ../include/inn/macros.h \
   ../include/portable/stdbool.h ../include/inn/innconf.h \
   ../include/inn/wire.h innd.h ../include/portable/macros.h \
-  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
-  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
-  ../include/inn/history.h ../include/inn/messages.h \
-  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
-  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
-  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
-  ../include/inn/vector.h
+  ../include/portable/sd-daemon.h ../include/portable/socket.h \
+  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
+  ../include/inn/buffer.h ../include/inn/history.h \
+  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
+  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
+  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
+  ../include/inn/options.h ../include/inn/vector.h
 rc.o: rc.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -265,11 +271,12 @@
   ../include/portable/getnameinfo.h ../include/inn/fdflag.h \
   ../include/inn/portable-socket.h ../include/inn/innconf.h \
   ../include/inn/network.h ../include/inn/network-innbind.h \
-  ../include/inn/vector.h innd.h ../include/inn/buffer.h \
-  ../include/inn/history.h ../include/inn/messages.h \
-  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
-  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
-  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h
+  ../include/inn/vector.h innd.h ../include/portable/sd-daemon.h \
+  ../include/inn/buffer.h ../include/inn/history.h \
+  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
+  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
+  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
+  ../include/inn/options.h
 site.o: site.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -278,12 +285,13 @@
   ../include/portable/stdbool.h ../include/inn/fdflag.h \
   ../include/inn/portable-socket.h ../include/inn/portable-getaddrinfo.h \
   ../include/inn/portable-getnameinfo.h ../include/inn/innconf.h innd.h \
-  ../include/portable/macros.h ../include/portable/socket.h \
-  ../include/inn/buffer.h ../include/inn/history.h \
-  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
-  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
-  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
-  ../include/inn/options.h ../include/inn/vector.h
+  ../include/portable/macros.h ../include/portable/sd-daemon.h \
+  ../include/portable/socket.h ../include/inn/buffer.h \
+  ../include/inn/history.h ../include/inn/messages.h \
+  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
+  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
+  ../include/inn/vector.h
 status.o: status.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -293,12 +301,12 @@
   ../include/portable/macros.h ../include/portable/getaddrinfo.h \
   ../include/portable/getnameinfo.h ../include/inn/network.h \
   ../include/inn/portable-socket.h ../include/inn/innconf.h \
-  ../include/inn/version.h innd.h ../include/inn/buffer.h \
-  ../include/inn/history.h ../include/inn/messages.h \
-  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
-  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
-  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
-  ../include/inn/vector.h ../include/innperl.h
+  ../include/inn/version.h innd.h ../include/portable/sd-daemon.h \
+  ../include/inn/buffer.h ../include/inn/history.h \
+  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
+  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
+  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
+  ../include/inn/options.h ../include/inn/vector.h ../include/innperl.h
 util.o: util.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \
@@ -309,10 +317,10 @@
   ../include/inn/portable-getnameinfo.h ../include/inn/innconf.h \
   ../include/inn/libinn.h ../include/inn/concat.h ../include/inn/xmalloc.h \
   ../include/inn/xwrite.h innd.h ../include/portable/macros.h \
-  ../include/portable/socket.h ../include/inn/buffer.h \
-  ../include/inn/history.h ../include/inn/messages.h \
-  ../include/inn/timer.h ../include/inn/nntp.h ../include/inn/paths.h \
-  ../include/inn/storage.h ../include/inn/options.h \
+  ../include/portable/sd-daemon.h ../include/portable/socket.h \
+  ../include/inn/buffer.h ../include/inn/history.h \
+  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/nntp.h \
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
   ../include/inn/vector.h
 wip.o: wip.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
@@ -320,13 +328,14 @@
   ../include/inn/defines.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h ../include/inn/macros.h \
   ../include/portable/stdbool.h ../include/inn/innconf.h innd.h \
-  ../include/portable/macros.h ../include/portable/socket.h \
-  ../include/portable/getaddrinfo.h ../include/portable/getnameinfo.h \
-  ../include/inn/buffer.h ../include/inn/history.h \
-  ../include/inn/messages.h ../include/inn/timer.h ../include/inn/libinn.h \
-  ../include/inn/concat.h ../include/inn/xmalloc.h ../include/inn/xwrite.h \
-  ../include/inn/nntp.h ../include/inn/paths.h ../include/inn/storage.h \
-  ../include/inn/options.h ../include/inn/vector.h
+  ../include/portable/macros.h ../include/portable/sd-daemon.h \
+  ../include/portable/socket.h ../include/portable/getaddrinfo.h \
+  ../include/portable/getnameinfo.h ../include/inn/buffer.h \
+  ../include/inn/history.h ../include/inn/messages.h \
+  ../include/inn/timer.h ../include/inn/libinn.h ../include/inn/concat.h \
+  ../include/inn/xmalloc.h ../include/inn/xwrite.h ../include/inn/nntp.h \
+  ../include/inn/paths.h ../include/inn/storage.h ../include/inn/options.h \
+  ../include/inn/vector.h
 tinyleaf.o: tinyleaf.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/macros.h \
   ../include/inn/portable-macros.h ../include/inn/portable-stdbool.h \

Modified: innd/cc.c
===================================================================
--- innd/cc.c	2021-01-04 07:03:51 UTC (rev 10482)
+++ innd/cc.c	2021-01-04 07:12:27 UTC (rev 10483)
@@ -174,6 +174,54 @@
 
 
 /*
+**  Notify systemd of the current operating modes.
+*/
+static void
+CCsdnotify(void)
+{
+#ifdef HAVE_SD_NOTIFY
+    int status;
+
+    buffer_sprintf(&CCreply, "STATUS=Server ");
+
+    /* Server's mode. */
+    switch (Mode) {
+    default:
+        buffer_append_sprintf(&CCreply, "Unknown %d", Mode);
+        break;
+    case OMrunning:
+        buffer_append_sprintf(&CCreply, "running");
+        break;
+    case OMpaused:
+        buffer_append_sprintf(&CCreply, "paused %s", ModeReason);
+        break;
+    case OMthrottled:
+        buffer_append_sprintf(&CCreply, "throttled %s", ModeReason);
+        break;
+    }
+    if (RejectReason)
+        buffer_append_sprintf(&CCreply, ". Rejecting %s", RejectReason);
+
+    /* Newsreaders. */
+    buffer_append_sprintf(&CCreply, ". Readers ");
+    if (innconf->readerswhenstopped)
+        buffer_append_sprintf(&CCreply, "independent ");
+    else
+        buffer_append_sprintf(&CCreply, "follow ");
+    if (NNRPReason == NULL)
+        buffer_append_sprintf(&CCreply, "enabled.");
+    else
+        buffer_append_sprintf(&CCreply, "disabled %s.", NNRPReason);
+
+    buffer_append(&CCreply, "", 1);
+    status = sd_notify(false, CCreply.data);
+    if (status < 0)
+        warn("cannot notify systemd of new status: %s", strerror(-status));
+#endif
+}
+
+
+/*
 **  Add <> around Message-ID if needed.
 */
 static const char *
@@ -292,6 +340,7 @@
 	return "1 Wrong reason";
     free(RejectReason);
     RejectReason = NULL;
+    CCsdnotify();
     return NULL;
 }
 
@@ -702,6 +751,7 @@
 	ErrorCount = IO_ERROR_COUNT;
     InndHisOpen();
     syslog(L_NOTICE, "%s running", LogName);
+    CCsdnotify();
     if (ICDneedsetup)
 	ICDsetup(true);
     SCHANwakeup(&Mode);
@@ -1116,6 +1166,7 @@
     case 'n':
 	if (!CCparsebool('n', (bool *)&innconf->readerswhenstopped, *p))
 	    return BADVAL;
+        CCsdnotify();
 	break;
     case 'o':
 	MaxOutgoing = atoi(p);
@@ -1198,6 +1249,7 @@
     }
     syslog(L_NOTICE, "%s %s %s",
 	LogName, NewMode == OMpaused ? "paused" : "throttled", reason);
+    CCsdnotify();
     return NULL;
 }
 
@@ -1255,6 +1307,7 @@
 	NNRPReason = xstrdup(p);
 	break;
     }
+    CCsdnotify();
     return NULL;
 }
 
@@ -1313,6 +1366,7 @@
     if (!is_valid_utf8(av[0]))
         return "1 Invalid UTF-8 reason";
     RejectReason = xstrdup(av[0]);
+    CCsdnotify();
     return NULL;
 }
 
@@ -2033,6 +2087,8 @@
 #if     defined(SIGUSR1)
     xsignal(SIGUSR1, CCresetup);
 #endif  /* defined(SIGUSR1) */
+
+    CCsdnotify();
 }
 
 

Modified: innd/innd.c
===================================================================
--- innd/innd.c	2021-01-04 07:03:51 UTC (rev 10482)
+++ innd/innd.c	2021-01-04 07:12:27 UTC (rev 10483)
@@ -364,6 +364,7 @@
     bool		ShouldRenumber;
     bool		ShouldSyntaxCheck;
     pid_t		pid;
+    int                 status;
 #if defined(_DEBUG_MALLOC_INC)
     union malloptarg	m;
 #endif	/* defined(_DEBUG_MALLOC_INC) */
@@ -773,7 +774,12 @@
         if (!ICDrenumberactive())
             die("SERVER cant renumber");
     }
+
     syslog(LOG_NOTICE, "SERVER starting");
+    status = sd_notify(false, "READY=1");
+    if (status < 0)
+        warn("cannot notify systemd of startup: %s", strerror(-status));
+
     CHANreadloop();
 
     /* CHANreadloop should never return. */

Modified: innd/innd.h
===================================================================
--- innd/innd.h	2021-01-04 07:03:51 UTC (rev 10482)
+++ innd/innd.h	2021-01-04 07:12:27 UTC (rev 10483)
@@ -29,6 +29,7 @@
 
 #include "config.h"
 #include "portable/macros.h"
+#include "portable/sd-daemon.h"
 #include "portable/socket.h"
 #include <ctype.h>
 #include <errno.h>

Copied: branches/2.6/m4/pkg.m4 (from rev 10474, trunk/m4/pkg.m4)
===================================================================
--- m4/pkg.m4	                        (rev 0)
+++ m4/pkg.m4	2021-01-04 07:12:27 UTC (rev 10483)
@@ -0,0 +1,275 @@
+# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+# serial 12 (pkg-config-0.29.2)
+
+dnl Copyright © 2004 Scott James Remnant <scott at netsplit.com>.
+dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists at gmail.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+dnl 02111-1307, USA.
+dnl
+dnl As a special exception to the GNU General Public License, if you
+dnl distribute this file as part of a program that contains a
+dnl configuration script generated by Autoconf, you may include it under
+dnl the same distribution terms that you use for the rest of that
+dnl program.
+
+dnl PKG_PREREQ(MIN-VERSION)
+dnl -----------------------
+dnl Since: 0.29
+dnl
+dnl Verify that the version of the pkg-config macros are at least
+dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
+dnl installed version of pkg-config, this checks the developer's version
+dnl of pkg.m4 when generating configure.
+dnl
+dnl To ensure that this macro is defined, also add:
+dnl m4_ifndef([PKG_PREREQ],
+dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
+dnl
+dnl See the "Since" comment for each macro you use to see what version
+dnl of the macros you require.
+m4_defun([PKG_PREREQ],
+[m4_define([PKG_MACROS_VERSION], [0.29.2])
+m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
+    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
+])dnl PKG_PREREQ
+
+dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
+dnl ----------------------------------
+dnl Since: 0.16
+dnl
+dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
+dnl first found in the path. Checks that the version of pkg-config found
+dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
+dnl used since that's the first version where most current features of
+dnl pkg-config existed.
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=m4_default([$1], [0.9.0])
+	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		AC_MSG_RESULT([yes])
+	else
+		AC_MSG_RESULT([no])
+		PKG_CONFIG=""
+	fi
+fi[]dnl
+])dnl PKG_PROG_PKG_CONFIG
+
+dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------------------------------
+dnl Since: 0.18
+dnl
+dnl Check to see whether a particular set of modules exists. Similar to
+dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
+dnl
+dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+dnl only at the first occurence in configure.ac, so if the first place
+dnl it's called might be skipped (such as if it is within an "if", you
+dnl have to call PKG_CHECK_EXISTS manually
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_default([$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+dnl ---------------------------------------------
+dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
+dnl pkg_failed based on the result.
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+    pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+    PKG_CHECK_EXISTS([$3],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes ],
+		     [pkg_failed=yes])
+ else
+    pkg_failed=untried
+fi[]dnl
+])dnl _PKG_CONFIG
+
+dnl _PKG_SHORT_ERRORS_SUPPORTED
+dnl ---------------------------
+dnl Internal check to see if pkg-config supports short errors.
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])dnl _PKG_SHORT_ERRORS_SUPPORTED
+
+
+dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl --------------------------------------------------------------
+dnl Since: 0.4.0
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
+dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $2])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+        AC_MSG_RESULT([no])
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+        else
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+	m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+        ])
+elif test $pkg_failed = untried; then
+        AC_MSG_RESULT([no])
+	m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+        ])
+else
+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+	$3
+fi[]dnl
+])dnl PKG_CHECK_MODULES
+
+
+dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl ---------------------------------------------------------------------
+dnl Since: 0.29
+dnl
+dnl Checks for existence of MODULES and gathers its build flags with
+dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+dnl and VARIABLE-PREFIX_LIBS from --libs.
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
+dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
+dnl configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])dnl PKG_CHECK_MODULES_STATIC
+
+
+dnl PKG_INSTALLDIR([DIRECTORY])
+dnl -------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable pkgconfigdir as the location where a module
+dnl should install pkg-config .pc files. By default the directory is
+dnl $libdir/pkgconfig, but the default can be changed by passing
+dnl DIRECTORY. The user can override through the --with-pkgconfigdir
+dnl parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+    [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_INSTALLDIR
+
+
+dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
+dnl --------------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable noarch_pkgconfigdir as the location where a
+dnl module should install arch-independent pkg-config .pc files. By
+dnl default the directory is $datadir/pkgconfig, but the default can be
+dnl changed by passing DIRECTORY. The user can override through the
+dnl --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+    [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_NOARCH_INSTALLDIR
+
+
+dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------
+dnl Since: 0.28
+dnl
+dnl Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])dnl PKG_CHECK_VAR

Copied: branches/2.6/m4/systemd.m4 (from rev 10474, trunk/m4/systemd.m4)
===================================================================
--- m4/systemd.m4	                        (rev 0)
+++ m4/systemd.m4	2021-01-04 07:12:27 UTC (rev 10483)
@@ -0,0 +1,61 @@
+dnl Probe for systemd libraries and installation paths.
+dnl $Id$
+dnl
+dnl Provides the INN_WITH_SYSTEMD_UNITDIR macro, which adds the
+dnl --with-systemdsystemunitdir configure flag, sets the systemdsystemunitdir
+dnl substitution variable, and provides the HAVE_SYSTEMD Automake conditional
+dnl to use to control whether to install unit files.
+dnl
+dnl Provides the INN_LIB_SYSTEMD_DAEMON_OPTIONAL macro, which sets
+dnl SYSTEMD_CFLAGS and SYSTEMD_LIBS substitution variables if
+dnl libsystemd-daemon is available and defines HAVE_SD_NOTIFY.  pkg-config
+dnl support for libsystemd-daemon is required for it to be detected.
+dnl
+dnl Depends on the Autoconf macros that come with pkg-config.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Written by Russ Allbery <eagle at eyrie.org>
+dnl Copyright 2015 Russ Allbery <eagle at eyrie.org>
+dnl Copyright 2013-2014
+dnl     The Board of Trustees of the Leland Stanford Junior University
+dnl
+dnl This file is free software; the authors give unlimited permission to copy
+dnl and/or distribute it, with or without modifications, as long as this
+dnl notice is preserved.
+dnl
+dnl SPDX-License-Identifier: FSFULLR
+
+dnl Ignore Automake conditionals if not using Automake.
+m4_define_default([AM_CONDITIONAL], [:])
+
+dnl Determine the systemd system unit directory, along with a configure flag
+dnl to override, and sets @systemdsystemunitdir at .  Provides the Automake
+dnl HAVE_SYSTEMD Automake conditional.
+AC_DEFUN([INN_WITH_SYSTEMD_UNITDIR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+ AS_IF([test x"$PKG_CONFIG" = x], [PKG_CONFIG=false])
+ AC_ARG_WITH([systemdsystemunitdir],
+    [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
+        [Directory for systemd service files])],
+    [],
+    [with_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`])
+ AS_IF([test x"$with_systemdsystemunitdir" != xno],
+    [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
+ AM_CONDITIONAL([HAVE_SYSTEMD],
+    [test -n "$with_systemdsystemunitdir" -a x"$with_systemdsystemunitdir" != xno])])
+
+dnl Check for libsystemd or libsystemd-daemon and define SYSTEMD_{CFLAGS,LIBS}
+dnl if it is available.  This is called INN_LIB_SYSTEMD_DAEMON_OPTIONAL since
+dnl it was originally written when libsystemd-daemon was separate, and only
+dnl checks for that library.  It may eventually make sense to retire this in
+dnl favor of a simple INN_LIB_SYSTEMD_OPTIONAL that isn't backward-compatible.
+AC_DEFUN([INN_LIB_SYSTEMD_DAEMON_OPTIONAL],
+[PKG_CHECK_EXISTS([libsystemd],
+    [PKG_CHECK_MODULES([SYSTEMD], [libsystemd])
+     AC_DEFINE([HAVE_SD_NOTIFY], 1, [Define if sd_notify is available.])],
+    [PKG_CHECK_EXISTS([libsystemd-daemon],
+        [PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon])
+         AC_DEFINE([HAVE_SD_NOTIFY], 1,
+            [Define if sd_notify is available.])])])])

Modified: support/getrra-c-util
===================================================================
--- support/getrra-c-util	2021-01-04 07:03:51 UTC (rev 10482)
+++ support/getrra-c-util	2021-01-04 07:12:27 UTC (rev 10483)
@@ -257,6 +257,7 @@
 download m4/sasl.m4 m4 sasl.m4
 download m4/socket-unix.m4 m4 socket-unix.m4
 download m4/socket.m4 m4 socket.m4
+download m4/systemd.m4 m4 systemd.m4
 download m4/vamacros.m4 m4 vamacros.m4
 download m4/zlib.m4 m4 zlib.m4
 
@@ -272,6 +273,7 @@
 download portable/macros.h include/portable macros.h
 download portable/mkstemp.c lib mkstemp.c
 download portable/reallocarray.c lib reallocarray.c
+download portable/sd-daemon.h include/portable sd-daemon.h
 download portable/setenv.c lib setenv.c
 download portable/seteuid.c lib seteuid.c
 download portable/socket.h include/portable socket.h

Modified: tests/Makefile
===================================================================
--- tests/Makefile	2021-01-04 07:03:51 UTC (rev 10482)
+++ tests/Makefile	2021-01-04 07:12:27 UTC (rev 10483)
@@ -68,7 +68,8 @@
 
 # The libraries innd needs to link.
 INNDLIBS        = $(LIBSTORAGE) $(LIBHIST) $(LIBINN) $(STORAGE_LIBS) \
-		$(PYTHON_LIBS) $(REGEX_LIBS) $(LIBS) $(PERL_LIBS)
+		  $(SYSTEMD_LIBS) \
+		  $(PYTHON_LIBS) $(REGEX_LIBS) $(LIBS) $(PERL_LIBS)
 
 runtests: runtests.o
 	$(LINK) runtests.o



More information about the inn-committers mailing list