From: Joe Orton Date: Tue, 1 Oct 2013 10:15:12 +0000 (+0000) Subject: * configure.in: Simplify/fix systemd detection: move later to fix X-Git-Tag: 2.5.0-alpha~4988 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f6f568d30c9718df3b0474529b6663100f5bba41;p=apache * configure.in: Simplify/fix systemd detection: move later to fix autoconf warnings; define HAVE_SYSTEMD rather than using CPPFLAGS. * server/listen.c: Use HAVE_SYSTEMD for systemd #define. * modules/arch/unix/config5.m4: Update systemd headers check. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1528032 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/configure.in b/configure.in index bcde867078..5fd99f37a1 100644 --- a/configure.in +++ b/configure.in @@ -322,15 +322,6 @@ case $host in APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1]) ;; *-linux-*) - AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon") - AC_CHECK_HEADERS(systemd/sd-daemon.h, [ap_HAVE_SD_DAEMON_H="yes"], [ap_HAVE_SD_DAEMON_H="no"]) - if test $ap_HAVE_SD_DAEMON_H = "no" || test -z "${SYSTEMD_LIBS}"; then - AC_MSG_WARN([Your system does not support systemd.]) - else - APR_ADDTO(LIBS, $SYSTEMD_LIBS) - APR_ADDTO(INTERNAL_CPPFLAGS, [-DAP_SYSTEMD_SUPPORT]) - fi - case `uname -r` in # Unserialized accept() was not recommended until Linux 2.2. [[01]].* | 2.[[01]]* ) @@ -522,6 +513,19 @@ if test "$ac_cv_struct_tm_gmtoff" = "yes"; then AC_DEFINE(HAVE_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field]) fi +dnl Check for systemd support for listen.c's socket activation. +case $host in +*-linux-*) + AC_CHECK_LIB(systemd-daemon, sd_notify, SYSTEMD_LIBS="-lsystemd-daemon") + AC_CHECK_HEADERS(systemd/sd-daemon.h) + if test "${ac_cv_header_systemd_sd_daemon_h}" = "no" || test -z "${SYSTEMD_LIBS}"; then + AC_MSG_WARN([Your system does not support systemd.]) + else + APR_ADDTO(LIBS, $SYSTEMD_LIBS) + AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is supported]) + fi +esac + dnl ## Set up any appropriate OS-specific environment variables for apachectl case $host in diff --git a/modules/arch/unix/config5.m4 b/modules/arch/unix/config5.m4 index a992ae2813..e6c154ba1f 100644 --- a/modules/arch/unix/config5.m4 +++ b/modules/arch/unix/config5.m4 @@ -21,7 +21,7 @@ APACHE_MODULE(privileges, Per-virtualhost Unix UserIDs and enhanced security for ]) APACHE_MODULE(systemd, Systemd support, , , all, [ - if test $ap_HAVE_SD_DAEMON_H = "no" || test -z "${SYSTEMD_LIBS}"; then + if test "${ac_cv_header_systemd_sd_daemon_h}" = "no" || test -z "${SYSTEMD_LIBS}"; then AC_MSG_WARN([Your system does not support systemd.]) enable_systemd="no" else diff --git a/server/listen.c b/server/listen.c index 7cf2e5f0cf..f9c4266d3a 100644 --- a/server/listen.c +++ b/server/listen.c @@ -28,7 +28,7 @@ #include "http_log.h" #include "mpm_common.h" -#ifdef AP_SYSTEMD_SUPPORT +#ifdef HAVE_SYSTEMD #include #endif @@ -42,7 +42,7 @@ static ap_listen_rec *old_listeners; static int ap_listenbacklog; static int send_buffer_size; static int receive_buffer_size; -#ifdef AP_SYSTEMD_SUPPORT +#ifdef HAVE_SYSTEMD static int use_systemd; #endif @@ -249,7 +249,7 @@ static apr_status_t close_listeners_on_exec(void *v) } -#ifdef AP_SYSTEMD_SUPPORT +#ifdef HAVE_SYSTEMD static apr_status_t alloc_systemd_listener(process_rec * process, int fd, @@ -371,7 +371,7 @@ static int open_systemd_listeners(process_rec *process) return 0; } -#endif /* AP_SYSTEMD_SUPPORT */ +#endif /* HAVE_SYSTEMD */ static const char *alloc_listener(process_rec *process, char *addr, apr_port_t port, const char* proto, @@ -692,7 +692,7 @@ AP_DECLARE(int) ap_setup_listeners(server_rec *s) } -#ifdef AP_SYSTEMD_SUPPORT +#ifdef HAVE_SYSTEMD if (use_systemd) { if (open_systemd_listeners(s->process) != 0) { return 0; @@ -778,7 +778,7 @@ AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy, } if (strcmp("systemd", argv[0]) == 0) { -#ifdef AP_SYSTEMD_SUPPORT +#ifdef HAVE_SYSTEMD use_systemd = 1; if (ap_listeners != NULL) { return "systemd socket activation support must be used exclusive of normal listeners."; @@ -789,7 +789,7 @@ AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy, #endif } -#ifdef AP_SYSTEMD_SUPPORT +#ifdef HAVE_SYSTEMD if (use_systemd) { return "systemd socket activation support must be used exclusive of normal listeners."; }