[PATCH] Introduced --with-gtk option for configure.ac
Peter Hatina
phatina at redhat.com
Fri May 11 03:24:55 PDT 2012
Hi,
I ran across a problem, that deals with GTK+ of different versions. IcedTeaPlugin
is unusable in webkitgtk browsers, that are compiled against GTK+ 3.x. The issue
can be solved by compiling IcedTeaPlugin with corrent GTK+. Current state of this
plugin can be seen in eg. Fedora 16, 17 (browser epiphany can not use Java applets).
Can you, please review my patch, that adds desired option for configure script,
which sets up GTK+ compiler flags and libraries to correct version (2.x or 3.x)?
Thank you in advance,
cheers,
Peter Hatina
EMEA ENG-Desktop Development
Red Hat Czech, Brno
---
ChangeLog | 4 ++++
NEWS | 2 ++
acinclude.m4 | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 82c0feb..4cf3ebf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-11 Peter Hatina <phatina at redhat.com>
+ Introduced configure option --with-gtk=2.0|3.0 to be able to compile
+ against different version of GTK+ (2.x or 3.x).
+
2012-05-02 Jiri Vanek <jvanek at redhat.com>
Introduced new annotations Bug (to connect test/reproducer with documentation)
diff --git a/NEWS b/NEWS
index 8397639..38dc1c0 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ New in release 1.3 (2012-XX-XX):
- PR895: IcedTea-Web searches for missing classes on each loadClass or findClass
* Common
- PR918: java applet windows uses a low resulution black/white icon
+* GTK+ 2.0|3.0
+ - RHX720836: project can be compiled against GTK+ 2.x or 3.x libraries
New in release 1.2 (2011-XX-XX):
* Security updates:
diff --git a/acinclude.m4 b/acinclude.m4
index a330d0f..647f781 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -359,13 +359,65 @@ AC_ARG_ENABLE([plugin],
AC_MSG_RESULT(${enable_plugin})
])
+dnl GTK_CHECK_VERSION([gtk version], [ACTION-IF-FOUND], [ACTION-IF-NOT])
+AC_DEFUN([GTK_CHECK_VERSION],
+[
+ if pkg-config --modversion gtk+-$1 &> /dev/null; then
+ $2
+ else
+ $3
+ fi
+])
+
+dnl GTK_SET_CXX_VARS([gtk version])
+AC_DEFUN([GTK_SET_CXX_VARS],
+[
+ GTK_CFLAGS=`pkg-config --cflags gtk+-$1`
+ GTK_LIBS=`pkg-config --libs gtk+-$1`
+])
+
+dnl GTK_CHECK([gtk version])
+AC_DEFUN([GTK_CHECK],
+[
+ AC_CACHE_CHECK([for GTK+], [gtk_cv_version],
+ [
+ case "$1" in
+ default)
+ GTK_CHECK_VERSION(["3.0"],
+ [echo -n "3.0"
+ GTK_SET_CXX_VARS(["3.0"])],
+ [GTK_CHECK_VERSION(["2.0"],
+ [echo -n "2.0"
+ GTK_SET_CXX_VARS(["2.0"])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([GTK+ not found])])])
+ ;;
+ *)
+ GTK_CHECK_VERSION([$1],
+ [echo -n "$1"
+ GTK_SET_CXX_VARS([$1])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([GTK+ $1 not found])])
+ ;;
+ esac
+ ])
+])
+
AC_DEFUN_ONCE([IT_CHECK_PLUGIN_DEPENDENCIES],
[
dnl Check for plugin support headers and libraries.
dnl FIXME: use unstable
AC_REQUIRE([IT_CHECK_PLUGIN])
if test "x${enable_plugin}" = "xyes" ; then
- PKG_CHECK_MODULES(GTK, gtk+-2.0)
+ AC_ARG_WITH([gtk],
+ [AS_HELP_STRING([--with-gtk=2.0|3.0],
+ [the GTK+ version to use (default: 2.0)])],
+ [case "$with_gtk" in
+ 2.0|3.0) ;;
+ *) AC_MSG_ERROR([invalid GTK+ version specified]) ;;
+ esac],
+ [with_gtk=default])
+ GTK_CHECK([$with_gtk])
PKG_CHECK_MODULES(GLIB, glib-2.0)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
--
1.7.10.1
More information about the distro-pkg-dev
mailing list