diff options
author | Rainer Jung <rjung@apache.org> | 2011-07-04 15:03:01 +0200 |
---|---|---|
committer | Rainer Jung <rjung@apache.org> | 2011-07-04 15:03:01 +0200 |
commit | 1fa2322c04797b8ea69e896cb4c1c31b53e70a7c (patch) | |
tree | d6ae8825982275cc8f8475dea19544a3853ab50a /modules/cache | |
parent | Support reallyall option to configure also for (diff) | |
download | apache2-1fa2322c04797b8ea69e896cb4c1c31b53e70a7c.tar.xz apache2-1fa2322c04797b8ea69e896cb4c1c31b53e70a7c.zip |
1) Add --with-distcache to configure for choosing
the distcache installation directory.
2) Use correct build variable MOD_SOCACHE_DC_LDADD
instead of MOD_SOCACHE_LDADD in build macro.
Also made the macro a bit more consistent with the
SSL checking macro.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1142648 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/cache')
-rw-r--r-- | modules/cache/config.m4 | 102 |
1 files changed, 79 insertions, 23 deletions
diff --git a/modules/cache/config.m4 b/modules/cache/config.m4 index b70ec42332..6f742dd75f 100644 --- a/modules/cache/config.m4 +++ b/modules/cache/config.m4 @@ -25,47 +25,103 @@ esac APACHE_MODULE(cache, dynamic file caching. At least one storage management module (e.g. mod_cache_disk) is also necessary., $cache_objs, , most) APACHE_MODULE(cache_disk, disk caching module, $cache_disk_objs, , most) -AC_DEFUN([CHECK_DISTCACHE], [ - AC_CHECK_HEADER( - [distcache/dc_client.h], - [have_distcache=yes], - [have_distcache=no]) - if test "$have_distcache" = "yes"; then - AC_MSG_CHECKING(for Distcache version) - AC_TRY_COMPILE( -[#include <distcache/dc_client.h>], -[#if DISTCACHE_CLIENT_API != 0x0001 +dnl +dnl APACHE_CHECK_DISTCACHE +dnl +dnl Configure for the detected distcache installation, giving +dnl preference to "--with-distcache=<path>" if it was specified. +dnl +AC_DEFUN(APACHE_CHECK_DISTCACHE,[ +if test "x$ap_distcache_configured" = "x"; then + dnl initialise the variables we use + ap_distcache_found="" + ap_distcache_base="" + ap_distcache_libs="" + ap_distcache_ldflags="" + + dnl Determine the distcache base directory, if any + AC_MSG_CHECKING([for user-provided distcache base]) + AC_ARG_WITH(distcache, APACHE_HELP_STRING(--with-distcache=DIR, Distcache installation directory), [ + dnl If --with-distcache specifies a directory, we use that directory or fail + if test "x$withval" != "xyes" -a "x$withval" != "x"; then + dnl This ensures $withval is actually a directory and that it is absolute + ap_distcache_base="`cd $withval ; pwd`" + fi + ]) + if test "x$ap_distcache_base" = "x"; then + AC_MSG_RESULT(none) + else + AC_MSG_RESULT($ap_distcache_base) + fi + + dnl Run header and version checks + saved_CPPFLAGS="$CPPFLAGS" + saved_LIBS="$LIBS" + saved_LDFLAGS="$LDFLAGS" + + if test "x$ap_distcache_base" != "x"; then + APR_ADDTO(CPPFLAGS, [-I$ap_distcache_base/include]) + APR_ADDTO(INCLUDES, [-I$ap_distcache_base/include]) + APR_ADDTO(LDFLAGS, [-L$ap_distcache_base/lib]) + APR_ADDTO(ap_distcache_ldflags, [-L$ap_distcache_base/lib]) + if test "x$ap_platform_runtime_link_flag" != "x"; then + APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_distcache_base/lib]) + APR_ADDTO(ap_distcache_ldflags, [$ap_platform_runtime_link_flag$ap_distcache_base/lib]) + fi + fi + dnl First check for mandatory headers + AC_CHECK_HEADERS([distcache/dc_client.h], [ap_distcache_found="yes"], []) + if test "$ap_distcache_found" = "yes"; then + dnl test for a good version + AC_MSG_CHECKING(for distcache version) + AC_TRY_COMPILE([#include <distcache/dc_client.h>],[ +#if DISTCACHE_CLIENT_API != 0x0001 #error "distcache API version is unrecognised" #endif], -[], -[have_distcache=no]) - AC_MSG_RESULT($have_distcache) + [], + [ap_distcache_found="no"]) + AC_MSG_RESULT($ap_distcache_found) fi - if test "$have_distcache" = "yes"; then - AC_MSG_CHECKING(for Distcache libraries) - save_libs=$LIBS - LIBS="$LIBS -ldistcache -lnal" + if test "$ap_distcache_found" != "yes"; then + AC_MSG_ERROR([...No distcache detected]) + else + dnl Run library and function checks + AC_MSG_CHECKING(for distcache libraries) + ap_distcache_libs="-ldistcache -lnal" + APR_ADDTO(LIBS, [$ap_distcache_libs]) + AC_TRY_LINK( [#include <distcache/dc_client.h>], [DC_CTX *foo = DC_CTX_new((const char *)0,0);], [], - [have_distcache=no]) - LIBS=$save_libs - AC_MSG_RESULT($have_distcache) + [ap_distcache_found="no"]) + AC_MSG_RESULT($ap_distcache_found) + if test "$ap_distcache_found" != "yes"; then + AC_MSG_ERROR([... Error, distcache libraries were missing or unusable]) + fi fi - if test "$have_distcache" = "yes"; then - APR_ADDTO(MOD_SOCACHE_LDADD, [-ldistcache -lnal]) + + dnl restore + CPPFLAGS="$saved_CPPFLAGS" + LIBS="$saved_LIBS" + LDFLAGS="$saved_LDFLAGS" + + dnl Adjust apache's configuration based on what we found above. + if test "$ap_distcache_found" = "yes"; then + APR_ADDTO(MOD_SOCACHE_DC_LDADD, [$ap_distcache_ldflags $ap_distcache_libs]) AC_DEFINE(HAVE_DISTCACHE, 1, [Define if distcache support is enabled]) else enable_socache_dc=no fi + ap_distcache_configured="yes" +fi ]) APACHE_MODULE(socache_shmcb, shmcb small object cache provider, , , most) APACHE_MODULE(socache_dbm, dbm small object cache provider, , , most) APACHE_MODULE(socache_memcache, memcache small object cache provider, , , most) APACHE_MODULE(socache_dc, distcache small object cache provider, , , no, [ - CHECK_DISTCACHE + APACHE_CHECK_DISTCACHE ]) APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/$modpath_current]) |