[PATCH] Introduced --with-gtk option for configure.ac

Andrew Hughes ahughes at redhat.com
Fri Jul 27 06:08:18 PDT 2012


----- Original Message -----
> Review, please.
> 
> Peter Hatina
> EMEA ENG-Desktop Development
> Red Hat Czech, Brno
> 
> ---
>  ChangeLog    |    8 ++++++++
>  NEWS         |    1 +
>  acinclude.m4 |   40 +++++++++++++++++++++++++++++++++++++++-
>  3 files changed, 48 insertions(+), 1 deletion(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index 82c0feb..f1d97bf 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,11 @@
> +2012-05-28  Peter Hatina <phatina at redhat.com>
> +
> +	Introduced configure option --with-gtk=2|3|default to be able
> +	to compile against different version of GTK+ (2.x or 3.x).
> +	* NEWS: mentioned bug fix
> +	* acinclude.m4: (ITW_GTK_CHECK_VERSION) macro for getting GTK+
> version
> +	                (ITW_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..cf2a54e 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
> +  - RH720836: 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..a2eafd0 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -359,13 +359,51 @@ AC_ARG_ENABLE([plugin],
>  AC_MSG_RESULT(${enable_plugin})
>  ])
>  
> +dnl ITW_GTK_CHECK_VERSION([gtk version])
> +AC_DEFUN([ITW_GTK_CHECK_VERSION],
> +[
> +  AC_MSG_CHECKING([for GTK$1 version])
> +  GTK_VER=`$PKG_CONFIG --modversion gtk+-$1.0`
> +  AC_MSG_RESULT([$GTK_VER])
> +])
> +
> +dnl ITW_GTK_CHECK([gtk version])
> +AC_DEFUN([ITW_GTK_CHECK],
> +[
> +  case "$1" in
> +    default)
> +      PKG_CHECK_MODULES(GTK, gtk+-3.0,
> +        [ITW_GTK_CHECK_VERSION([3])],
> +        [PKG_CHECK_MODULES(GTK, gtk+-2.0,
> +           [ITW_GTK_CHECK_VERSION([2])],
> +           [AC_MSG_ERROR([GTK not found])]
> +        )]
> +      )
> +      ;;
> +    *)
> +      PKG_CHECK_MODULES(GTK, gtk+-$1.0,
> +        [ITW_GTK_CHECK_VERSION([$1])],
> +        [AC_MSG_ERROR([GTK 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
> 
> 

This looks good, though it would be nice to have the version in the instance of [AC_MSG_ERROR([GTK not found])] where $1 is used.

Good to go from my side, with that addition.
-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: 248BDC07 (https://keys.indymedia.org/)
Fingerprint = EC5A 1F5E C0AD 1D15 8F1F  8F91 3B96 A578 248B DC07




More information about the distro-pkg-dev mailing list