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