Added support for dynamic linking with libdb
authorDevashish Sharma <dsharma@src.gnome.org>
Mon, 24 Apr 2006 09:11:35 +0000 (09:11 +0000)
committerDevashish Sharma <dsharma@src.gnome.org>
Mon, 24 Apr 2006 09:11:35 +0000 (09:11 +0000)
ChangeLog
Makefile.am
addressbook/backends/file/Makefile.am
configure.in
libedataserver/Makefile.am

index 4342bbb..ba650d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-04-24  Devashish Sharma  <sdevashish@novell.com>
+
+       * configure.in : Added a configure time switch to support dynamic
+       linking with libdb. The default is static linking and by using the
+       switch --with-libdb=prefix dynamic linking with libdb can be
+       enabled.
+       Patch by Ross Burton  <ross@burtonini.com>
+       
 2006-04-18  Jeffrey Stedfast  <fejj@novell.com>
 
        * configure.in: Added the Mail Directory configure info.
@@ -49,7 +57,7 @@
 
        * libedataserver/e-data-server-util.c: The fixed Win32 versions of
        g_rename() and g_stat() have been in GLib since GLib 2.8.5, so
-       let's drop them from here.
+let's drop them from here.
 
 2006-02-24  Chenthill Palanisamy  <pchenthill@novell.com>
 
index ff4e489..905ef3e 100644 (file)
@@ -1,7 +1,11 @@
 AUTOMAKE_OPTIONS = 1.6
 DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
 
-SUBDIRS = libdb win32 libedataserver servers camel addressbook calendar libedataserverui src docs art po
+if ! WITH_LIBDB
+LIBDB = libdb
+endif
+
+SUBDIRS = $(LIBDB) win32 libedataserver servers camel addressbook calendar libedataserverui src docs art po
 DIST_SUBDIRS= win32 libedataserver servers camel addressbook calendar libedataserverui src docs art po
 
 changelogs =                   \
index 97bfbc0..2eda712 100644 (file)
@@ -4,7 +4,7 @@ INCLUDES =                                              \
        -I$(top_builddir)                               \
        -I$(top_srcdir)/addressbook                     \
        -I$(top_builddir)/addressbook                   \
-       -I$(top_srcdir)/libdb/dist                      \
+       $(DB_CFLAGS)                                    \
         $(EVOLUTION_ADDRESSBOOK_CFLAGS)
 
 extension_LTLIBRARIES = libebookbackendfile.la
@@ -18,7 +18,7 @@ libebookbackendfile_la_LIBADD =                                               \
        $(top_builddir)/addressbook/libebook/libebook-1.2.la            \
        $(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la  \
        $(top_builddir)/libedataserver/libedataserver-1.2.la            \
-       $(top_builddir)/libdb/dist/libdb-4.1.la                         \
+       $(DB_LIBS)                              \
        $(EVOLUTION_ADDRESSBOOK_LIBS)
 
 libebookbackendfile_la_LDFLAGS =       \
index 75fd742..ba109d8 100644 (file)
@@ -188,6 +188,38 @@ AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec,
                                      [AC_MSG_ERROR([No regex library found])])])
 AC_SUBST(REGEX_LIBS)
 
+dnl **************************************************
+dnl * libdb checking
+dnl **************************************************
+
+AC_ARG_WITH(libdb, AC_HELP_STRING([--with-libdb],[Prefix where libdb is installed]), dynamic_libdb=yes, dynamic_libdb=no)
+if test "x${dynamic_libdb}" = "xyes"; then
+        DB_CFLAGS="-I$withval/include"
+        DB_LIBS="-L$withval/lib -ldb"
+
+        AC_MSG_CHECKING([Berkeley DB])
+        save_cflags=$CFLAGS; CFLAGS=$DB_CFLAGS
+        save_libs=$LIBS; LIBS="$DB_LIBS"
+        AC_LINK_IFELSE(
+                [AC_LANG_PROGRAM([[#include <db.h>]],
+                                 [db_create(NULL, NULL, 0)])],
+                AC_MSG_RESULT(yes),
+                AC_MSG_ERROR(cannot find libdb))
+        CFLAGS=$save_cflags
+        LIBS=$save_libs
+
+        msg_libdb="dynamically linked"
+else
+        DB_CFLAGS="-I\$(top_srcdir)/libdb/dist"
+        DB_LIBS="\$(top_builddir)/libdb/dist/libdb-4.1.la"
+        AC_MSG_NOTICE(Using local libdb)
+        msg_libdb="statically linked to local copy"
+fi
+AM_CONDITIONAL(WITH_LIBDB, test "x$dynamic_libdb" != "xno")
+AC_SUBST(DB_CFLAGS)
+AC_SUBST(DB_LIBS)
+
+
 dnl ******************************
 dnl iconv checking
 dnl ******************************
@@ -1309,8 +1341,9 @@ export privlibdir
 export privincludedir
 export privdatadir
 AC_CONFIG_SUBDIRS(calendar/libical)
-AC_CONFIG_SUBDIRS(libdb/dist)
-
+if test $dynamic_libdb = no; then
+        AC_CONFIG_SUBDIRS(libdb/dist)
+fi
 AC_OUTPUT([
 Makefile
 evolution-data-server-zip
@@ -1414,6 +1447,7 @@ echo "\
        SSL support:      $msg_ssl
        SMIME support:    $msg_smime
        IPv6 support:     $msg_ipv6
+       Berkeley DB:      $msg_libdb
        Exchange support: $msg_exchange
        Dot Locking:      $msg_dot
        File Locking:     $msg_file
index 3ca3e35..a7ff316 100644 (file)
@@ -1,7 +1,7 @@
 INCLUDES =                                                             \
        -I$(top_srcdir)                                                 \
        -DG_LOG_DOMAIN=\"e-data-server\"                                \
-       -I$(top_srcdir)/libdb/dist                                      \
+       $(DB_CFLAGS)                                                    \
        -DE_DATA_SERVER_PREFIX=\"$(prefix)\"                            \
        -DEVOLUTION_LOCALEDIR=\""$(localedir)"\"                        \
        -DE_DATA_SERVER_EXTENSIONDIR=\"$(extensiondir)\"                \
@@ -49,7 +49,7 @@ libedataserver_1_2_la_SOURCES =               \
 libedataserver_1_2_la_LIBADD =                                 \
        $(E_DATA_SERVER_LIBS)                           \
        $(ICONV_LIBS)                                   \
-       $(top_builddir)/libdb/dist/libdb-4.1.la         \
+       $(DB_LIBS)                                      \
        $(SOCKET_LIBS)
 
 libedataserver_1_2_la_LDFLAGS = \