summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Nagy <robert@openbsd.org>2010-12-01 23:26:31 +0100
committerRobert Nagy <robert@openbsd.org>2010-12-01 23:26:31 +0100
commit5613267b68ae4b83bf6f037032e223170079a2ae (patch)
treea2a2eadfd29994b9f6f009b0fd1b43b091994a51
parent2786f2110a7352302f789584948b7ab959f16436 (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.in36
-rw-r--r--set_soenv.in2
-rw-r--r--solenv/inc/libs.mk2
3 files changed, 28 insertions, 12 deletions
diff --git a/configure.in b/configure.in
index 3b9011466..2f338c7d7 100644
--- a/configure.in
+++ b/configure.in
@@ -4528,25 +4528,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])
@@ -4555,6 +4567,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 c7d272945..47ea65f2e 100644
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1950,6 +1950,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