summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2015-06-29 18:26:08 +0200
committerSlávek Banko <slavek.banko@axis.cz>2015-06-29 18:26:08 +0200
commite073bebe73e323022db9b62771f4027d1d9479b6 (patch)
treeaf99a6a2e3f66637ed88bbaab1740acc3684b433
parent98b2e203b7b7ef83dfeab84013f49b788631642b (diff)
downloadtdevelop-e073bebe73e323022db9b62771f4027d1d9479b6.tar.gz
tdevelop-e073bebe73e323022db9b62771f4027d1d9479b6.zip
Improve berkeley db detection
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--ConfigureChecks.cmake19
-rw-r--r--config.h.cmake3
-rw-r--r--lib/catalog/catalog.cpp8
3 files changed, 21 insertions, 9 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 44870f9f..7dad9c85 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -27,23 +27,28 @@ if( WITH_GCC_VISIBILITY )
endif( )
-# check for berkeley db
+##### check for berkeley db ####################
# we need at least bdb 4.1, but I do not check for version
# because this is really old and trinity will not
# working anyway on such old systems
+find_file( USE_DB_H_PATH NAMES "db5/db.h" "db4/db.h" "db.h" )
+
check_c_source_compiles("
- #include <db.h>
- void main() { DB *db; db->open(db, 0, 0, NULL, DB_BTREE, DB_CREATE, 0644); } "
+ #include <${USE_DB_H_PATH}>
+ #include <stddef.h>
+ int main() { DB *db; db->open(db, 0, 0, NULL, DB_BTREE, DB_CREATE, 0644); } "
HAVE_BERKELEY_DB )
if( HAVE_BERKELEY_DB )
- set( BDB_LIBRARY db )
-else( )
- tde_message_fatal( "berkeley db are required, but not found on your system" )
+ find_library( BDB_LIBRARY db PATH_SUFFIXES db5 db4 )
+endif( )
+
+if( NOT BDB_LIBRARY )
+ tde_message_fatal( "berkeley db is required, but was not found on your system" )
endif( )
-# check for subversion
+##### check for subversion #####################
if( WITH_VCS_SUBVERSION )
pkg_search_module( APR apr-1 )
if( NOT APR_FOUND )
diff --git a/config.h.cmake b/config.h.cmake
index d472dc5d..790ee5b3 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -5,3 +5,6 @@
#cmakedefine HAVE_SYS_STROPTS_H 1
#cmakedefine HAVE_MKFIFO 1
+
+// lib/catalog
+#cmakedefine USE_DB_H_PATH <@USE_DB_H_PATH@>
diff --git a/lib/catalog/catalog.cpp b/lib/catalog/catalog.cpp
index 1422a624..f86dd88d 100644
--- a/lib/catalog/catalog.cpp
+++ b/lib/catalog/catalog.cpp
@@ -25,13 +25,17 @@
#include <krandomsequence.h>
#include <kdebug.h>
-
#include <cstring>
#include <cstdlib>
-#include <db.h>
#include <config.h>
+#ifdef USE_DB_H_PATH
+#include USE_DB_H_PATH
+#else
+#include <db.h>
+#endif
+
struct _Catalog_Private
{
TQString dbName;