94399e0
diff --git a/acinclude.m4 b/acinclude.m4
94399e0
index 580eb4a..bd7e2c9 100644
94399e0
--- a/acinclude.m4
94399e0
+++ b/acinclude.m4
94399e0
@@ -594,6 +594,30 @@ AC_DEFUN(APACHE_CHECK_OPENSSL,[
94399e0
   fi
94399e0
 ])
94399e0
 
94399e0
+AC_DEFUN(APACHE_CHECK_SYSTEMD, [                                                                        
94399e0
+dnl Check for systemd support for listen.c's socket activation.
94399e0
+case $host in
94399e0
+*-linux-*)
94399e0
+   if test -n "$PKGCONFIG" && $PKGCONFIG --exists libsystemd; then
94399e0
+      SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
94399e0
+   elif test -n "$PKGCONFIG" && $PKGCONFIG --exists libsystemd-daemon; then
94399e0
+      SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd-daemon`
94399e0
+   else
94399e0
+      AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon")
94399e0
+   fi
94399e0
+   if test -n "$SYSTEMD_LIBS"; then
94399e0
+      AC_CHECK_HEADERS(systemd/sd-daemon.h)
94399e0
+      if test "${ac_cv_header_systemd_sd_daemon_h}" = "no" || test -z "${SYSTEMD_LIBS}"; then
94399e0
+        AC_MSG_WARN([Your system does not support systemd.])
94399e0
+      else
94399e0
+        APR_ADDTO(LIBS, [$SYSTEMD_LIBS])
94399e0
+        AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is supported])
94399e0
+      fi
94399e0
+   fi
94399e0
+   ;;
94399e0
+esac
94399e0
+])
94399e0
+
94399e0
 dnl
94399e0
 dnl APACHE_EXPORT_ARGUMENTS
94399e0
 dnl Export (via APACHE_SUBST) the various path-related variables that
94399e0
diff --git a/configure.in b/configure.in
94399e0
index 19a5f88..f096de3 100644
94399e0
--- a/configure.in
94399e0
+++ b/configure.in
94399e0
@@ -509,6 +509,8 @@ if test "$ac_cv_struct_tm_gmtoff" = "yes"; then
94399e0
     AC_DEFINE(HAVE_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field])
94399e0
 fi
94399e0
 
94399e0
+APACHE_CHECK_SYSTEMD
94399e0
+
94399e0
 dnl ## Set up any appropriate OS-specific environment variables for apachectl
94399e0
 
94399e0
 case $host in