rpmdb: include <db.h> and link with -ldb without configure check for now

This commit is contained in:
Alexey Tourbin 2009-04-23 14:46:46 +04:00
parent 2ec0a7bf9f
commit 37bfe52994
5 changed files with 4 additions and 81 deletions

View File

@ -301,66 +301,6 @@ dnl for this macro (not LIBS=...), otherwise the check for dbopen
dnl will fail.
AC_CHECK_LIB(port, writev)
WITH_DB_SUBDIR=
WITH_INTERNAL_DB=0
DBLIBSRCS="db3.c"
libdb3=""
libdb3a=""
dnl
dnl Detect whether internal Berkeley DB should be built.
dnl
withval=no
AC_ARG_WITH(db, [ --with-db use internal Berkeley db])
if test $withval = no ; then
dnl ------------------ without internal db
AC_CHECK_HEADERS([db4/db.h] [db3/db.h])
dnl Check for Berkeley db3 API.
AC_CHECK_FUNC(db_create, ,
AC_CHECK_LIB(db, db_create, [libdb3="-ldb"],
AC_MSG_ERROR([sorry rpm requires Berkeley db3/db4])
)
)
if test -n "$libdb3" -a -n "$libthread" ; then
AC_MSG_CHECKING(whether $libdb3 needs $libthread)
saveLIBS="$LIBS"
LIBS="$LIBS $libdb3"
AC_TRY_LINK_FUNC(db_create, AC_MSG_RESULT(no),
[libdb3="$libdb3 $libthread"; AC_MSG_RESULT(yes)])
LIBS="$saveLIBS"
fi
else
dnl ------------------ with internal db
AC_DEFINE(HAVE_DB3_DB_H, 1, [Define if you have the <db3/db.h> header file])
WITH_DB_SUBDIR=db3
WITH_INTERNAL_DB=1
libdb3="# \$(top_builddir)/db3/libdb.la"
libdb3a="\$(top_builddir)/db3/libdb.a"
dnl INCPATH="-I\$(top_builddir)/$(WITH_DB_SUBDIR) $INCPATH"
fi
AC_SUBST(WITH_DB_SUBDIR)
AC_SUBST(WITH_INTERNAL_DB)
DBLIBOBJS=`echo $DBLIBSRCS | sed -e "s/\.c/\.lo/g"`
AC_SUBST(DBLIBSRCS)
AC_SUBST(DBLIBOBJS)
AC_SUBST(libdb3)
AC_SUBST(libdb3a)
for dbi in $DBLIBSRCS; do
case $dbi in
db3.c) AC_DEFINE(USE_DB3, 1, [Use the Berkeley db3 API?]) ;;
db1.c) AC_DEFINE(USE_DB1, 1, [Use the Berkeley db1 retrofit to db3 API?]) ;;
esac
done
dnl AmigaOS and IXEmul have a fork() dummy
case "$target" in
m68k-*-amigaos )

View File

@ -8,7 +8,7 @@ INCLUDES = -I. \
-I$(top_srcdir)/rpmio \
@INCPATH@
LIBDB = @libdb3@
LIBDB = -ldb
LIBELF = @WITH_LIBELF_LIB@
LIBPOPT = @LIBPOPT@
@ -25,7 +25,7 @@ lib_LTLIBRARIES = librpmdb.la
librpmdb_la_SOURCES = db3.c \
dbconfig.c hdrNVR.c header.c fprint.c legacy.c merge.c poptDB.c \
rpmhash.c rpmdb.c rpmvercmp.c tagname.c tagtbl.c
librpmdb_la_LDFLAGS = -release @VERSION@ @libdb3@
librpmdb_la_LDFLAGS = -release @VERSION@
librpmdb_la_LIBADD = $(LIBDB) $(LIBELF) $(LIBPOPT) $(top_builddir)/rpmio/librpmio.la
librpmdb_la_DEPENDENCIES = $(top_builddir)/rpmio/librpmio.la

View File

@ -23,11 +23,7 @@ typedef int int32_t;
/*@=redef@*/
#endif
#if defined(HAVE_DB4_DB_H)
#include <db4/db.h>
#elif defined(HAVE_DB3_DB_H)
#include <db3/db.h>
#endif
#include <db.h>
#include "rpmlib.h"
#include "rpmmacro.h"

View File

@ -15,11 +15,7 @@ typedef int int32_t;
/*@=redef@*/
#endif
#if defined(HAVE_DB4_DB_H)
#include <db4/db.h>
#elif defined(HAVE_DB3_DB_H)
#include <db3/db.h>
#endif
#include <db.h>
#include "rpmlib.h"
#include "rpmmacro.h"
@ -35,9 +31,6 @@ typedef int int32_t;
/*@access dbiIndex@*/
/*@access dbiIndexSet@*/
#if (DB_VERSION_MAJOR == 3) || (DB_VERSION_MAJOR == 4)
#define __USE_DB3 1
/*@-exportlocal -exportheadervar@*/
/*@unchecked@*/
struct _dbiIndex db3dbi;
@ -573,5 +566,3 @@ const char * prDbiOpenFlags(int dbflags, int print_dbenv_flags)
}
return buf;
}
#endif

View File

@ -176,13 +176,9 @@ static void dbiTagsInit(void)
#define DB1vec NULL
#define DB2vec NULL
#if USE_DB3
/*@unchecked@*/
extern struct _dbiVec db3vec;
#define DB3vec &db3vec
#else
#define DB3vec NULL
#endif
/*@=redecl@*/
/*@-nullassign@*/