[PATCH] Introduced --with-gtk option for configure.ac
Peter Hatina
phatina at redhat.com
Wed May 30 06:14:24 PDT 2012
Hi,
I fixed the diff to meet Andrew Hughes suggestions. Hope, it's OK now.
Peter Hatina
EMEA ENG-Desktop Development
Red Hat Czech, Brno
---
ChangeLog | 8 ++++++++
NEWS | 1 +
acinclude.m4 | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 82c0feb..d6f7e0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-28 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).
+ *NEWS: mentioned bug fix
+ *acinclude.m4: (GTK_SET_CXX_VARS) macro for settings GTK+ CFLAGS
+ (GTK_CHECK) macro for checking GTK+ version
+
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..30eb055 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ 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
+ - RHX720836: project can be compiled against GTK+ 2 or 3 libraries
New in release 1.2 (2011-XX-XX):
* Security updates:
diff --git a/acinclude.m4 b/acinclude.m4
index a330d0f..5b801eb 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.0 &> /dev/null; then
+ $2
+ else
+ $3
+ fi
+])
+
+dnl ITW_GTK_SET_CXX_VARS([gtk version])
+AC_DEFUN([ITW_GTK_SET_CXX_VARS],
+[
+ GTK_CFLAGS=`$PKG_CONFIG --cflags gtk+-$1.0`
+ GTK_LIBS=`$PKG_CONFIG --libs gtk+-$1.0`
+])
+
+dnl ITW_GTK_CHECK([gtk version])
+AC_DEFUN([ITW_GTK_CHECK],
+[
+ AC_CACHE_CHECK([for GTK+], [gtk_cv_version],
+ [
+ case "$1" in
+ default)
+ GTK_CHECK_VERSION(["3"],
+ [echo -n `$PKG_CONFIG --modversion gtk+-3.0`
+ ITW_GTK_SET_CXX_VARS(["3"])],
+ [GTK_CHECK_VERSION(["2"],
+ [echo -n `$PKG_CONFIG --modversion gtk+-2.0`
+ ITW_GTK_SET_CXX_VARS(["2"])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([GTK+ not found])])])
+ ;;
+ *)
+ GTK_CHECK_VERSION([$1],
+ [echo -n `$PKG_CONFIG --modversion gtk+-$1.0`
+ ITW_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|3|default]],
+ [the GTK+ version to use (default: 3)])],
+ [case "$with_gtk" in
+ 2|3|default) ;;
+ *) AC_MSG_ERROR([invalid GTK+ version specified]) ;;
+ esac],
+ [with_gtk=default])
+ ITW_GTK_CHECK([$with_gtk])
PKG_CHECK_MODULES(GLIB, glib-2.0)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
--
1.7.10.2
More information about the distro-pkg-dev
mailing list