From: Florian Forster Date: Sat, 6 Nov 2010 10:53:42 +0000 (+0100) Subject: configure.in: Improve check for libmongoc (aka. mongo-c-driver) X-Git-Tag: collectd-5.1.0~42^2~10 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=13322bb3c3253dce20bd0241c3725d27dc1fd732;p=collectd.git configure.in: Improve check for libmongoc (aka. mongo-c-driver) --- diff --git a/configure.in b/configure.in index bbdf2732..e8a6b12b 100644 --- a/configure.in +++ b/configure.in @@ -1242,14 +1242,6 @@ AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, ks # Checks for libraries begin here # -with_libmongoc="yes" -AC_CHECK_LIB(mongoc, mongo_run_command, -[ - AC_DEFINE(HAVE_LIBMONGOC, 1, [Define to 1 if you have the 'mongoc' library (-lmongoc).]) -], -[with_libmongoc="no"]) -AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes") - with_libresolv="yes" AC_CHECK_LIB(resolv, res_search, [ @@ -2152,6 +2144,69 @@ then fi # }}} +# --with-libmongoc {{{ +AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])], +[ + if test "x$withval" = "xyes" + then + with_libmongoc="yes" + else if test "x$withval" = "xno" + then + with_libmongoc="no" + else + with_libmongoc="yes" + LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include" + LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib" + fi; fi +], +[with_libmongoc="yes"]) + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" + +CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS" +LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS" + +if test "x$with_libmongoc" = "xyes" +then + if test "x$LIBMONGOC_CPPFLAGS" != "x" + then + AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS]) + fi + AC_CHECK_HEADERS(mongo.h, + [with_libmongoc="yes"], + [with_libmongoc="no ('mongo.h' not found)"], +[#if HAVE_STDINT_H +# define MONGO_HAVE_STDINT 1 +#else +# define MONGO_USE_LONG_LONG_INT 1 +#endif +]) +fi +if test "x$with_libmongoc" = "xyes" +then + if test "x$LIBMONGOC_LDFLAGS" != "x" + then + AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS]) + fi + AC_CHECK_LIB(mongoc, mongo_run_command, + [with_libmongoc="yes"], + [with_libmongoc="no (symbol 'mongo_run_command' not found)"]) +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_libmongoc" = "xyes" +then + BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS" + BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS" + AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes") +# }}} + # --with-libmysql {{{ with_mysql_config="mysql_config" with_mysql_cflags=""