diff --git a/configure.ac b/configure.ac index db5659530..650e92246 100644 --- a/configure.ac +++ b/configure.ac @@ -196,6 +196,24 @@ AM_CONDITIONAL([HAVE_CAPNG], [test "$with_capng" != "no"]) AC_SUBST([CAPNG_CFLAGS]) AC_SUBST([CAPNG_LIBS]) +dnl mitdb +AC_ARG_WITH([mitdb], + AC_HELP_STRING([--with-mitdb], [Path to MIT Kerberos DB include header and shared object]), + [], + [with_mitdb=no]) +if test -n "$with_mitdb" -a -d "$with_mitdb"; then + AC_DEFINE_UNQUOTED([HAVE_MITDB], 1, [Define if building with MIT Kerberos DB driver]) + AC_DEFINE(HAVE_DB1, 1, [define if you have a berkeley db1/2 library]) + mitdb=$with_mitdb +elif test "$with_mitdb" = no; then + with_mitdb= + mitdb= +elif test "$with_mitdb" = yes; then + AC_MSG_ERROR([Need path to MIT Kerberos DB include header and shared object]) +fi +AM_CONDITIONAL([HAVE_MITDB], [test -n "$with_mitdb"]) +AC_SUBST([MITDB], ["$with_mitdb"]) + dnl libmicrohttpd AC_ARG_WITH([microhttpd], AC_HELP_STRING([--with-microhttpd], [use microhttpd to serve KDC REST API @<:@default=check@:>@]), diff --git a/lib/hdb/Makefile.am b/lib/hdb/Makefile.am index 4a5599532..1a6155be4 100644 --- a/lib/hdb/Makefile.am +++ b/lib/hdb/Makefile.am @@ -84,6 +84,11 @@ if versionscript libhdb_la_LDFLAGS += $(LDFLAGS_VERSION_SCRIPT)$(srcdir)/version-script.map endif +if HAVE_MITDB +libhdb_la_LDFLAGS += -L$(MITDB)/lib -Wl,-rpath,$(MITDB)/lib -ldb +AM_CPPFLAGS += -I$(MITDB)/include +endif + # test_hdbkeys and test_mkey are not tests -- they are manual test utils noinst_PROGRAMS = test_dbinfo test_hdbkeys test_mkey test_namespace test_concurrency TESTS = test_dbinfo test_namespace test_concurrency diff --git a/lib/hdb/hdb-mitdb.c b/lib/hdb/hdb-mitdb.c index ae315cd83..e65869a66 100644 --- a/lib/hdb/hdb-mitdb.c +++ b/lib/hdb/hdb-mitdb.c @@ -118,7 +118,7 @@ attr_to_flags(unsigned attr, HDBFlags *flags) #define CHECK(x) do { if ((x)) goto out; } while(0) -#ifdef HAVE_DB1 +#ifdef HAVE_MITDB static krb5_error_code mdb_principal2key(krb5_context context, krb5_const_principal principal, @@ -134,7 +134,7 @@ mdb_principal2key(krb5_context context, key->length = strlen(str) + 1; return 0; } -#endif /* HAVE_DB1 */ +#endif /* HAVE_MITDB */ #define KRB5_KDB_SALTTYPE_NORMAL 0 #define KRB5_KDB_SALTTYPE_V4 1 @@ -675,11 +675,11 @@ mdb_entry2value(krb5_context context, hdb_entry *entry, krb5_data *data) } #endif -#if HAVE_DB1 +#ifdef HAVE_MITDB #if defined(HAVE_DB_185_H) #include -#elif defined(HAVE_DB_H) +#else #include #endif @@ -1154,7 +1154,7 @@ hdb_mitdb_create(krb5_context context, HDB **db, return 0; } -#endif /* HAVE_DB1 */ +#endif /* HAVE_MITDB */ /* can have any number of princ stanzas. diff --git a/lib/hdb/hdb.c b/lib/hdb/hdb.c index 9947254b1..ad0de7cbd 100644 --- a/lib/hdb/hdb.c +++ b/lib/hdb/hdb.c @@ -77,7 +77,7 @@ static struct hdb_method methods[] = { #if HAVE_DB3 { HDB_INTERFACE_VERSION, NULL, NULL, 1, 1, "db3:", hdb_db3_create}, #endif -#if HAVE_DB1 +#if HAVE_MITDB { HDB_INTERFACE_VERSION, NULL, NULL, 1, 1, "mit-db:", hdb_mitdb_create}, #endif #if HAVE_LMDB