[anjuta] Allow to build without libgd
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] Allow to build without libgd
- Date: Mon, 10 Jun 2013 19:52:26 +0000 (UTC)
commit 730f0d6f47cd24b380d09a82e248fa169e212a27
Author: Sébastien Granjoux <seb sfo free fr>
Date: Mon Jun 10 21:28:31 2013 +0200
Allow to build without libgd
Makefile.am | 5 ++-
autogen.sh | 2 +-
configure.ac | 52 +++++++++++++++++++++++++++---
plugins/sourceview/Makefile.am | 4 +-
plugins/sourceview/sourceview-private.h | 2 +
plugins/sourceview/sourceview.c | 17 ++++++++--
6 files changed, 69 insertions(+), 13 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index df7e89a..7963c40 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,9 +4,12 @@ ACLOCAL_AMFLAGS = -I m4 -I libgd ${ACLOCAL_FLAGS}
@INTLTOOL_DESKTOP_RULE@
+if HAVE_LIBGD
+LIBGD_DIR = libgd
+endif
SUBDIRS = \
pixmaps scripts data \
- doc libanjuta libgd plugins src manuals mime launcher po
+ doc libanjuta $(LIBGD_DIR) plugins src manuals mime launcher po
dist_doc_DATA = \
MAINTAINERS\
diff --git a/autogen.sh b/autogen.sh
index 7827e2e..ec6132d 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -9,7 +9,7 @@ sh -c "cd $srcdir/libanjuta/interfaces && \
perl anjuta-idl-compiler.pl libanjuta && \
touch iface-built.stamp"
-git submodule update --init --recursive
+(cd "$srcdir" && exec git submodule update --init --recursive)
ACLOCAL_FLAGS="-I libgd $ACLOCAL_FLAGS"
diff --git a/configure.ac b/configure.ac
index d00b4cf..fc05c9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,8 @@ AC_SUBST(BUGZILLA_VERSION)
dnl Anjuta core
GLIB_REQUIRED=2.32.0
-GTK_REQUIRED=3.7.10
+GTK_REQUIRED=3.4.0
+LIBGD_GTK_REQUIRED=3.7.10
GTHREAD_REQUIRED=2.22.0
GDK_PIXBUF_REQUIRED=2.0.0
GDA4_REQUIRED=4.2.0
@@ -172,13 +173,45 @@ if test x$AUTOGEN_PATH = xno; then
but several things won't work. You can get it from http://autogen.sourceforge.net/])
fi
+
dnl Check for libgd
-dnl ---------------------
+dnl ---------------
+
+AC_ARG_ENABLE(libgd,
+ AS_HELP_STRING([--disable-libgd], [Do not use libgd which needs a more recent version of Gtk+]),,
+ [enable_libgd=yes])
+
+if test "x$enable_libgd" = "xyes"; then
+ AC_MSG_CHECKING(if libgd is used)
+ PKG_CHECK_EXISTS([gtk+-3.0 >= $LIBGD_GTK_REQUIRED],
+ [ libgd_enabled=yes ],
+ [ libgd_enabled=no ])
+ AC_MSG_RESULT($libgd_enabled)
+else
+ libgd_enabled=no
+fi
+
+if test "x$libgd_enabled" = "xyes"; then
+ LIBGD_INIT([
+ revealer
+ static
+ ])
+
+ LOCAL_LIBGD_CFLAGS='-I$(top_srcdir)/libgd'
+ LOCAL_LIBGD_LIBS='$(top_builddir)/libgd/libgd.la'
+ AC_SUBST(LOCAL_LIBGD_CFLAGS)
+ AC_SUBST(LOCAL_LIBGD_LIBS)
+ AC_DEFINE([HAVE_LIBGD], [1], [Define to 1 if libgd is available])
+else
+ dnl LIBGD_INIT contains AM_CONDITIONAL so it has to be run but remove
+ dnl the check of Gtk+ version because we will not use libgd.
+ pushdef([PKG_CHECK_MODULES], [])
+ LIBGD_INIT([])
+ popdef([PKG_CHECK_MODULES])
+fi
+
+AM_CONDITIONAL(HAVE_LIBGD, [test x$libgd_enabled = xyes])
-LIBGD_INIT([
- revealer
- static
-])
dnl Check for Terminal
dnl ---------------------
@@ -957,6 +990,13 @@ else
echo " Requires vte-2.90 (>= $VTE_REQUIRED)"
fi
+if [ test x$libgd_enabled = xyes ]; then
+ echo "Building using libgd: ..................................YES"
+else
+ echo "Building using libgd: ..................................NO"
+ echo " Requires gtk+ (>= $LIBGD_GTK_REQUIRED)"
+fi
+
if [ test x$enable_vala = xyes ]; then
echo "Building Vala support: .................................YES"
else
diff --git a/plugins/sourceview/Makefile.am b/plugins/sourceview/Makefile.am
index 69bf443..f193645 100644
--- a/plugins/sourceview/Makefile.am
+++ b/plugins/sourceview/Makefile.am
@@ -30,7 +30,7 @@ AM_CPPFLAGS = \
$(GIO_CFLAGS) \
$(SOURCEVIEW_CFLAGS) \
$(LIBANJUTA_CFLAGS) \
- -I$(top_srcdir)/libgd \
+ $(LOCAL_LIBGD_CFLAGS) \
-DG_LOG_DOMAIN=\"sourceview\"
# Where to install the plugin
@@ -81,7 +81,7 @@ libanjuta_sourceview_la_LIBADD = \
$(GIO_LIBS) \
$(SOURCEVIEW_LIBS) \
$(LIBANJUTA_LIBS) \
- $(top_builddir)/libgd/libgd.la
+ $(LOCAL_LIBGD_LIBS)
gsettings_in_file = org.gnome.anjuta.plugins.sourceview.gschema.xml.in
gsettings_SCHEMAS = $(gsettings_in_file:.xml.in=.xml)
diff --git a/plugins/sourceview/sourceview-private.h b/plugins/sourceview/sourceview-private.h
index ff7482d..f3816f0 100644
--- a/plugins/sourceview/sourceview-private.h
+++ b/plugins/sourceview/sourceview-private.h
@@ -24,7 +24,9 @@
#include "sourceview-io.h"
#include <libanjuta/anjuta-plugin.h>
+#ifdef HAVE_LIBGD
#include <libgd/gd-revealer.h>
+#endif
#include <glib.h>
struct SourceviewPrivate {
diff --git a/plugins/sourceview/sourceview.c b/plugins/sourceview/sourceview.c
index 9759583..092d1eb 100644
--- a/plugins/sourceview/sourceview.c
+++ b/plugins/sourceview/sourceview.c
@@ -274,19 +274,21 @@ on_destroy_message_area (Sourceview* sv, GObject *finalized_object)
static void
message_area_destroy (GtkWidget* message_area)
{
+#ifdef HAVE_LIBGD
GtkWidget* revealer;
revealer = gtk_widget_get_parent (message_area);
g_signal_connect (revealer, "notify::child-revealed",
G_CALLBACK(gtk_widget_destroy), NULL);
gd_revealer_set_reveal_child (GD_REVEALER (revealer), FALSE);
+#else
+ gtk_widget_destroy (message_area);
+#endif
}
static void
sourceview_set_message_area (Sourceview* sv, GtkWidget *message_area)
{
- GtkWidget* revealer;
-
if (sv->priv->message_area != NULL)
message_area_destroy (sv->priv->message_area);
@@ -297,13 +299,22 @@ sourceview_set_message_area (Sourceview* sv, GtkWidget *message_area)
gtk_widget_show (message_area);
+#ifdef HAVE_LIBGD
+ GtkWidget* revealer;
+
revealer = gd_revealer_new ();
gtk_widget_show (revealer);
gtk_container_add (GTK_CONTAINER (revealer), message_area);
gtk_box_pack_start (GTK_BOX (sv), revealer, FALSE, FALSE, 0);
gd_revealer_set_reveal_child (GD_REVEALER (revealer), TRUE);
-
+#else
+ gtk_box_pack_start (GTK_BOX (sv),
+ message_area,
+ FALSE,
+ FALSE,
+ 0);
+#endif
g_object_weak_ref (G_OBJECT (message_area),
(GWeakNotify)on_destroy_message_area, sv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]