Add --with-berkeley-db-include option

Adds --with-berkeley-db-include=dir option to configure to use berkeley
db headers in dir.  Default is to let configure check.  Also adds
support for checking for and using db5/db.h

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
This commit is contained in:
Eray Aslan
2010-09-05 15:01:50 +00:00
committed by Love Hornquist Astrand
parent ce438f343c
commit a1c14b2319
5 changed files with 59 additions and 20 deletions

View File

@@ -2,11 +2,20 @@ dnl $Id$
dnl
dnl tests for various db libraries
dnl
AC_DEFUN([rk_DB],[
AC_ARG_ENABLE(berkeley-db,
AS_HELP_STRING([--disable-berkeley-db],
[if you don't want berkeley db]),[
])
AC_ARG_WITH(berkeley-db,
AS_HELP_STRING([--with-berkeley-db],
[enable support for berkeley db @<:@default=check@:>@]),
[],
[with_berkeley_db=check])
dbheader=""
AC_ARG_WITH(berkeley-db-include,
AS_HELP_STRING([--with-berkeley-db-include=dir],
[use berkeley-db headers in dir]),
[dbheader=$withval],
[with_berkeley_db_include=check])
AC_ARG_ENABLE(ndbm-db,
AS_HELP_STRING([--disable-ndbm-db],
@@ -16,20 +25,35 @@ AC_ARG_ENABLE(ndbm-db,
have_ndbm=no
db_type=unknown
if test "$enable_berkeley_db" != no; then
AS_IF([test "x$with_berkeley_db" != xno],
[AS_IF([test "x$with_berkeley_db_include" != xcheck],
[AC_CHECK_HEADERS(["$dbheader/db.h"],
[AC_SUBST([DBHEADER], [$dbheader])
AC_DEFINE([HAVE_DBHEADER], [1],
[Define if you have user supplied header location])
],
[if test "x$with_berkeley_db_include" != xcheck; then
AC_MSG_FAILURE(
[--with-berkeley-db-include was given but include test failed])
fi
])],
[AC_CHECK_HEADERS([ \
db5/db.h \
db4/db.h \
db3/db.h \
db.h \
db_185.h \
])])
AC_CHECK_HEADERS([ \
db4/db.h \
db3/db.h \
db.h \
db_185.h \
])
dnl db_create is used by db3 and db4 and db5
dnl db_create is used by db3 and db4
AC_FIND_FUNC_NO_LIBS(db_create, db4 db3 db, [
AC_FIND_FUNC_NO_LIBS(db_create, [$dbheader] db5 db4 db3 db, [
#include <stdio.h>
#ifdef HAVE_DB4_DB_H
#ifdef HAVE_DBHEADER
#include <$dbheader/db.h>
#elif HAVE_DB5_DB_H
#include <db5/db.h>
#elif HAVE_DB4_DB_H
#include <db4/db.h>
#elif defined(HAVE_DB3_DB_H)
#include <db3/db.h>
@@ -45,7 +69,7 @@ dnl db_create is used by db3 and db4
else
DBLIB=""
fi
AC_DEFINE(HAVE_DB3, 1, [define if you have a berkeley db3/4 library])
AC_DEFINE(HAVE_DB3, 1, [define if you have a berkeley db3/4/5 library])
else
dnl dbopen is used by db1/db2
@@ -98,7 +122,7 @@ dnl test for ndbm compatability
fi
fi
fi # berkeley db
]) # fi berkeley db
if test "$enable_ndbm_db" != "no"; then
@@ -196,6 +220,7 @@ fi
AM_CONDITIONAL(HAVE_DB1, test "$db_type" = db1)dnl
AM_CONDITIONAL(HAVE_DB3, test "$db_type" = db3)dnl
AM_CONDITIONAL(HAVE_NDBM, test "$db_type" = ndbm)dnl
AM_CONDITIONAL(HAVE_DBHEADER, test "$dbheader" != "")dnl
## it's probably not correct to include LDFLAGS here, but we might
## need it, for now just add any possible -L

View File

@@ -6,6 +6,9 @@ AM_CPPFLAGS += -I../asn1 -I$(srcdir)/../asn1 $(INCLUDE_hcrypto)
AM_CPPFLAGS += $(INCLUDE_openldap) -DHDB_DB_DIR=\"$(DIR_hdbdir)\"
AM_CPPFLAGS += -I$(srcdir)/../krb5
AM_CPPFLAGS += $(INCLUDE_sqlite3)
if HAVE_DBHEADER
AM_CPPFLAGS += -I$(DBHEADER)
endif
BUILT_SOURCES = \
$(gen_files_hdb:.x=.c) \

View File

@@ -35,9 +35,13 @@
#if HAVE_DB3
#ifdef HAVE_DB4_DB_H
#ifdef HAVE_DBHEADER
#include <db.h>
#elif HAVE_DB5_DB_H
#include <db5/db.h>
#elif HAVE_DB4_DB_H
#include <db4/db.h>
#elif defined(HAVE_DB3_DB_H)
#elif HAVE_DB3_DB_H
#include <db3/db.h>
#else
#include <db.h>

View File

@@ -16,6 +16,9 @@ libroken_la_LDFLAGS += $(LDFLAGS_VERSION_SCRIPT)$(srcdir)/version-script.map
endif
AM_CPPFLAGS += $(libroken_la_CPPFLAGS)
if HAVE_DBHEADER
AM_CPPFLAGS += -I$(DBHEADER)
endif
noinst_PROGRAMS = snprintf-test resolve-test rkpty

View File

@@ -34,7 +34,11 @@
#include <config.h>
#include "ndbm_wrap.h"
#if defined(HAVE_DB4_DB_H)
#if defined(HAVE_DBHEADER)
#include <db.h>
#elif defined(HAVE_DB5_DB_H)
#include <db5/db.h>
#elif defined(HAVE_DB4_DB_H)
#include <db4/db.h>
#elif defined(HAVE_DB3_DB_H)
#include <db3/db.h>