From: Stefan Fritsch Date: Sun, 13 Jun 2010 17:50:54 +0000 (+0000) Subject: Fix MPM event/libserf build problems: If libserf was installed during build, X-Git-Tag: 2.3.7~186 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed06b71981674c609e3520e0f475d7358067fb12;p=apache Fix MPM event/libserf build problems: If libserf was installed during build, MPM event was picking up the headers but not linking with libserf, causing unresolved symbol errors. Now build MPM event with or without serf support depending on --with-serf being specified or not. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@954273 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/acinclude.m4 b/acinclude.m4 index 6f7fe7466c..5976690dd3 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -201,7 +201,7 @@ EOF ])dnl dnl -dnl APACHE_MPM_MODULE(name[, shared[, objects[, config[, path]]]]) +dnl APACHE_MPM_MODULE(name[, shared[, objects[, config[, path[, libs]]]]]) dnl dnl Provide information for building the MPM. (Enablement is handled using dnl --with-mpm/--enable-mpms-shared.) @@ -211,6 +211,7 @@ dnl shared -- "shared" to indicate shared module build, empty string otherwise dnl objects -- one or more .lo files to link into the MPM module (default: mpmname.lo) dnl config -- configuration logic to run if the MPM is enabled dnl path -- relative path to MPM (default: server/mpm/mpmname) +dnl libs -- libs needed by this MPM dnl AC_DEFUN(APACHE_MPM_MODULE,[ if ap_mpm_is_enabled $1; then @@ -232,6 +233,7 @@ AC_DEFUN(APACHE_MPM_MODULE,[ APACHE_FAST_OUTPUT($mpmpath/Makefile) if test -z "$2"; then + APR_ADDTO(AP_LIBS, [$6]) libname="lib$1.la" cat >$mpmpath/modules.mk<$mpmpath/modules.mk<" if it was specified. +dnl +AC_DEFUN([APACHE_CHECK_SERF], [ + AC_CACHE_CHECK([for libserf], [ac_cv_serf], [ + ac_cv_serf=no + serf_prefix=no + SERF_LIBS="" + AC_ARG_WITH(serf, APACHE_HELP_STRING([--with-serf=PREFIX], + [Serf client library]), + [ + if test "$withval" = "yes" ; then + serf_prefix=/usr + else + serf_prefix=$withval + fi + ]) + + if test "$serf_prefix" != "no" ; then + save_cppflags="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $APR_INCLUDES $APU_INCLUDES -I$serf_prefix/include/serf-0" + AC_CHECK_HEADERS(serf.h,[ + save_ldflags="$LDFLAGS" + LDFLAGS="$LDFLAGS -L$serf_prefix/lib" + AC_CHECK_LIB(serf-0, serf_context_create,[ac_cv_serf="yes"]) + LDFLAGS="$save_ldflags"]) + CPPFLAGS="$save_cppflags" + fi + ]) + + APACHE_SUBST(SERF_LIBS) + if test "$ac_cv_serf" = "yes"; then + AC_DEFINE(HAVE_SERF, 1, [Define if libserf is available]) + APR_SETVAR(SERF_LIBS, [-L$serf_prefix/lib -lserf-0]) + APR_ADDTO(INCLUDES, [-I$serf_prefix/include/serf-0]) + fi +]) + + dnl dnl APACHE_EXPORT_ARGUMENTS dnl Export (via APACHE_SUBST) the various path-related variables that diff --git a/modules/proxy/config.m4 b/modules/proxy/config.m4 index f382dde8ed..ad24349a9c 100644 --- a/modules/proxy/config.m4 +++ b/modules/proxy/config.m4 @@ -59,37 +59,13 @@ APACHE_MODULE(proxy_fdpass, Apache proxy to Unix Daemon Socket module, $proxy_fd APACHE_MODULE(proxy_ajp, Apache proxy AJP module, $proxy_ajp_objs, , $proxy_mods_enable) APACHE_MODULE(proxy_balancer, Apache proxy BALANCER module, $proxy_balancer_objs, , $proxy_mods_enable) - -AC_DEFUN([CHECK_SERF], [ - serf_found="no" - AC_ARG_WITH(serf, APACHE_HELP_STRING([--with-serf=PREFIX], - [Serf client library]), - [ - if test "$withval" = "yes" ; then - AC_MSG_ERROR([--with-serf requires an argument.]) +APACHE_MODULE(serf, [Reverse proxy module using Serf], , , no, [ + APACHE_CHECK_SERF + if test "$ac_cv_serf" = "yes" ; then + APR_SETVAR(MOD_SERF_LDADD, [\$(SERF_LIBS)]) else - serf_prefix=$withval - save_cppflags="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $APR_INCLUDES $APU_INCLUDES -I$serf_prefix/include/serf-0" - AC_CHECK_HEADERS(serf.h,[ - save_ldflags="$LDFLAGS" - LDFLAGS="$LDFLAGS -L$serf_prefix/lib" - AC_CHECK_LIB(serf-0, serf_context_create,[serf_found="yes"]) - LDFLAGS="$save_ldflags"]) - CPPFLAGS="$save_cppflags" + AC_MSG_ERROR("libserf not found") fi - ]) - - if test "$serf_found" = "yes"; then - MOD_SERF_LDADD="-L$serf_prefix/lib -lserf-0" - APR_ADDTO(INCLUDES, ["-I$serf_prefix/include/serf-0"]) - else - AC_MSG_ERROR(unable to find serf) - fi -]) - -APACHE_MODULE(serf, [Reverse proxy module using Serf], , , no, [ - CHECK_SERF ]) APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/$modpath_current]) diff --git a/modules/proxy/mod_serf.h b/modules/proxy/mod_serf.h index 2aaaa3dc3b..90353ad305 100644 --- a/modules/proxy/mod_serf.h +++ b/modules/proxy/mod_serf.h @@ -26,11 +26,8 @@ #if !defined(WIN32) && !defined(NETWARE) #include "ap_config_auto.h" #endif -#ifdef HAVE_SERF_H +#ifdef HAVE_SERF #include "serf.h" -#ifndef AP_HAS_SERF -#define AP_HAS_SERF 1 -#endif #endif #include "ap_provider.h" diff --git a/server/mpm/event/config3.m4 b/server/mpm/event/config3.m4 index 649d863874..abe66477c6 100644 --- a/server/mpm/event/config3.m4 +++ b/server/mpm/event/config3.m4 @@ -1,5 +1,11 @@ dnl ## XXX - Need a more thorough check of the proper flags to use +APACHE_CHECK_SERF +if test "$ac_cv_serf" = yes ; then + APR_SETVAR(MOD_MPM_EVENT_LDADD,[\$(SERF_LIBS)]) +fi +APACHE_SUBST(MOD_MPM_EVENT_LDADD) + APACHE_MPM_MODULE(event, $enable_mpm_event, event.lo fdqueue.lo pod.lo,[ AC_CHECK_FUNCS(pthread_kill) -]) +], , [\$(MOD_MPM_EVENT_LDADD)]) diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index c7f6b0ec30..371eb6620d 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -95,9 +95,9 @@ #include #include /* for INT_MAX */ -#include "mod_serf.h" -#if AP_HAS_SERF +#if HAVE_SERF +#include "mod_serf.h" #include "serf.h" #endif @@ -178,7 +178,7 @@ static struct timeout_head_t timeout_head, keepalive_timeout_head; static apr_pollset_t *event_pollset; -#if AP_HAS_SERF +#if HAVE_SERF typedef struct { apr_pollset_t *pollset; apr_pool_t *pool; @@ -210,7 +210,7 @@ typedef enum { PT_CSD, PT_ACCEPT -#if AP_HAS_SERF +#if HAVE_SERF , PT_SERF #endif } poll_type_e; @@ -796,7 +796,7 @@ static void dummy_signal_handler(int sig) } -#if AP_HAS_SERF +#if HAVE_SERF static apr_status_t s_socket_add(void *user_baton, apr_pollfd_t *pfd, void *serf_baton) @@ -823,7 +823,7 @@ static apr_status_t s_socket_remove(void *user_baton, static apr_status_t init_pollset(apr_pool_t *p) { -#if AP_HAS_SERF +#if HAVE_SERF s_baton_t *baton = NULL; #endif apr_status_t rv; @@ -868,7 +868,7 @@ static apr_status_t init_pollset(apr_pool_t *p) lr->accept_func = ap_unixd_accept; } -#if AP_HAS_SERF +#if HAVE_SERF baton = apr_pcalloc(p, sizeof(*baton)); baton->pollset = event_pollset; /* TODO: subpools, threads, reuse, etc. -- currently use malloc() inside :( */ @@ -1095,7 +1095,7 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) apr_thread_mutex_unlock(g_timer_ring_mtx); } -#if AP_HAS_SERF +#if HAVE_SERF rc = serf_context_prerun(g_serf); if (rc != APR_SUCCESS) { /* TOOD: what should do here? ugh. */ @@ -1233,7 +1233,7 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) ap_push_pool(worker_queue_info, ptrans); } } /* if:else on pt->type */ -#if AP_HAS_SERF +#if HAVE_SERF else if (pt->type == PT_SERF) { /* send socket to serf. */ /* XXXX: this doesn't require get_worker(&have_idle_worker) */