diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-02-16 15:53:20 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-02-16 18:46:19 +0000 |
commit | 32298832ed70d5ac7836d46de3df0049b37a3eec (patch) | |
tree | 7c358462506f8bf9870e6efdadde47e1ab1f87a1 /m4macros | |
parent | 68d176d80bf148f7a391dbc73fb0c9ee4111fa9f (diff) | |
download | gtk+-32298832ed70d5ac7836d46de3df0049b37a3eec.tar.gz |
Allow checking for GDK backends
Now that a single shared object can contain multiple backends we also
need to provide a simple way for third party code to verify that the
copy of GDK they are linking to supports their backend.
The simplest way to verify is an m4 macro, GTK_CHECK_BACKEND(), shipped
with the gtk+ m4 macros.
The usage is pretty basic:
GTK_CHECK_BACKEND([x11], [gtk_has_x11=yes], [gtk_has_x11=no])
AM_CONDITIONAL(BUILD_X11_CODE, test "x$gtk_has_x11" = "xno")
https://bugzilla.gnome.org/show_bug.cgi?id=642479
Diffstat (limited to 'm4macros')
-rw-r--r-- | m4macros/gtk-3.0.m4 | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/m4macros/gtk-3.0.m4 b/m4macros/gtk-3.0.m4 index 7d00bc1f6c..3147a76920 100644 --- a/m4macros/gtk-3.0.m4 +++ b/m4macros/gtk-3.0.m4 @@ -194,3 +194,35 @@ main () AC_SUBST(GTK_LIBS) rm -f conf.gtktest ]) + +dnl GTK_CHECK_BACKEND(BACKEND-NAME [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl Tests for BACKEND-NAME in the GTK targets list +dnl +AC_DEFUN([GTK_CHECK_BACKEND], +[ + backend=$1 + if test "x$backend" = "x"; then + AC_MSG_ERROR([A backend must be specified]) + fi + + PKG_PROG_PKG_CONFIG([0.16]) + GDK_TARGETS=`$PKG_CONFIG --variable=targets gdk-3.0` + if test "x$GDK_TARGETS" = "x"; then + ifelse([$3],,[AC_MSG_ERROR([GDK targets not found.])],[$3]) + else + ifelse([$2],,[:],[$2]) + fi + + target_found=no + for target in $GDK_TARGETS; do + if test "x$target" = "x$backend"; then + target_found=yes + fi + done + + if test "x$target_found" = "xno"; then + ifelse([$3],,[AC_MSG_ERROR([Backend $backend not found.])],[$3]) + else + ifelse([$2],,[:],[$2]) + fi +]) |