-dnl $Id: db3-check.m4,v 1.23 2010-04-12 14:28:48 franklahm Exp $
dnl Autoconf macros to check for the Berkeley DB library
dnl -- check header for minimum version and return version in
atalk_cv_bdb_MAJOR=`grep DB_VERSION_MAJOR "$1/db.h" | cut -f 3`
atalk_cv_bdb_MINOR=`grep DB_VERSION_MINOR "$1/db.h" | cut -f 3`
- if test $DB_MAJOR_REQ -gt $atalk_cv_bdb_MAJOR ; then
+ if test $atalk_cv_bdb_MAJOR -gt $DB_MAJOR_REQ ; then
+ AC_MSG_RESULT([yes])
+ atalk_cv_bdbheader=yes
+ elif test $DB_MAJOR_REQ -gt $atalk_cv_bdb_MAJOR ; then
AC_MSG_RESULT([no])
atalk_cv_bdbheader=no
elif test $DB_MINOR_REQ -gt $atalk_cv_bdb_MINOR ; then
int major, minor, patch;
char *version_str;
version_str = db_version(&major, &minor, &patch);
- if (major < DB_MAJOR_REQ || minor < DB_MINOR_REQ || patch < DB_PATCH_REQ) {
+ if ((major*100 + minor*10 + patch) < (DB_MAJOR_REQ*100 + DB_MINOR_REQ*10 + DB_PATCH_REQ)) {
printf("linking wrong library version (%d.%d.%d), ",major, minor, patch);
return (2);
}
])
dnl -- This is called from configure
-AC_DEFUN([AC_PATH_BDB],[
+AC_DEFUN([AC_NETATALK_PATH_BDB],[
+if test "x$bdb_required" = "xyes"; then
trybdbdir=""
dobdbsearch=yes
bdb_search_dirs="/usr/local /usr"
- search_subdirs="/ /db4.8 /db48 /db4.7 /db47 /db4.6 /db46 /db4"
+ search_subdirs="/ /db5 /db5.1 /db51 /db5.0 /db50 /db4.8 /db48 /db4.7 /db47 /db4.6 /db46 /db4"
bdbfound=no
savedcflags="$CFLAGS"
if test x"${atalk_cv_bdb_version}" = x"yes"; then
BDB_CFLAGS="-I${bdbdir}/include${subdir}"
BDB_LIBS="-L${bdblibdir} ${atalk_cv_lib_db}"
+ if test x"$need_dash_r" = x"yes"; then
+ BDB_LIBS="$BDB_LIBS -R${bdblibdir}"
+ fi
BDB_BIN="$bdbbindir"
BDB_PATH="$bdbdir"
bdbfound=yes
break;
fi
- dnl -- Search for 64bit lib in "lib" too
- if test x"$atalk_libname" = x"lib64" ; then
+ dnl -- Search lib in "lib" too, as $atalk_libname might be set
+ dnl -- to "lib64" or "lib/64" which would not be found above
+ dnl -- if 64bit lib were installed in a dir named "lib"
+ if test x"$atalk_libname" != x"lib" ; then
bdblibdir="${bdbdir}/lib"
bdbbindir="${bdbdir}/bin"
if test x"${atalk_cv_bdb_version}" = x"yes"; then
BDB_CFLAGS="-I${bdbdir}/include${subdir}"
BDB_LIBS="-L${bdblibdir} ${atalk_cv_lib_db}"
+ if test x"$need_dash_r" = x"yes"; then
+ BDB_LIBS="$BDB_LIBS -R${bdblibdir}"
+ fi
BDB_BIN="$bdbbindir"
BDB_PATH="$bdbdir"
bdbfound=yes
ifelse([$1], , :, [$1])
else
ifelse([$2], , :, [$2])
+ AC_MSG_ERROR([Berkeley DB library required but not found!])
fi
CFLAGS_REMOVE_USR_INCLUDE(BDB_CFLAGS)
AC_SUBST(BDB_LIBS)
AC_SUBST(BDB_BIN)
AC_SUBST(BDB_PATH)
+fi
])