diff options
author | Nokis Mavrogiannopoulos | 2008-03-05 17:38:09 +0000 |
---|---|---|
committer | Nokis Mavrogiannopoulos | 2008-03-05 17:38:09 +0000 |
commit | 2cb49bd5137176e1445550399b6e9592607858a3 (patch) | |
tree | e7c8933ce56ecdac588fbaa9af0c4beb03850c3e /m4/libmemcache.m4 | |
parent | fc05b4b880d4247da9353cae6be44180dee17b23 (diff) |
Diffstat (limited to 'm4/libmemcache.m4')
-rw-r--r-- | m4/libmemcache.m4 | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/m4/libmemcache.m4 b/m4/libmemcache.m4 new file mode 100644 index 0000000..95e630b --- /dev/null +++ b/m4/libmemcache.m4 | |||
@@ -0,0 +1,46 @@ | |||
1 | dnl Check for memcache client libraries | ||
2 | dnl CHECK_MEMCACHE(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) | ||
3 | AC_DEFUN([CHECK_MEMCACHE], | ||
4 | [dnl | ||
5 | |||
6 | AC_ARG_WITH( | ||
7 | memcache, | ||
8 | [AC_HELP_STRING([--with-memcache=PATH],[Path memcache libraries])], | ||
9 | mc_path="$withval", | ||
10 | :) | ||
11 | |||
12 | dnl # Determine memcache lib directory | ||
13 | if test -z $mc_path; then | ||
14 | test_paths="/usr/lib /usr/local/lib" | ||
15 | else | ||
16 | test_paths="${mc_path}/lib" | ||
17 | fi | ||
18 | |||
19 | for x in $test_paths ; do | ||
20 | AC_MSG_CHECKING([for memcache library in ${x}]) | ||
21 | if test -f ${x}/libmemcache.so.1.0; then | ||
22 | AC_MSG_RESULT([yes]) | ||
23 | save_CFLAGS=$CFLAGS | ||
24 | save_LDFLAGS=$LDFLAGS | ||
25 | CFLAGS="$CFLAGS" | ||
26 | LDFLAGS="-L$x $LDFLAGS" | ||
27 | AC_CHECK_LIB(memcache, mc_server_add, | ||
28 | LIBMEMCACHE_LIBS="-L$x -lmemcache") | ||
29 | CFLAGS=$save_CFLAGS | ||
30 | LDFLAGS=$save_LDFLAGS | ||
31 | break | ||
32 | else | ||
33 | AC_MSG_RESULT([no]) | ||
34 | fi | ||
35 | done | ||
36 | |||
37 | AC_SUBST(LIBMEMCACHE_LIBS) | ||
38 | |||
39 | if test -z "${LIBMEMCACHE_LIBS}"; then | ||
40 | AC_MSG_NOTICE([*** memcache library not found.]) | ||
41 | ifelse([$2], , AC_MSG_ERROR([memcache library is required]), $2) | ||
42 | else | ||
43 | AC_MSG_NOTICE([using '${LIBMEMCACHE_LIBS}' for memcache]) | ||
44 | ifelse([$1], , , $1) | ||
45 | fi | ||
46 | ]) | ||