[PATCH] build: check for mongodb headers

Jim Meyering jim at meyering.net
Wed Apr 27 19:45:50 UTC 2011


Mark McLoughlin wrote:
> On my Fedora 14 system, without mongodb-devel I was seeing:
>
>       CXX    meta.o
>     meta.cpp:34:35: fatal error: mongo/client/dbclient.h: No such file or directory
>     compilation terminated.
>
> The header is C++ so we need AC_LANGUAGE_PUSH and, similar to meta.cpp,
> we need to undefine VERSION before including the header.
>
> Note, the AC_CHECK_LIB approach doesn't seem sufficient because the
> mongodb package in Fedora doesn't ship versioned shared libraries with an
> unversioned symlink in the -devel package.
>
> With the new check, we fail with:
>
>   checking for mongo/client/dbclient.h... no
>   configure: error: Missing Mongo DB client development library: mongodb-devel
> ---
>  configure.ac |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 103c18a..81ecf76 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -79,6 +79,15 @@ gl_LIBXML2([2.6.0])
>  AC_CHECK_HEADER([gc.h], ,
>    [AC_MSG_ERROR([Missing GC development library: gc-devel or libgc-dev])])
>
> +AC_LANG_PUSH([C++])
> +AC_CHECK_HEADER([mongo/client/dbclient.h], ,
> +  [AC_MSG_ERROR([Missing Mongo DB client development library: mongodb-devel])],
> +  [#ifdef VERSION
> +#undef VERSION
> +#endif
> +])
> +AC_LANG_POP

Hi Mark,

Thanks for the patch.
I think I can use it as-is, but wonder about the #ifdef guard.
I'd like to remove that.
I guess you used those solely because meta.cpp does?

This additional change works just as well on Fedora 15 at least:
(if you don't object, I'll squash this into yours and push -- and
I'll adjust meta.cpp in the same manner, but separately)

diff --git a/configure.ac b/configure.ac
index 81ecf76..8945f7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,10 +82,7 @@ AC_CHECK_HEADER([gc.h], ,
 AC_LANG_PUSH([C++])
 AC_CHECK_HEADER([mongo/client/dbclient.h], ,
   [AC_MSG_ERROR([Missing Mongo DB client development library: mongodb-devel])],
-  [#ifdef VERSION
-#undef VERSION
-#endif
-])
+  [#undef VERSION])
 AC_LANG_POP

 # from http://www.gnu.org/software/autoconf-archive/


More information about the iwhd-devel mailing list