Merging bzr://gaz.tangent.org/libmemcached/build2/ to Build branch
[m6w6/libmemcached] / m4 / ax_sasl.m4
1 # ===========================================================================
2 # http://www.tangent.org/
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_SASL
8 #
9 # DESCRIPTION
10 #
11 # Check for sasl version one or two support.
12 #
13 # LICENSE
14 #
15 # Copyright (c) 2012 Brian Aker <brian@tangent.org>
16 #
17 # Copying and distribution of this file, with or without modification, are
18 # permitted in any medium without royalty provided the copyright notice
19 # and this notice are preserved. This file is offered as-is, without any
20 # warranty.
21
22 #serial 1
23
24 AC_DEFUN([AX_SASL_OPTION],[
25 AC_REQUIRE([AX_SASL_CHECK])
26 AC_ARG_ENABLE([sasl],
27 [AS_HELP_STRING([--disable-sasl], [Build with sasl support @<:@default=on@:>@])],
28 [ac_enable_sasl="$enableval"],
29 [ac_enable_sasl="yes"])
30
31 AS_IF([test "x$ac_enable_sasl" = "xyes"],
32 [ac_enable_sasl="yes"],
33 [ac_enable_sasl="no"])
34
35 AS_IF([test "x$ac_enable_sasl" = "xyes"], [
36 AC_DEFINE([HAVE_LIBSASL], [ 1 ], [Have libsasl2])
37 ], [
38 AC_DEFINE([HAVE_LIBSASL], [ 0 ], [Have libsasl2])
39 ])
40
41 AM_CONDITIONAL(HAVE_SASL, test "x${ac_enable_sasl}" = "xyes")
42
43 ])
44
45 AC_DEFUN([AX_SASL_CHECK],[
46
47 AX_CHECK_LIBRARY([LIBSASL], [sasl/sasl.h], [sasl2],[
48 LIBSASL_LDFLAGS="-lsasl2"
49 ax_cv_sasl=yes
50 ], [
51 ax_cv_sasl=no
52 ])
53
54 AM_CONDITIONAL(HAVE_SASL, test "x${ac_enable_sasl}" = "xyes")
55 ])