aboutsummaryrefslogtreecommitdiffstats
path: root/m4/apr_memcache.m4
blob: 71ab2b659c987967d0737f4dc5bd6aeb3716398e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
dnl Check for memcache client libraries
dnl CHECK_APR_MEMCACHE(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
dnl Sets:
dnl  APR_MEMCACHE_LIBS
AC_DEFUN([CHECK_APR_MEMCACHE],
[dnl

AC_ARG_WITH(
    apr-memcache-prefix,
    [AC_HELP_STRING([--with-apr-memcache-prefix=PATH],[Install prefix for apr_memcache])],
    apr_memcache_prefix="$withval",
    apr_memcache_prefix="/usr",
    :)
AC_ARG_WITH(
    apr-memcache-libs,
    [AC_HELP_STRING([--with-apr-memcache-libs=PATH],[Path to apr_memcache libs])],
    apr_memcache_libs="$withval",
    apr_memcache_libs="$apr_memcache_prefix/lib"
    :)
AC_ARG_WITH(
    apr-memcache-includes,
    [AC_HELP_STRING([--with-apr-memcache-includes=PATH],[Path to apr_memcache includes])],
    apr_memcache_includes="$withval",
    apr_memcache_includes="$apr_memcache_prefix/include/apr_memcache-0"
    :)


AC_LIBTOOL_SYS_DYNAMIC_LINKER

dnl # Determine memcache lib directory
save_CFLAGS=$CFLAGS
save_LDFLAGS=$LDFLAGS
CFLAGS="-I$apr_memcache_includes $APR_INCLUDES $CFLAGS"
LDFLAGS="-L$apr_memcache_libs $LDFLAGS"
AC_CHECK_LIB(
    apr_memcache,
    apr_memcache_create,
    [
	APR_MEMCACHE_LIBS="-R$apr_memcache_libs -L$apr_memcache_libs -lapr_memcache"
	APR_MEMCACHE_CFLAGS="-I$apr_memcache_includes"
    ]
)
CFLAGS=$save_CFLAGS
LDFLAGS=$save_LDFLAGS

AC_SUBST(APR_MEMCACHE_LIBS)
AC_SUBST(APR_MEMCACHE_CFLAGS)

if test -z "${APR_MEMCACHE_LIBS}"; then
  AC_MSG_NOTICE([*** memcache library not found.])
  ifelse([$2], , AC_MSG_ERROR([memcache library is required]), $2)
else
  AC_MSG_NOTICE([using '${APR_MEMCACHE_LIBS}' for memcache])
  ifelse([$1], , , $1) 
fi 
])