Cleanup around linking.
[awesomized/libmemcached] / m4 / ax_sasl.m4
1 # ===========================================================================
2 # http://www.tangent.org/
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_SASL
8 # AX_SASL_CHECK
9 #
10 # DESCRIPTION
11 #
12 # Check to see if libsasl is requested and available.
13 #
14 # LICENSE
15 #
16 # Copyright (c) 2012 Brian Aker <brian@tangent.org>
17 #
18 # Copying and distribution of this file, with or without modification, are
19 # permitted in any medium without royalty provided the copyright notice
20 # and this notice are preserved. This file is offered as-is, without any
21 # warranty.
22
23 #serial 2
24
25 AC_DEFUN([AX_SASL_OPTION],
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 ax_sasl_option=no
32 AS_IF([test "x${ac_enable_sasl}" = xyes],
33 [AX_SASL_CHECK
34 echo "$ax_sasl_check"
35 AS_IF([test "x${ax_sasl_check}" = xyes],
36 [ax_sasl_option=yes],
37 [AC_MSG_WARN([request to add sasl support failed, please see config.log])])
38 ])
39
40 AC_MSG_CHECKING([checking to see if enabling sasl])
41 AC_MSG_RESULT(["$ax_sasl_option"])
42 AM_CONDITIONAL([HAVE_SASL],[test "x${ax_sasl_option}" = xyes])
43 ])
44
45 AC_DEFUN([AX_SASL_CHECK],
46 [ax_sasl_check=no
47 AX_CHECK_LIBRARY([LIBSASL],[sasl/sasl.h],[sasl2],
48 [ax_sasl_check=yes
49 AC_SUBST([SASL_LIB],[[-lsasl2]])
50 ])
51 AC_MSG_CHECKING([checking to see if sasl works])
52 AC_MSG_RESULT(["$ax_sasl_check"])
53 ])