52592b
diff --git a/Makefile.in b/Makefile.in
52592b
index ea8366e..06b8c5a 100644
52592b
--- a/Makefile.in
52592b
+++ b/Makefile.in
52592b
@@ -4,7 +4,7 @@ CLEAN_SUBDIRS = test
52592b
 
52592b
 PROGRAM_NAME         = $(progname)
52592b
 PROGRAM_SOURCES      = modules.c
52592b
-PROGRAM_LDADD        = buildmark.o $(HTTPD_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(PCRE_LIBS) $(EXTRA_LIBS) $(AP_LIBS) $(LIBS)
52592b
+PROGRAM_LDADD        = buildmark.o $(HTTPD_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(HTTPD_LIBS) $(EXTRA_LIBS) $(AP_LIBS) $(LIBS)
52592b
 PROGRAM_PRELINK      = $(COMPILE) -c $(top_srcdir)/server/buildmark.c
52592b
 PROGRAM_DEPENDENCIES = \
52592b
   server/libmain.la \
52592b
diff --git a/acinclude.m4 b/acinclude.m4
52592b
index ce1d637..0ad0c13 100644
52592b
--- a/acinclude.m4
52592b
+++ b/acinclude.m4
52592b
@@ -606,6 +606,30 @@ AC_DEFUN([APACHE_CHECK_OPENSSL],[
52592b
   fi
52592b
 ])
52592b
 
52592b
+AC_DEFUN(APACHE_CHECK_SYSTEMD, [                                                                        
52592b
+dnl Check for systemd support for listen.c's socket activation.
52592b
+case $host in
52592b
+*-linux-*)
52592b
+   if test -n "$PKGCONFIG" && $PKGCONFIG --exists libsystemd; then
52592b
+      SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd`
52592b
+   elif test -n "$PKGCONFIG" && $PKGCONFIG --exists libsystemd-daemon; then
52592b
+      SYSTEMD_LIBS=`$PKGCONFIG --libs libsystemd-daemon`
52592b
+   else
52592b
+      AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon")
52592b
+   fi
52592b
+   if test -n "$SYSTEMD_LIBS"; then
52592b
+      AC_CHECK_HEADERS(systemd/sd-daemon.h)
52592b
+      if test "${ac_cv_header_systemd_sd_daemon_h}" = "no" || test -z "${SYSTEMD_LIBS}"; then
52592b
+        AC_MSG_WARN([Your system does not support systemd.])
52592b
+      else
52592b
+        APR_ADDTO(HTTPD_LIBS, [$SYSTEMD_LIBS])
52592b
+        AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is supported])
52592b
+      fi
52592b
+   fi
52592b
+   ;;
52592b
+esac
52592b
+])
52592b
+
52592b
 dnl
52592b
 dnl APACHE_EXPORT_ARGUMENTS
52592b
 dnl Export (via APACHE_SUBST) the various path-related variables that
52592b
diff --git a/configure.in b/configure.in
52592b
index 82bfeef..eedba50 100644
52592b
--- a/configure.in
52592b
+++ b/configure.in
52592b
@@ -234,6 +234,7 @@ if test "$PCRE_CONFIG" != "false"; then
52592b
   AC_MSG_NOTICE([Using external PCRE library from $PCRE_CONFIG])
52592b
   APR_ADDTO(PCRE_INCLUDES, [`$PCRE_CONFIG --cflags`])
52592b
   APR_ADDTO(PCRE_LIBS, [`$PCRE_CONFIG --libs`])
52592b
+  APR_ADDTO(HTTPD_LIBS, [\$(PCRE_LIBS)])
52592b
 else
52592b
   AC_MSG_ERROR([pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/])
52592b
 fi
52592b
@@ -504,6 +505,8 @@ if test "$ac_cv_struct_tm_gmtoff" = "yes"; then
52592b
     AC_DEFINE(HAVE_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field])
52592b
 fi
52592b
 
52592b
+APACHE_CHECK_SYSTEMD
52592b
+
52592b
 dnl ## Set up any appropriate OS-specific environment variables for apachectl
52592b
 
52592b
 case $host in
52592b
@@ -677,6 +680,7 @@ APACHE_SUBST(OS_DIR)
52592b
 APACHE_SUBST(BUILTIN_LIBS)
52592b
 APACHE_SUBST(SHLIBPATH_VAR)
52592b
 APACHE_SUBST(OS_SPECIFIC_VARS)
52592b
+APACHE_SUBST(HTTPD_LIBS)
52592b
 
52592b
 PRE_SHARED_CMDS='echo ""'
52592b
 POST_SHARED_CMDS='echo ""'