]> granicus.if.org Git - apache/blob - modules/cache/config.m4
More configure time dependencies:
[apache] / modules / cache / config.m4
1 dnl modules enabled in this directory by default
2
3 dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]])
4
5 APACHE_MODPATH_INIT(cache)
6
7 APACHE_MODULE(file_cache, File cache, , , most)
8
9 dnl #  list of object files for mod_cache
10 cache_objs="dnl
11 mod_cache.lo dnl
12 cache_storage.lo dnl
13 cache_util.lo dnl
14 "
15 cache_disk_objs="mod_cache_disk.lo"
16
17 case "$host" in
18   *os2*)
19     # OS/2 DLLs must resolve all symbols at build time
20     # and we need some from main cache module
21     cache_disk_objs="$cache_disk_objs mod_cache.la"
22     ;;
23 esac
24
25 APACHE_MODULE(cache, dynamic file caching.  At least one storage management module (e.g. mod_cache_disk) is also necessary., $cache_objs, , most)
26 APACHE_MODULE(cache_disk, disk caching module, $cache_disk_objs, , most, , cache)
27
28 dnl
29 dnl APACHE_CHECK_DISTCACHE
30 dnl
31 dnl Configure for the detected distcache installation, giving
32 dnl preference to "--with-distcache=<path>" if it was specified.
33 dnl
34 AC_DEFUN(APACHE_CHECK_DISTCACHE,[
35 if test "x$ap_distcache_configured" = "x"; then
36   dnl initialise the variables we use
37   ap_distcache_found=""
38   ap_distcache_base=""
39   ap_distcache_libs=""
40   ap_distcache_ldflags=""
41   ap_distcache_with=""
42
43   dnl Determine the distcache base directory, if any
44   AC_MSG_CHECKING([for user-provided distcache base])
45   AC_ARG_WITH(distcache, APACHE_HELP_STRING(--with-distcache=DIR, Distcache installation directory), [
46     dnl If --with-distcache specifies a directory, we use that directory or fail
47     if test "x$withval" != "xyes" -a "x$withval" != "x"; then
48       dnl This ensures $withval is actually a directory and that it is absolute
49       ap_distcache_with="yes"
50       ap_distcache_base="`cd $withval ; pwd`"
51     fi
52   ])
53   if test "x$ap_distcache_base" = "x"; then
54     AC_MSG_RESULT(none)
55   else
56     AC_MSG_RESULT($ap_distcache_base)
57   fi
58
59   dnl Run header and version checks
60   saved_CPPFLAGS="$CPPFLAGS"
61   saved_LIBS="$LIBS"
62   saved_LDFLAGS="$LDFLAGS"
63
64   if test "x$ap_distcache_base" != "x"; then
65     APR_ADDTO(CPPFLAGS, [-I$ap_distcache_base/include])
66     APR_ADDTO(INCLUDES, [-I$ap_distcache_base/include])
67     APR_ADDTO(LDFLAGS, [-L$ap_distcache_base/lib])
68     APR_ADDTO(ap_distcache_ldflags, [-L$ap_distcache_base/lib])
69     if test "x$ap_platform_runtime_link_flag" != "x"; then
70       APR_ADDTO(LDFLAGS, [$ap_platform_runtime_link_flag$ap_distcache_base/lib])
71       APR_ADDTO(ap_distcache_ldflags, [$ap_platform_runtime_link_flag$ap_distcache_base/lib])
72     fi
73   fi
74   dnl First check for mandatory headers
75   AC_CHECK_HEADERS([distcache/dc_client.h], [ap_distcache_found="yes"], [])
76   if test "$ap_distcache_found" = "yes"; then
77     dnl test for a good version
78     AC_MSG_CHECKING(for distcache version)
79     AC_TRY_COMPILE([#include <distcache/dc_client.h>],[
80 #if DISTCACHE_CLIENT_API != 0x0001
81 #error "distcache API version is unrecognised"
82 #endif],
83       [],
84       [ap_distcache_found="no"])
85     AC_MSG_RESULT($ap_distcache_found)
86   fi
87   if test "$ap_distcache_found" != "yes"; then
88     if test "x$ap_distcache_with" = "x"; then
89       AC_MSG_WARN([...No distcache detected])
90     else
91       AC_MSG_ERROR([...No distcache detected])
92     fi
93   else
94     dnl Run library and function checks
95     AC_MSG_CHECKING(for distcache libraries)
96     ap_distcache_libs="-ldistcache -lnal"
97     APR_ADDTO(LIBS, [$ap_distcache_libs])
98
99     AC_TRY_LINK(
100       [#include <distcache/dc_client.h>],
101       [DC_CTX *foo = DC_CTX_new((const char *)0,0);],
102       [],
103       [ap_distcache_found="no"])
104     AC_MSG_RESULT($ap_distcache_found)
105     if test "$ap_distcache_found" != "yes"; then
106       if test "x$ap_distcache_base" = "x"; then
107         AC_MSG_WARN([... Error, distcache libraries were missing or unusable])
108       else
109         AC_MSG_ERROR([... Error, distcache libraries were missing or unusable])
110       fi
111     fi
112   fi
113
114   dnl restore
115   CPPFLAGS="$saved_CPPFLAGS"
116   LIBS="$saved_LIBS"
117   LDFLAGS="$saved_LDFLAGS"
118
119   dnl Adjust apache's configuration based on what we found above.
120   if test "$ap_distcache_found" = "yes"; then
121     APR_ADDTO(MOD_SOCACHE_DC_LDADD, [$ap_distcache_ldflags $ap_distcache_libs])
122     AC_DEFINE(HAVE_DISTCACHE, 1, [Define if distcache support is enabled])
123   else
124     enable_socache_dc=no
125   fi
126   ap_distcache_configured="yes"
127 fi
128 ])
129
130 APACHE_MODULE(socache_shmcb,  shmcb small object cache provider, , , most)
131 APACHE_MODULE(socache_dbm, dbm small object cache provider, , , most)
132 APACHE_MODULE(socache_memcache, memcache small object cache provider, , , most)
133 APACHE_MODULE(socache_dc, distcache small object cache provider, , , no, [
134     APACHE_CHECK_DISTCACHE
135 ])
136
137 APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/$modpath_current])
138
139 APACHE_MODPATH_FINISH