2 AC_INIT(rlm_couchbase.c)
3 AC_REVISION($Revision$)
4 AC_DEFUN(modname,[rlm_couchbase])
5 AC_CONFIG_HEADER(config.h)
7 if test x$with_[]modname != xno; then
12 dnl put configuration checks here.
13 dnl set $fail to what's missing, on fatal errors.
14 dnl use AC_MSG_WARN() on important messages.
16 dnl ############################################################
17 dnl # Check for json-c
18 dnl ############################################################
20 dnl extra argument: --with-jsonc-include-dir=DIR
22 AC_ARG_WITH(jsonc-include-dir,
23 [AS_HELP_STRING([--with-jsonc-include-dir=DIR],
24 [Directory where the json-c includes may be found])],
27 AC_MSG_ERROR(Need jsonc-include-dir)
32 jsonc_include_dir="$withval"
36 dnl extra argument: --with-jsonc-lib-dir=DIR
38 AC_ARG_WITH(jsonc-lib-dir,
39 [AS_HELP_STRING([--with-jsonc-lib-dir=DIR],
40 [Directory where the json-c libraries may be found])],
43 AC_MSG_ERROR(Need jsonc-lib-dir)
48 jsonc_lib_dir="$withval"
52 dnl extra argument: --with-jsonc-dir=DIR
53 AC_ARG_WITH(jsonc-dir,
54 [AS_HELP_STRING([--with-jsonc-dir=DIR],
55 [Base directory where json-c is installed])],
58 AC_MSG_ERROR(Need json-c-dir)
63 jsonc_lib_dir="$withval/lib"
64 jsonc_include_dir="$withval/include"
68 dnl ############################################################
69 dnl # Check for json-c header files
70 dnl ############################################################
73 smart_try_dir="$jsonc_include_dir"
74 FR_SMART_CHECK_INCLUDE([json/json.h])
75 if test "x$ac_cv_header_json_json_h" != "xyes"; then
77 AC_MSG_WARN([json-c headers not found. Use --with-jsonc-include-dir=<path>.])
80 dnl ############################################################
81 dnl # Check for json-c libraries
82 dnl ############################################################
84 smart_try_dir="$jsonc_lib_dir"
85 dnl # Use a json-c specific function which is only
86 dnl # available in newer versions.
87 FR_SMART_CHECK_LIB([json-c], [json_c_version])
88 if test "x$ac_cv_lib_json_c_json_c_version" != "xyes"
90 dnl # Use a function which is included in legacy versions
91 dnl # but which may be available in other json libraries
92 FR_SMART_CHECK_LIB([json], [json_tokener_new])
93 if test "x$ac_cv_lib_json_json_tokener_new" != "xyes"
99 if test "x$have_json" = "xyes"; then
100 dnl # Ensure we use the library we just found the rest of the checks
101 LDFLAGS="$SMART_LIBS"
103 dnl # Add any optional functions here
106 json_object_get_string_len \
107 json_object_object_get_ex \
108 json_object_new_int64 \
109 json_tokener_parse_verbose \
110 json_tokener_error_desc \
111 json_tokener_get_error
117 dnl ############################################################
118 dnl # Check for libcouchbase
119 dnl ############################################################
121 dnl extra argument: --with-libcouchbase-include-dir=DIR
122 libcouchbase_include_dir=
123 AC_ARG_WITH(libcouchbase-include-dir,
124 [AS_HELP_STRING([--with-libcouchbase-include-dir=DIR],
125 [Directory where the libcouchbase includes may be found])],
128 AC_MSG_ERROR(Need libcouchbase-include-dir)
133 libcouchbase_include_dir="$withval"
137 dnl extra argument: --with-libcouchbase-lib-dir=DIR
138 libcouchbase_lib_dir=
139 AC_ARG_WITH(libcouchbase-lib-dir,
140 [AS_HELP_STRING([--with-libcouchbase-lib-dir=DIR],
141 [Directory where the libcouchbase libraries may be found])],
144 AC_MSG_ERROR(Need libcouchbase-lib-dir)
149 libcouchbase_lib_dir="$withval"
153 dnl extra argument: --with-libcouchbase-dir=DIR
154 AC_ARG_WITH(libcouchbase-dir,
155 [AS_HELP_STRING([--with-libcouchbase-dir=DIR],
156 [Base directory where libcouchbase is installed])],
159 AC_MSG_ERROR(Need libcouchbase-dir)
164 libcouchbase_lib_dir="$withval/lib"
165 libcouchbase_include_dir="$withval/include"
169 dnl ############################################################
170 dnl # Check for libcouchbase header files
171 dnl ############################################################
174 smart_try_dir="$libcouchbase_include_dir"
175 FR_SMART_CHECK_INCLUDE([libcouchbase/couchbase.h])
176 if test "x$ac_cv_header_libcouchbase_couchbase_h" != "xyes"; then
178 AC_MSG_WARN([libcouchbase headers not found. Use --with-libcouchbase-include-dir=<path>.])
181 dnl ############################################################
182 dnl # Check for libcouchbase libraries
183 dnl ############################################################
185 smart_try_dir="$libcouchbase_lib_dir"
186 FR_SMART_CHECK_LIB([couchbase], [lcb_get_version])
187 if test "x$ac_cv_lib_couchbase_lcb_get_version" != "xyes"
190 AC_MSG_WARN([libcouchbase libraries not found. Use --with-libcouchbase-lib-dir=<path>.])
193 if test "x$have_couchbase" != "xyes"; then
197 if test "x$have_couchbase" = "xno"; then
198 fail="$fail libcouchbase"
201 dnl ############################################################
202 dnl # Checks done - set targetname
203 dnl ############################################################
208 echo \*\*\* module modname is disabled.
211 dnl Don't change this section.
212 if test x"$fail" != x""; then
213 if test x"${enable_strict_dependencies}" = x"yes"; then
214 AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
216 AC_MSG_WARN([silently not building ]modname[.])
217 AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
222 mod_ldflags="${SMART_LIBS}"
223 mod_cflags="${SMART_CFLAGS}"
226 AC_SUBST(mod_ldflags)