diff options
author | Jiri Vanek <[email protected]> | 2012-07-31 14:34:51 +0200 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2012-07-31 14:34:51 +0200 |
commit | 23d0dd5fc14e28bbc575c3006823c659cabf47b5 (patch) | |
tree | f9ce00d7553da466d37bba2fa9138f0a16c6e281 /acinclude.m4 | |
parent | 4079dff2ae2b7e47d6a79949f02f6d5a95385598 (diff) |
Introduced configure option --with-gtk=2|3|default to be able
to compile against different version of GTK+ (2.x or 3.x).
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index bdddb77..1ab4c9a 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 $1 not found])] + )] + ) + ;; + *) + PKG_CHECK_MODULES(GTK, gtk+-$1.0, + [ITW_GTK_CHECK_VERSION([$1])], + [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) |