])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.)
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
APACHE_FAST_OUTPUT($mpmpath/Makefile)
if test -z "$2"; then
+ APR_ADDTO(AP_LIBS, [$6])
libname="lib$1.la"
cat >$mpmpath/modules.mk<<EOF
$libname: $objects
shobjects=`echo $objects | sed 's/\.lo/.slo/g'`
cat >$mpmpath/modules.mk<<EOF
$libname: $shobjects
- \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $objects
+ \$(SH_LINK) -rpath \$(libexecdir) -module -avoid-version $objects $6
DISTCLEAN_TARGETS = modules.mk
static =
shared = $libname
fi
])
+dnl
+dnl APACHE_CHECK_SERF
+dnl
+dnl Configure for the detected libserf, giving preference to
+dnl "--with-serf=<path>" 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
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])
#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"
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)])
#include <signal.h>
#include <limits.h> /* for INT_MAX */
-#include "mod_serf.h"
-#if AP_HAS_SERF
+#if HAVE_SERF
+#include "mod_serf.h"
#include "serf.h"
#endif
static apr_pollset_t *event_pollset;
-#if AP_HAS_SERF
+#if HAVE_SERF
typedef struct {
apr_pollset_t *pollset;
apr_pool_t *pool;
{
PT_CSD,
PT_ACCEPT
-#if AP_HAS_SERF
+#if HAVE_SERF
, PT_SERF
#endif
} poll_type_e;
}
-#if AP_HAS_SERF
+#if HAVE_SERF
static apr_status_t s_socket_add(void *user_baton,
apr_pollfd_t *pfd,
void *serf_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;
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 :( */
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. */
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) */