[PATCH] try to find the proper berkeley db headers and libs

Robert Nagy robert at openbsd.org
Wed Dec 1 02:24:33 PST 2010


---
 configure.in       |   28 +++++++++++++++++-----------
 set_soenv.in       |    2 ++
 solenv/inc/libs.mk |    2 +-
 3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/configure.in b/configure.in
index 3b90114..c923a7a 100644
--- a/configure.in
+++ b/configure.in
@@ -4528,25 +4528,29 @@ 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
+       for dbinc in /usr/include /usr/local/include; do
+           AC_CHECK_HEADER(db$dbver/db.h, [ DB_INCLUDES="$dbinc/db$dbver"; db_header="db$dbver/db.h"; break 2 ])
+       done
+    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 +4559,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 ee227a3..e463849 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 fc5dee4..13a1095 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
-- 
1.7.3.1


--azLHFNyN32YCQGCU--


More information about the LibreOffice mailing list