diff options
author | Robert Nagy <robert@openbsd.org> | 2010-12-01 23:26:31 +0100 |
---|---|---|
committer | Robert Nagy <robert@openbsd.org> | 2010-12-01 23:31:07 +0100 |
commit | 92170c5e77f2eebeb28b24c6d0798ac0910fa00a (patch) | |
tree | 566543bfd0acd5352c7711abdffa6cc3a778e49a | |
parent | b9216dc9b8c88b73f7faf1222ae78acebf38143e (diff) |
merge a modified version of patches/dev300/system-db-check.diff
try to find all the supported db headers and libs in all
the "standard" directories
-rw-r--r-- | configure.in | 36 | ||||
-rw-r--r-- | set_soenv.in | 2 | ||||
-rw-r--r-- | solenv/inc/libs.mk | 2 |
3 files changed, 28 insertions, 12 deletions
diff --git a/configure.in b/configure.in index 0fb653954..ba1b2d70a 100644 --- a/configure.in +++ b/configure.in @@ -4272,25 +4272,37 @@ if test -n "$with_system_db" -o -n "$with_system_libs" && \ test "$with_system_db" != "no"; then SYSTEM_DB=YES AC_MSG_RESULT([external]) - AC_CHECK_HEADER(db.h, [ DB_INCLUDES=/usr/include ], - [ - CFLAGS=-I/usr/include/db4 - AC_CHECK_HEADER(db4/db.h, - [ DB_INCLUDES=/usr/include/db4 ], - [ AC_MSG_ERROR(no. install the db4 libraries) ], []+ ) - ], [] - ) + for dbver in -5.1 5.1 -5.0 5.0 -5 5 -4.8 4.8 -4.7 4.7 -4 4 ''; do + AC_MSG_CHECKING([for db$dbver/db.h]) + for inc_dir in /usr/include /usr/local/include; do + if test -r "$inc_dir/db$dbver/db.h"; then + DB_INCLUDES="$inc_dir/db$dbver" + db_header="db$dbver/db.h" + AC_MSG_RESULT([yes]) + break 2 + fi + done + AC_MSG_RESULT([no]) + done + + if test "$DB_INCLUDES" = ""; then + AC_MSG_ERROR(no. install the db4-dev package) + fi AC_MSG_CHECKING([whether db is at least 4.1]) AC_TRY_RUN([ -#include <db.h> +#include <$db_header> int main(int argc, char **argv) { if(DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)) return 0; else return 1; } ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no. you need at least db 4.1])]) - AC_HAVE_LIBRARY(db, [], - [AC_MSG_ERROR([db not installed or functional])], []) + save_LIBS="$LIBS" + for dbver in -5.1 5.1 -5.0 5.0 -5 5 -4.8 4.8 -4.7 4.7 -4 4 ''; do + AC_CHECK_LIB(db$dbver, db_create, [ DB_LIB="db$dbver"; DB_CPPLIB="db_cxx$dbver"; LIBS="-ldb$dbver $LIBS"; break ]) + done + AC_CHECK_FUNC(db_create, [], [ AC_MSG_ERROR([db not installed or functional]) ]) + LIBS="$save_LIBS" SCPDEFS="$SCPDEFS -DSYSTEM_DB" else AC_MSG_RESULT([internal]) @@ -4299,6 +4311,8 @@ else fi AC_SUBST(SYSTEM_DB) AC_SUBST(DB_VERSION) +AC_SUBST(DB_LIB) +AC_SUBST(DB_CPPLIB) AC_SUBST(DB_INCLUDES) AC_SUBST(DB_JAR) diff --git a/set_soenv.in b/set_soenv.in index 0a70afbab..17019a6b2 100644 --- a/set_soenv.in +++ b/set_soenv.in @@ -1956,6 +1956,8 @@ ToFile( "WITH_EXTRA_SAMPLE", "@WITH_EXTRA_SAMPLE@", "e" ); ToFile( "WITH_EXTRA_FONT", "@WITH_EXTRA_FONT@", "e" ); ToFile( "SYSTEM_DB", "@SYSTEM_DB@", "e" ); ToFile( "DB_VERSION", "@DB_VERSION@", "e" ); +ToFile( "DB_LIB", "@DB_LIB@", "e" ); +ToFile( "DB_CPPLIB", "@DB_CPPLIB@", "e" ); ToFile( "DB_INCLUDES", "@DB_INCLUDES@", "e" ); ToFile( "ENABLE_MYSQLC", "@ENABLE_MYSQLC@", "e" ); ToFile( "SYSTEM_MYSQL", "@SYSTEM_MYSQL@", "e" ); diff --git a/solenv/inc/libs.mk b/solenv/inc/libs.mk index fc5dee4ec..13a109572 100644 --- a/solenv/inc/libs.mk +++ b/solenv/inc/libs.mk @@ -231,7 +231,7 @@ NEON3RDLIB=$(SOLARLIBDIR)/libneon.dylib NEON3RDLIB=-lneon .ENDIF .IF "$(SYSTEM_DB)" == "YES" -BERKELEYLIB=-ldb +BERKELEYLIB=-l$(DB_LIB) .ELSE BERKELEYLIB=-ldb-4.7 .ENDIF |