]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
configure.ac: Clean up systemd support
authorFrank Lichtenheld <frank@lichtenheld.com>
Fri, 9 Jan 2026 16:35:08 +0000 (17:35 +0100)
committerGert Doering <gert@greenie.muc.de>
Fri, 9 Jan 2026 17:19:26 +0000 (18:19 +0100)
- Do not try to handle very old systemd that was released
  over ten years ago (remove SYSTEMD_NEWER_THAN_216)
- Do not require systemd.pc. I can't find any indication
  that we use any of the variables defined by it. (It
  does not define any libraries, just variables)
- Remove check for sd-daemon.h. We did not use the
  conditional and assumed it was there already.
- Allow libsystemd.pc to define cflags. Previously we
  ignored those.

Change-Id: Ie59e03ce01575acaeaf690f582eb5cfa80eb37fc
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1463
Message-Id: <20260109163514.23051-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35203.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
config.h.cmake.in
configure.ac
src/openvpn/Makefile.am
src/openvpn/console_systemd.c
src/openvpn/init.c

index 01bbadc63d7a832b41cf743d0c3674f3eb284d1d..53976a76dda21dcaa13c3bb837b1c45081f2f3f0 100644 (file)
 /* Define to 1 if you have the <syslog.h> header file. */
 #cmakedefine HAVE_SYSLOG_H
 
-/* Define to 1 if you have the <systemd/sd-daemon.h> header file. */
-#undef HAVE_SYSTEMD_SD_DAEMON_H
-
 /* Define to 1 if you have the <sys/epoll.h> header file. */
 #cmakedefine HAVE_SYS_EPOLL_H
 
 /* Path to systemd-ask-password tool */
 #undef SYSTEMD_ASK_PASSWORD_PATH
 
-/* systemd is newer than v216 */
-#define SYSTEMD_NEWER_THAN_216
-
 /* The tap-windows id */
 #define TAP_WIN_COMPONENT_ID "tap0901"
 
index 8ba5673885eaecbe4fbc9bcd16095f2ab3f09b8c..63d4d6e54d6d723024da8020ff414e14f01851a3 100644 (file)
@@ -1139,28 +1139,14 @@ dnl Check for systemd
 dnl
 AM_CONDITIONAL([ENABLE_SYSTEMD], [test "${enable_systemd}" = "yes"])
 if test "$enable_systemd" = "yes" ; then
-    PKG_CHECK_MODULES([libsystemd], [systemd libsystemd],
+    PKG_CHECK_MODULES([libsystemd], [libsystemd > 216],
                       [],
-                      [PKG_CHECK_MODULES([libsystemd], [libsystemd-daemon])]
+                      [AC_MSG_ERROR([systemd enabled but libsystemd is missing])]
                       )
 
-    PKG_CHECK_EXISTS([libsystemd > 216],
-                     [AC_DEFINE([SYSTEMD_NEWER_THAN_216], [1],
-                           [systemd is newer than v216])]
-                    )
-
-    AC_CHECK_HEADERS(systemd/sd-daemon.h,
-       ,
-       [
-          AC_MSG_ERROR([systemd development headers not found.])
-       ])
-
-    saved_LIBS="${LIBS}"
-    LIBS="${LIBS} ${libsystemd_LIBS}"
-    AC_CHECK_FUNCS([sd_booted], [], [AC_MSG_ERROR([systemd library is missing sd_booted()])])
+    OPTIONAL_SYSTEMD_CFLAGS="${libsystemd_CFLAGS}"
     OPTIONAL_SYSTEMD_LIBS="${libsystemd_LIBS}"
     AC_DEFINE(ENABLE_SYSTEMD, 1, [Enable systemd integration])
-    LIBS="${saved_LIBS}"
 
     if test -n "${SYSTEMD_UNIT_DIR}"; then
         systemdunitdir="${SYSTEMD_UNIT_DIR}"
@@ -1377,6 +1363,7 @@ AC_SUBST([OPTIONAL_LZO_CFLAGS])
 AC_SUBST([OPTIONAL_LZO_LIBS])
 AC_SUBST([OPTIONAL_LZ4_CFLAGS])
 AC_SUBST([OPTIONAL_LZ4_LIBS])
+AC_SUBST([OPTIONAL_SYSTEMD_CFLAGS])
 AC_SUBST([OPTIONAL_SYSTEMD_LIBS])
 AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS])
 AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
index 19c21c0f7cb349369ef67ec4fee61d69ba26a4d7..c8795855dcc621c8cddb048c5d69abd4894e10e3 100644 (file)
@@ -28,6 +28,7 @@ AM_CFLAGS = \
        $(OPTIONAL_LIBNL_GENL_CFLAGS) \
        $(OPTIONAL_LZO_CFLAGS) \
        $(OPTIONAL_LZ4_CFLAGS) \
+       $(OPTIONAL_SYSTEMD_CFLAGS) \
        $(OPTIONAL_PKCS11_HELPER_CFLAGS) \
        $(OPTIONAL_INOTIFY_CFLAGS) \
        -DPLUGIN_LIBDIR=\"${plugindir}\" \
index d277bd4f4d203fe30fdbff1898373e5b4c65a427..9588b958cb4fa1b0fbf22df5b4015116b4397082 100644 (file)
@@ -61,13 +61,10 @@ get_console_input_systemd(const char *prompt, const bool echo, char *input, cons
     struct argv argv = argv_new();
 
     argv_printf(&argv, SYSTEMD_ASK_PASSWORD_PATH);
-#ifdef SYSTEMD_NEWER_THAN_216
-    /* the --echo support arrived in upstream systemd 217 */
     if (echo)
     {
         argv_printf_cat(&argv, "--echo");
     }
-#endif
     argv_printf_cat(&argv, "--icon network-vpn");
     argv_printf_cat(&argv, "--timeout=0");
     argv_printf_cat(&argv, "%s", prompt);
index c014a91dc08e9adb708ef6ceb6cb0db5c325e110..b690dff9734ae784f084afc0a4e5a0eb8857b62f 100644 (file)
@@ -1545,7 +1545,7 @@ initialization_sequence_completed(struct context *c, const unsigned int flags)
 #else
 #ifdef ENABLE_SYSTEMD
         sd_notifyf(0, "STATUS=Failed to start up: %s With Errors\nERRNO=1", message);
-#endif /* HAVE_SYSTEMD_SD_DAEMON_H */
+#endif
         msg(M_INFO, "%s With Errors", message);
 #endif
     }
@@ -5052,4 +5052,4 @@ do_test_crypto(struct context *c)
     packet_id_free(&c->c2.crypto_options.packet_id);
 
     context_gc_free(c);
-}
\ No newline at end of file
+}