Merge in all updates for autoconf
[awesomized/libmemcached] / m4 / pandora_have_sasl.m4
1 dnl Copyright (C) 2009 Sun Microsystems, Inc.
2 dnl This file is free software; Sun Microsystems, Inc.
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
5
6 AC_DEFUN([_PANDORA_SEARCH_SASL],[
7 AC_REQUIRE([AC_LIB_PREFIX])
8
9 dnl --------------------------------------------------------------------
10 dnl Check for sasl
11 dnl --------------------------------------------------------------------
12 AC_ARG_ENABLE([sasl],
13 [AS_HELP_STRING([--disable-sasl],
14 [Build with sasl support @<:@default=on@:>@])],
15 [ac_enable_sasl="$enableval"],
16 [ac_enable_sasl="yes"])
17
18 AS_IF([test "x$ac_enable_sasl" = "xyes"],
19 [
20 AC_LIB_HAVE_LINKFLAGS(sasl,,[
21 #include <stdlib.h>
22 #include <sasl/sasl.h>
23 ],[
24 sasl_server_init(NULL, NULL);
25 ])
26
27 AS_IF([test "x${ac_cv_libsasl}" != "xyes" ],
28 [
29 AC_LIB_HAVE_LINKFLAGS(sasl2,,[
30 #include <stdlib.h>
31 #include <sasl/sasl.h>
32 ],[
33 sasl_server_init(NULL, NULL);
34 ])
35 HAVE_LIBSASL="$HAVE_LIBSASL2"
36 LIBSASL="$LIBSASL2"
37 LIBSASL_PREFIX="$LIBSASL2_PREFIX"
38 LTLIBSASL="$LT_LIBSASL2"
39 ])
40 ])
41
42 AS_IF([test "x${ac_cv_libsasl}" = "xyes" -o "x${ac_cv_libsasl2}" = "xyes"],
43 [ac_cv_sasl=yes],
44 [ac_cv_sasl=no])
45
46 AM_CONDITIONAL(HAVE_LIBSASL, [test "x${ac_cv_libsasl}" = "xyes"])
47 AM_CONDITIONAL(HAVE_LIBSASL2, [test "x${ac_cv_libsasl2}" = "xyes"])
48 AM_CONDITIONAL(HAVE_SASL, [test "x${ac_cv_sasl}" = "xyes"])
49 ])
50
51 AC_DEFUN([PANDORA_HAVE_SASL],[
52 AC_REQUIRE([_PANDORA_SEARCH_SASL])
53 ])
54
55 AC_DEFUN([PANDORA_REQUIRE_SASL],[
56 AC_REQUIRE([_PANDORA_SEARCH_SASL])
57 AS_IF([test "x${ac_cv_sasl}" = "xno"],
58 AC_MSG_ERROR([SASL (libsasl or libsasl2) is required for ${PACKAGE}]))
59 ])
60
61 AC_DEFUN([_PANDORA_SEARCH_LIBSASL],[
62 AC_REQUIRE([AC_LIB_PREFIX])
63
64 dnl --------------------------------------------------------------------
65 dnl Check for libsasl
66 dnl --------------------------------------------------------------------
67
68 AC_ARG_ENABLE([libsasl],
69 [AS_HELP_STRING([--disable-libsasl],
70 [Build with libsasl support @<:@default=on@:>@])],
71 [ac_enable_libsasl="$enableval"],
72 [ac_enable_libsasl="yes"])
73
74 AS_IF([test "x$ac_enable_libsasl" = "xyes"],[
75 AC_LIB_HAVE_LINKFLAGS(sasl,,[
76 #include <stdlib.h>
77 #include <sasl/sasl.h>
78 ],[
79 sasl_server_init(NULL, NULL);
80 ])
81 ],[
82 ac_cv_libsasl="no"
83 ])
84
85 AM_CONDITIONAL(HAVE_LIBSASL, [test "x${ac_cv_libsasl}" = "xyes"])
86 ])
87
88 AC_DEFUN([PANDORA_HAVE_LIBSASL],[
89 AC_REQUIRE([_PANDORA_SEARCH_LIBSASL])
90 ])
91
92 AC_DEFUN([PANDORA_REQUIRE_LIBSASL],[
93 AC_REQUIRE([_PANDORA_SEARCH_LIBSASL])
94 AS_IF([test "x${ac_cv_libsasl}" = "xno"],
95 AC_MSG_ERROR([libsasl is required for ${PACKAGE}]))
96 ])
97
98 AC_DEFUN([_PANDORA_SEARCH_LIBSASL2],[
99 AC_REQUIRE([AC_LIB_PREFIX])
100
101 dnl --------------------------------------------------------------------
102 dnl Check for libsasl2
103 dnl --------------------------------------------------------------------
104
105 AC_ARG_ENABLE([libsasl2],
106 [AS_HELP_STRING([--disable-libsasl2],
107 [Build with libsasl2 support @<:@default=on@:>@])],
108 [ac_enable_libsasl2="$enableval"],
109 [ac_enable_libsasl2="yes"])
110
111 AS_IF([test "x$ac_enable_libsasl2" = "xyes"],[
112 AC_LIB_HAVE_LINKFLAGS(sasl2,,[
113 #include <stdlib.h>
114 #include <sasl2/sasl2.h>
115 ],[
116 sasl2_server_init(NULL, NULL);
117 ])
118 ],[
119 ac_cv_libsasl2="no"
120 ])
121
122 AM_CONDITIONAL(HAVE_LIBSASL2, [test "x${ac_cv_libsasl2}" = "xyes"])
123 ])
124
125 AC_DEFUN([PANDORA_HAVE_LIBSASL2],[
126 AC_REQUIRE([_PANDORA_SEARCH_LIBSASL2])
127 ])
128
129 AC_DEFUN([PANDORA_REQUIRE_LIBSASL2],[
130 AC_REQUIRE([_PANDORA_SEARCH_LIBSASL2])
131 AS_IF([test "x${ac_cv_libsasl2}" = "xno"],
132 AC_MSG_ERROR([libsasl2 is required for ${PACKAGE}]))
133 ])