From: Kurt Zeilenga Date: Wed, 21 Apr 2004 21:16:40 +0000 (+0000) Subject: Add OL_BERKELEY_DB_VERSION macro X-Git-Tag: OPENLDAP_REL_ENG_2_2_11~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bdc5be53d89a3400e12fac3ee67e59341d864f93;p=openldap Add OL_BERKELEY_DB_VERSION macro --- diff --git a/build/openldap.m4 b/build/openldap.m4 index 103fc54c73..f19f62a0fb 100644 --- a/build/openldap.m4 +++ b/build/openldap.m4 @@ -335,6 +335,58 @@ OL_BERKELEY_DB_TRY(ol_cv_db_db_1,[-ldb-1]) ]) dnl dnl -------------------------------------------------------------------- +dnl Check if Berkeley DB version +AC_DEFUN([OL_BERKELEY_DB_VERSION], +[AC_CACHE_CHECK([for Berkeley DB version match], [ol_cv_berkeley_db_version], [ + ol_LIBS="$LIBS" + LIBS="$LTHREAD_LIBS $LIBS" + if test $ol_cv_lib_db != yes ; then + LIBS="$ol_cv_lib_db $LIBS" + fi + + AC_TRY_RUN([ +#ifdef HAVE_DB_185_H + choke me; +#else +#include +#endif +#ifndef DB_VERSION_MAJOR +# define DB_VERSION_MAJOR 1 +#endif +#ifndef NULL +#define NULL ((void *)0) +#endif +main() +{ +#if DB_VERSION_MAJOR > 1 + char *version; + int major, minor, patch; + + version = db_version( &major, &minor, &patch ); + + if( major != DB_VERSION_MAJOR || minor < DB_VERSION_MINOR ) { + printf("Berkeley DB version mismatch\n" + "\texpected: %s\n\tgot: %s\n", + DB_VERSION_STRING, version); + return 1; + } +#endif + + return 0; +}], + [ol_cv_berkeley_db_version=yes], + [ol_cv_berkeley_db_version=no], + [ol_cv_berkeley_db_version=cross]) + + LIBS="$ol_LIBS" +]) + + if test $ol_cv_berkeley_db_version = no ; then + AC_MSG_ERROR([Berkeley DB version mismatch]) + fi +])dnl +dnl +dnl -------------------------------------------------------------------- dnl Check if Berkeley DB supports DB_THREAD AC_DEFUN([OL_BERKELEY_DB_THREAD], [AC_CACHE_CHECK([for Berkeley DB thread support], [ol_cv_berkeley_db_thread], [ @@ -430,6 +482,7 @@ if test $ac_cv_header_db_h = yes; then OL_BERKELEY_DB_LINK if test "$ol_cv_lib_db" != no ; then ol_cv_berkeley_db=yes + OL_BERKELEY_DB_VERSION OL_BERKELEY_DB_THREAD fi fi