[vte] Make vte dual buildable with gtk2 and gtk3



commit 332e694b5067c7e8e5d2f32ceccbd229243a3ff7
Author: Christian Persch <chpe gnome org>
Date:   Fri May 28 21:10:46 2010 +0200

    Make vte dual buildable with gtk2 and gtk3
    
    Gtk3 build is untested.

 Makefile.am               |    8 +++-
 configure.in              |   82 ++++++++++++++++++++++++++++++++++++--------
 doc/reference/Makefile.am |    4 +-
 src/Makefile.am           |   64 ++++++++++++++++++-----------------
 vte-uninstalled.pc.in     |    2 +-
 vte.pc.in                 |    4 +-
 6 files changed, 111 insertions(+), 53 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 7f4d0cb..633e44c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,8 @@
-SUBDIRS = src python termcaps po doc perf
+SUBDIRS = src termcaps po doc perf
+
+if HAVE_GTK_2
+SUBDIRS += python
+endif
 
 EXTRA_DIST = \
 	MAINTAINERS \
@@ -17,7 +21,7 @@ SUBDIRS += glade
 endif
 
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = vte.pc
+pkgconfig_DATA = vte$(VTE_PC_VERSION).pc
 
 DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection --disable-silent-rules
 
diff --git a/configure.in b/configure.in
index 0b40db1..662a717 100644
--- a/configure.in
+++ b/configure.in
@@ -3,8 +3,6 @@ m4_define([vte_version_minor],[25])
 m4_define([vte_version_micro],[1])
 m4_define([vte_version],[vte_version_major.vte_version_minor.vte_version_micro])
 
-m4_define([vte_api_version],[0])
-
 AC_PREREQ([2.59])
 AC_INIT(vte, [vte_version],
         [http://bugzilla.gnome.org/enter_bug.cgi?product=vte])
@@ -33,6 +31,50 @@ LIBVTE_LTVERSION="lt_current():lt_revision():lt_age()"
 AC_SUBST([LIBVTE_LTVERSION])
 
 ################################################################################
+# GTK+
+################################################################################
+
+AC_MSG_CHECKING([which gtk+ version to compile against])
+AC_ARG_WITH([gtk],
+  [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])],
+  [case "$with_gtk" in
+     2.0|3.0) ;;
+     *) AC_MSG_ERROR([invalid gtk version specified]) ;;
+   esac],
+  [with_gtk=2.0])
+AC_MSG_RESULT([$with_gtk])
+
+case "$with_gtk" in
+  2.0) VTE_API_VERSION=0.0
+       VTE_API_MAJOR_VERSION=0
+       VTE_API_MINOR_VERSION=0
+       VTE_PC_VERSION=
+       VTE_LIBRARY_SUFFIX=
+       GTK_API_VERSION=2.0
+       GTK_REQUIRED=2.14.0
+       ;;
+  3.0) VTE_API_VERSION=2.90
+       VTE_API_MAJOR_VERSION=2
+       VTE_API_MINOR_VERSION=90
+       VTE_PC_VERSION=-2.90
+       VTE_LIBRARY_SUFFIX=2.90
+       GTK_API_VERSION=3.0
+       GTK_REQUIRED=2.90.0
+       ;;
+esac
+
+AC_SUBST([VTE_API_VERSION])
+AC_SUBST([VTE_API_VERSION_U],[AS_TR_SH([$VTE_API_VERSION])])
+AC_SUBST([VTE_API_MAJOR_VERSION])
+AC_SUBST([VTE_API_MINOR_VERSION])
+AC_SUBST([VTE_PC_VERSION])
+AC_SUBST([GTK_API_VERSION])
+AC_SUBST([VTE_LIBRARY_SUFFIX_U],[AS_TR_SH([$VTE_LIBRARY_SUFFIX])])
+
+AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
+AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
+
+################################################################################
 
 AC_ISC_POSIX
 AC_PROG_CC
@@ -254,10 +296,12 @@ esac
 
 GLIB_REQUIRED=2.22.0
 PANGO_REQUIRED=1.22.0
-GTK_REQUIRED=2.14.0
 AC_DEFINE(GDK_MULTIHEAD_SAFE,1,[Force use of GDK's multihead-safe APIs.])
 PKG_CHECK_MODULES(GLIB,[glib-2.0 > $GLIB_REQUIRED gobject-2.0])
-PKG_CHECK_MODULES(GTK,[glib-2.0 >= $GLIB_REQUIRED gobject-2.0 gtk+-2.0 >= $GTK_REQUIRED])
+PKG_CHECK_MODULES(GTK,[glib-2.0 >= $GLIB_REQUIRED gobject-2.0 gtk+-$GTK_API_VERSION >= $GTK_REQUIRED])
+
+AC_PATH_PROG([GLIB_GENMARSHAL],[glib-genmarshal])
+AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
 
 # Let the user specify the default terminal emulation.
 AC_ARG_WITH(default-emulation,
@@ -336,14 +380,14 @@ esac
 
 # We have a direct dependency on X11 on gdk-x11, see bug #613525
 AC_MSG_CHECKING([for GDK target])
-GDK_TARGET="$($PKG_CONFIG --variable target gdk-2.0)"
+GDK_TARGET="$($PKG_CONFIG --variable target gdk-$GTK_API_VERSION)"
 AC_MSG_RESULT([$GDK_TARGET])
 case "$GDK_TARGET" in
   x11) PLATFORM_PKGS="x11 cairo-xlib" ;;
   *) PLATFORM_PKGS="" ;;
 esac
 
-VTE_PKGS="glib-2.0 >= $GLIB_REQUIRED gobject-2.0 pango >= $PANGO_REQUIRED gtk+-2.0 >= $GTK_REQUIRED gobject-2.0 gio-2.0 gio-unix-2.0 $PLATFORM_PKGS"
+VTE_PKGS="glib-2.0 >= $GLIB_REQUIRED gobject-2.0 pango >= $PANGO_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gobject-2.0 gio-2.0 gio-unix-2.0 $PLATFORM_PKGS"
 PKG_CHECK_MODULES([VTE],[$VTE_PKGS])
 AC_SUBST([VTE_PKGS])
 
@@ -370,6 +414,8 @@ AC_CHECK_TYPES(wint_t, AC_DEFINE(HAVE_WINT_T, , [Defined when the wint_t type is
 # Auxillary modules
 ################################################################################
 
+if test "$with_gtk" = "2.0"; then
+
 # Search for Python.
 BUILD_PYTHON=true
 AC_ARG_ENABLE(python, [AS_HELP_STRING(--enable-python,Build python bindings [default=yes])],[
@@ -435,8 +481,17 @@ fi
 
 AC_SUBST(PYTHONREV)
 AC_SUBST(PYTHONMODULES)
+
+else # with_gtk = 3.0
+  BUILD_PYTHON=false
+fi # with_gtk = 2.0
+
 AM_CONDITIONAL(BUILD_PYTHON_MODULES, $BUILD_PYTHON)
 
+################################################################################
+# GNOME PTY Helper
+################################################################################
+
 AC_ARG_ENABLE(gnome-pty-helper, [AS_HELP_STRING(--enable-gnome-pty-helper,Build a setuid helper for opening ptys [default=yes])], enable_gnome_pty_helper="$enableval", enable_gnome_pty_helper=yes)
 if test "$enable_gnome_pty_helper" != no; then
 	AC_DEFINE(VTE_USE_GNOME_PTY_HELPER,1,[Define if you intend to use gnome-pty-helper.])
@@ -444,9 +499,6 @@ if test "$enable_gnome_pty_helper" != no; then
 fi
 AM_CONDITIONAL(BUILD_GNOME_PTY_HELPER,[test "$enable_gnome_pty_helper" != no])
 
-AC_PATH_PROG([GLIB_GENMARSHAL],[glib-genmarshal])
-AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
-
 ################################################################################
 # Glade catalogue
 ################################################################################
@@ -489,14 +541,13 @@ GOBJECT_INTROSPECTION_CHECK([0.6.7])
 GTK_DOC_CHECK([1.13],[--flavour no-tmpl])
 
 AC_SUBST([GLIB_PREFIX],[$($PKG_CONFIG --variable=prefix glib-2.0)])
-AC_SUBST([GTK_PREFIX],[$($PKG_CONFIG --variable=prefix gtk+-2.0)])
+AC_SUBST([GTK_PREFIX],[$($PKG_CONFIG --variable=prefix gtk+-$GTK_API_VERSION)])
 
 ################################################################################
 
 AC_SUBST([VTE_MAJOR_VERSION],[vte_version_major])
 AC_SUBST([VTE_MINOR_VERSION],[vte_version_minor])
 AC_SUBST([VTE_MICRO_VERSION],[vte_version_micro])
-AC_SUBST([VTE_API_VERSION],[vte_api_version])
 
 ################################################################################
 
@@ -514,11 +565,12 @@ doc/openi18n/Makefile
 doc/reference/Makefile
 doc/reference/version.xml
 glade/Makefile
-vte.pc
-vte-uninstalled.pc
 ])
-AC_OUTPUT
 
+AC_CONFIG_FILES([vte${VTE_PC_VERSION}.pc:vte.pc.in],[VTE_PC_VERSION=${VTE_PC_VERSION}])
+AC_CONFIG_FILES([vte${VTE_PC_VERSION}-uninstalled.pc:vte-uninstalled.pc.in],[VTE_PC_VERSION=${VTE_PC_VERSION}])
+
+AC_OUTPUT
 
 #####################
 # Print configuration
@@ -529,7 +581,7 @@ cat <<EOF | tee -a config.log
 ## Configuration. ##
 ## -------------- ##
 
-Configuration for libvte $VERSION
+Configuration for libvte $VERSION for gtk+-$GTK_API_VERSION
 	Installing Glade catalogue: $enable_glade_catalogue
 	Debugging: $DEBUG
 	Disallow deprecated features: $enable_deprecation
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index 7ce3f8e..f250d63 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -10,7 +10,7 @@ AUTOMAKE_OPTIONS = 1.10
 DOC_MODULE = vte
 
 # Uncomment for versioned docs and specify the version of the module, e.g. '2'.
-# DOC_MODULE_VERSION = $(VTE_API_VERSION)
+DOC_MODULE_VERSION = $(VTE_API_VERSION)
 
 # The top-level SGML file. You can change this if you want to.
 DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.xml
@@ -123,7 +123,7 @@ GTKDOC_CFLAGS = \
 	$(VTE_CFLAGS)
 
 GTKDOC_LIBS = \
-	$(top_builddir)/src/libvte.la \
+	$(top_builddir)/src/libvte VTE_LIBRARY_SUFFIX_U@.la \
 	$(VTE_LIBS)
 
 # This includes the standard gtk-doc make rules, copied by gtkdocize.
diff --git a/src/Makefile.am b/src/Makefile.am
index bff2f73..ed9825f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,11 +4,12 @@ EXTRA_DIST = iso2022.txt
 
 # The library
 
-pkginclude_HEADERS = pty.h reaper.h vte.h vteaccess.h vtepty.h vtetypebuiltins.h vteversion.h vtedeprecated.h
+headerdir = $(includedir)/vte-$(VTE_API_VERSION)/vte
+header_HEADERS = pty.h reaper.h vte.h vteaccess.h vtepty.h vtetypebuiltins.h vteversion.h vtedeprecated.h
 
-lib_LTLIBRARIES = libvte.la
+lib_LTLIBRARIES = libvte VTE_LIBRARY_SUFFIX_U@.la
 
-EXTRA_libvte_la_SOURCES = \
+EXTRA_libvte VTE_LIBRARY_SUFFIX_U@_la_SOURCES = \
 	genkeysyms.py \
 	keysyms.c \
 	marshal.list \
@@ -29,7 +30,7 @@ EXTRA_libvte_la_SOURCES = \
 	vtetypebuiltins.h.template \
 	$(NULL)
 
-libvte_la_SOURCES = \
+libvte VTE_LIBRARY_SUFFIX_U@_la_SOURCES = \
 	buffer.h \
 	caps.c \
 	caps.h \
@@ -89,15 +90,15 @@ libvte_la_SOURCES = \
 	vteversion.h
 	$(NULL)
 
-libvte_la_CPPFLAGS = \
-	-DG_LOG_DOMAIN=\"Vte\" \
+libvte VTE_LIBRARY_SUFFIX_U@_la_CPPFLAGS = \
+	-DG_LOG_DOMAIN=\"Vte-$(VTE_API_VERSION)\" \
  	-DDATADIR='"$(datadir)"' \
 	-DLIBEXECDIR='"$(libexecdir)"' \
 	-DLOCALEDIR='"$(localedir)"' \
 	-DVTE_COMPILATION
-libvte_la_CFLAGS = $(VTE_CFLAGS)
-libvte_la_LIBADD = $(VTE_LIBS)
-libvte_la_LDFLAGS = \
+libvte VTE_LIBRARY_SUFFIX_U@_la_CFLAGS = $(VTE_CFLAGS)
+libvte VTE_LIBRARY_SUFFIX_U@_la_LIBADD = $(VTE_LIBS)
+libvte VTE_LIBRARY_SUFFIX_U@_la_LDFLAGS = \
 	-version-info $(LIBVTE_LTVERSION) \
 	-export-symbols-regex "^vte_terminal_.*|^vte_pty_.*|^_vte_pty_.*|^vte_reaper_.*|_vte_debug_.*" \
 	@LIBTOOL_EXPORT_OPTIONS@ @LIBTOOL_FLAGS@
@@ -146,11 +147,11 @@ vteseq-list.h: vteseq-2.gperf vteseq-n.gperf
 
 # vte the application
 
-bin_PROGRAMS = vte
+bin_PROGRAMS = vte VTE_LIBRARY_SUFFIX_U@
 
-vte_SOURCES = vteapp.c
-vte_CFLAGS = $(VTE_CFLAGS)
-vte_LDADD = libvte.la $(VTE_LIBS)
+vte VTE_LIBRARY_SUFFIX_U@_SOURCES = vteapp.c
+vte VTE_LIBRARY_SUFFIX_U@_CFLAGS = $(VTE_CFLAGS)
+vte VTE_LIBRARY_SUFFIX_U@_LDADD = libvte VTE_LIBRARY_SUFFIX_U@.la $(VTE_LIBS)
 
 # introspection
 
@@ -159,21 +160,21 @@ INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
 INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
 
 if HAVE_INTROSPECTION
-introspection_sources = \
-    vte.c \
-    vte.h \
-    vtepty.h \
-    pty.c \
-    vtetypebuiltins.c \
-    vtetypebuiltins.h
-
-Vte- VTE_API_VERSION@.gir: libvte.la
-Vte_ VTE_API_VERSION@_gir_INCLUDES = Pango-1.0 Gdk-2.0 Gtk-2.0
-Vte_ VTE_API_VERSION@_gir_CFLAGS = $(VTE_CFLAGS) -DVTE_COMPILATION -I$(top_srcdir)
-Vte_ VTE_API_VERSION@_gir_LIBS = libvte.la
-Vte_ VTE_API_VERSION@_gir_FILES = $(addprefix $(srcdir)/,$(introspection_sources))
-
-INTROSPECTION_GIRS += Vte- VTE_API_VERSION@.gir
+
+Vte- VTE_API_VERSION@.gir: libvte VTE_LIBRARY_SUFFIX_U@.la
+Vte_ VTE_API_VERSION_U@_gir_INCLUDES = Pango-1.0 Gdk-$(GTK_API_VERSION) Gtk-$(GTK_API_VERSION)
+Vte_ VTE_API_VERSION_U@_gir_CFLAGS = $(VTE_CFLAGS) -DVTE_COMPILATION -I$(top_srcdir)
+Vte_ VTE_API_VERSION_U@_gir_LIBS = libvte VTE_LIBRARY_SUFFIX_U@.la
+Vte_ VTE_API_VERSION_U@_gir_FILES = \
+	vte.c \
+	vte.h \
+	vtepty.h \
+	pty.c \
+	vtetypebuiltins.c \
+	vtetypebuiltins.h \
+	$(NULL)
+
+INTROSPECTION_GIRS += Vte-$(VTE_API_VERSION).gir
 
 girdir = $(INTROSPECTION_GIRDIR)
 dist_gir_DATA = $(INTROSPECTION_GIRS)
@@ -187,8 +188,9 @@ endif
 
 # Misc unit tests and utilities
 
-pkglib_PROGRAMS = interpret slowcat
-pkglib_SCRIPTS = decset osc window
+vtelibdir = $(libdir)/vte-$(VTE_API_VERSION)
+vtelib_PROGRAMS = interpret slowcat
+vtelib_SCRIPTS = decset osc window
 EXTRA_DIST += $(pkglib_SCRIPTS)
 
 TEST_SH = check-doc-syntax.sh
@@ -208,7 +210,7 @@ reflect_text_view_LDADD = $(VTE_LIBS)
 reflect_vte_CPPFLAGS = -DUSE_VTE
 reflect_vte_CFLAGS = $(VTE_CFLAGS)
 reflect_vte_SOURCES = reflect.c
-reflect_vte_LDADD = libvte.la $(VTE_LIBS)
+reflect_vte_LDADD = libvte VTE_LIBRARY_SUFFIX_U@.la $(VTE_LIBS)
 
 interpret_SOURCES = \
 	buffer.h \
diff --git a/vte-uninstalled.pc.in b/vte-uninstalled.pc.in
index 1d9fa86..2e37018 100644
--- a/vte-uninstalled.pc.in
+++ b/vte-uninstalled.pc.in
@@ -9,5 +9,5 @@ Name: vte
 Description: Vte terminal widget.
 Version: @VERSION@
 Requires: @VTE_PKGS@
-Libs: ${pc_top_builddir}/${pcfiledir}/src/libvte.la
+Libs: ${pc_top_builddir}/${pcfiledir}/src/libvte VTE_LIBRARY_SUFFIX_U@.la
 Cflags: -I${pc_top_builddir}/${pcfiledir}/src
diff --git a/vte.pc.in b/vte.pc.in
index fc8795a..6466143 100644
--- a/vte.pc.in
+++ b/vte.pc.in
@@ -9,5 +9,5 @@ Name: vte
 Description: Vte terminal widget.
 Version: @VERSION@
 Requires: @VTE_PKGS@
-Libs: -L${libdir} -lvte
-Cflags: -I${includedir}
+Libs: -L${libdir} -lvte VTE_LIBRARY_SUFFIX_U@
+Cflags: -I${includedir}/vte- VTE_API_VERSION@



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]