summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2009-12-09 16:08:26 +0100
committerPatrick Ohly <patrick.ohly@intel.com>2009-12-09 16:24:08 +0100
commit8f1dd1ba953b3e628be2920b394fec51f6cee9a5 (patch)
tree63809bc8be5d8892924c5e2c79ab624b595a8d8d
parent244bef12b9a47b97b0ac2084f0771690a192b4c8 (diff)
autotools: cleaned up checking for GNOME/EDS libs (MB #8338)
The EDS backend was asking for glib support even when it was not active. In combination with not linking against the right libs in that case there was a link failure because g_thread_init() and g_type_init() were not found. When the EDS backend was active, this wasn't a problem because the necessary libs were linked indirectly. This patch reduces the number of libs that are checked and used when not enabling the EDS backend. This is done by resetting the ECAL/EBOOK flags when inactive and only asking for glib when active. It also fixes the checking and linking against gobject and gthread in the case that glib support is requested.
-rw-r--r--configure-post.in35
-rw-r--r--src/Makefile-gen.am4
-rw-r--r--src/backends/evolution/configure-sub.in20
3 files changed, 31 insertions, 28 deletions
diff --git a/configure-post.in b/configure-post.in
index 66432230..44e3d76c 100644
--- a/configure-post.in
+++ b/configure-post.in
@@ -19,16 +19,6 @@ if test "$enable_any" = "no"; then
AC_MSG_ERROR([no backend enabled - refusing to continue: $anymissing])
fi
-dnl check for glib - calling g_type_init() is expected on Maemo
-PKG_CHECK_MODULES(GLIB, "glib-2.0", GLIBFOUND=yes, GLIBFOUND=no)
-# This check here is broken on Ubuntu 8.04: it calls glib-config,
-# which isn't found, but the error is not detected by configure.
-#if test "x${GLIBFOUND}" = "xno"; then
-# PKG_CHECK_MODULES(GLIB, "glib", GLIBFOUND=yes, GLIBFOUND=no)
-#fi
-AC_SUBST(GLIB_CFLAGS)
-AC_SUBST(GLIB_LIBS)
-
dnl check for programs.
AC_PROG_CXX
AC_PROG_LIBTOOL
@@ -36,14 +26,29 @@ AC_PROG_MAKE_SET
dnl glib initialization is done only if requested by some configure-sub.in,
dnl for not needed otherwise even if found
-if test "$need_glib" != "yes"; then
- GLIB_CFLAGS=
- GLIB_LIBS=
-else
+if test "$need_glib" = "yes"; then
+ # HAVE_GLIB (aka GLIBFOUND) are a catch-all for these
+ # three GNOME libs. Assume we have all three unless one of
+ # the checks fails.
+ GLIBFOUND=yes
+
+ dnl check for glib - calling g_type_init() is expected on Maemo
+ PKG_CHECK_MODULES(GLIB, "glib-2.0", , GLIBFOUND=no)
+ # This check here is broken on Ubuntu 8.04: it calls glib-config,
+ # which isn't found, but the error is not detected by configure.
+ #if test "x${GLIBFOUND}" = "xno"; then
+ # PKG_CHECK_MODULES(GLIB, "glib", GLIBFOUND=yes, GLIBFOUND=no)
+ #fi
+
+ PKG_CHECK_MODULES(GTHREAD, "gthread-2.0", , GLIBFOUND=no)
+ PKG_CHECK_MODULES(GOBJECT, "gobject-2.0", , GLIBFOUND=no)
+
if test "x${GLIBFOUND}" = "xyes"; then
AC_DEFINE(HAVE_GLIB, 1, [glib found])
+ else
+ AC_ERROR([not all GNOME libraries found])
fi
- BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $GLIB_CFLAGS"
+ BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $GLIB_CFLAGS $GTHREAD_CFLAGS $GOBJECT_CFLAGS"
fi
dnl figure out whether we link all code statically or as modules
diff --git a/src/Makefile-gen.am b/src/Makefile-gen.am
index 6110fac1..b88cf878 100644
--- a/src/Makefile-gen.am
+++ b/src/Makefile-gen.am
@@ -23,7 +23,7 @@ SUBDIRS = $(SYNTHESIS_SUBDIR) $(DBUS_DIR) syncevo $(BACKENDS) $(GUI_DIR)
DIST_SUBDIRS = dbus syncevo $(BACKENDS) gtk-ui
BUILT_SOURCES =
-AM_CPPFLAGS = $(SUBDIRS:%=-I$(srcdir)/%) -I$(srcdir)/../test -I$(top_srcdir) $(BACKEND_CPPFLAGS) $(GLIB_CFLAGS)
+AM_CPPFLAGS = $(SUBDIRS:%=-I$(srcdir)/%) -I$(srcdir)/../test -I$(top_srcdir) $(BACKEND_CPPFLAGS)
EXTRA_PROGRAMS =
TESTS =
@@ -75,7 +75,7 @@ CORE_SOURCES += $(BACKEND_REGISTRIES)
endif
CORE_CXXFLAGS = $(SYNTHESIS_CFLAGS)
-CORE_LDADD = $(SYNCEVOLUTION_LDADD) syncevo/libsyncevolution.la $(GLIB_LIBS) $(LIBS)
+CORE_LDADD = $(SYNCEVOLUTION_LDADD) syncevo/libsyncevolution.la $(GLIB_LIBS) $(GTHREAD_LIBS) $(GOBJECT_LIBS) $(LIBS)
CORE_DEP = $(SYNCEVOLUTION_DEP) syncevo/libsyncevolution.la $(SYNTHESIS_DEP)
CORE_LD_FLAGS = -uSyncEvolution_Module_Version -Wl,--export-dynamic
diff --git a/src/backends/evolution/configure-sub.in b/src/backends/evolution/configure-sub.in
index 37a9c949..cb3a39b8 100644
--- a/src/backends/evolution/configure-sub.in
+++ b/src/backends/evolution/configure-sub.in
@@ -31,9 +31,6 @@ if test "x${EDSFOUND}" = "xno"; then
PKG_CHECK_MODULES(EPACKAGE, [$pkg_emodules_10], EDSFOUND=yes, [EDSFOUND=no])
fi
fi
-AC_SUBST(EPACKAGE_CFLAGS)
-AC_SUBST(EPACKAGE_LIBS)
-BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $EPACKAGE_CFLAGS"
dnl check for Evolution calendar packages
PKG_CHECK_MODULES(ECAL, [$pkg_ecal_12], ECALFOUND=yes, [ECALFOUND=no])
@@ -43,9 +40,6 @@ if test "x${ECALFOUND}" = "xno"; then
PKG_CHECK_MODULES(ECAL, [$pkg_ecal_10], ECALFOUND=yes, [ECALFOUND=no])
fi
fi
-AC_SUBST(ECAL_CFLAGS)
-AC_SUBST(ECAL_LIBS)
-BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $ECAL_CFLAGS"
dnl check for Evolution contact packages
PKG_CHECK_MODULES(EBOOK, [$pkg_ebook_12], EBOOKFOUND=yes, [EBOOKFOUND=no])
@@ -55,9 +49,6 @@ if test "x${EBOOKFOUND}" = "xno"; then
PKG_CHECK_MODULES(EBOOK, [$pkg_ebook_10], EBOOKFOUND=yes, [EBOOKFOUND=no])
fi
fi
-AC_SUBST(EBOOK_CFLAGS)
-AC_SUBST(EBOOK_LIBS)
-BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $EBOOK_CFLAGS"
AC_ARG_ENABLE_BACKEND(ebook, evolution,
AS_HELP_STRING([--disable-ebook], [disable access to Evolution addressbooks (must be used to compile without it)]),
@@ -75,6 +66,9 @@ if test "$enable_ebook" = "yes"; then
test "x${EBOOKFOUND}" == "xyes" || AC_MSG_ERROR([--enable-ebook requires pkg-config information for libebook, which was not found])
AC_DEFINE(ENABLE_EBOOK, 1, [libebook available])
enable_evo="yes"
+else
+ EBOOK_CFLAGS=
+ EBOOK_LIBS=
fi
AM_CONDITIONAL([ENABLE_ECAL], [test "$enable_ecal" == "yes"])
@@ -82,11 +76,13 @@ if test "$enable_ecal" = "yes"; then
test "x${ECALFOUND}" == "xyes" || AC_MSG_ERROR([--enable-ecal requires pkg-config information for libecal, which was not found"])
AC_DEFINE(ENABLE_ECAL, 1, [libecal available])
enable_evo="yes"
+else
+ ECAL_CFLAGS=
+ ECAL_LIBS=
fi
-need_glib="yes"
-
if test "$enable_evo" = "yes"; then
+ need_glib="yes"
if test "$EDSFOUND" = "yes"; then
AC_DEFINE(HAVE_EDS, 1, [evolution-dataserver available])
else
@@ -96,3 +92,5 @@ else
EPACKAGE_CFLAGS=
EPACKAGE_LIBS=
fi
+
+BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $EPACKAGE_CFLAGS $ECAL_CFLAGS $EBOOK_CFLAGS"