mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 05:20:17 +00:00
m4: Fix GTK_CHECK_BACKEND() to also check for a minimum version
This should make the macro slightly more useful. Update the documentation mentioning the macro as well.
This commit is contained in:
parent
a88a1fc832
commit
64934a7623
@ -88,10 +88,11 @@ line option <literal>-DGTK_MULTIDEVICE_SAFE=1</literal>.
|
|||||||
list of modules to be checked along with GTK+.</listitem>
|
list of modules to be checked along with GTK+.</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>GTK_CHECK_BACKEND([backend-name], [if-found], [if-not-found])</term>
|
<term>GTK_CHECK_BACKEND([backend-name], [minimum-version], [if-found], [if-not-found])</term>
|
||||||
<listitem>This macro should be used to check if a specific backend
|
<listitem>This macro should be used to check if a specific backend
|
||||||
is supported by GTK+. The <emphasis>if-found</emphasis> and the
|
is supported by GTK+. The <emphasis>minimum-version</emphasis>,
|
||||||
<emphasis>if-not-found</emphasis> arguments are optional.</listitem>
|
<emphasis>if-found</emphasis> and <emphasis>if-not-found</emphasis>
|
||||||
|
arguments are optional.</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</para>
|
</para>
|
||||||
|
@ -900,7 +900,7 @@ AM_CONDITIONAL(BUILD_X11, test `$PKG_CONFIG --variable=target gtk+-2.0` = "x11")
|
|||||||
</programlisting></informalexample>
|
</programlisting></informalexample>
|
||||||
then you should now use the M4 macro provided by GTK+ itself:
|
then you should now use the M4 macro provided by GTK+ itself:
|
||||||
<informalexample><programlisting>
|
<informalexample><programlisting>
|
||||||
GTK_CHECK_BACKEND([x11], [have_x11=yes], [have_x11=no])
|
GTK_CHECK_BACKEND([x11], [3.0.2], [have_x11=yes], [have_x11=no])
|
||||||
AM_CONDITIONAL(BUILD_x11, [test "x$have_x11" = "xyes"])
|
AM_CONDITIONAL(BUILD_x11, [test "x$have_x11" = "xyes"])
|
||||||
</programlisting></informalexample>
|
</programlisting></informalexample>
|
||||||
</para>
|
</para>
|
||||||
|
@ -195,34 +195,25 @@ main ()
|
|||||||
rm -f conf.gtktest
|
rm -f conf.gtktest
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl GTK_CHECK_BACKEND(BACKEND-NAME [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
dnl GTK_CHECK_BACKEND(BACKEND-NAME [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||||
dnl Tests for BACKEND-NAME in the GTK targets list
|
dnl Tests for BACKEND-NAME in the GTK targets list
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN([GTK_CHECK_BACKEND],
|
AC_DEFUN([GTK_CHECK_BACKEND],
|
||||||
[
|
[
|
||||||
backend=$1
|
pkg_config_args=ifelse([$1],,gtk+-3.0, gtk+-$1-3.0)
|
||||||
if test "x$backend" = "x"; then
|
min_gtk_version=ifelse([$2],,3.0.0,$2)
|
||||||
AC_MSG_ERROR([A backend must be specified])
|
|
||||||
fi
|
|
||||||
|
|
||||||
PKG_PROG_PKG_CONFIG([0.16])
|
AC_PATH_PROG(PKG_CONFIG, [pkg-config], [AC_MSG_ERROR([No pkg-config found])])
|
||||||
GDK_TARGETS=`$PKG_CONFIG --variable=targets gdk-3.0`
|
|
||||||
if test "x$GDK_TARGETS" = "x"; then
|
if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args ; then
|
||||||
ifelse([$3],,[AC_MSG_ERROR([GDK targets not found.])],[$3])
|
target_found=yes
|
||||||
else
|
else
|
||||||
ifelse([$2],,[:],[$2])
|
target_found=no
|
||||||
fi
|
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
|
if test "x$target_found" = "xno"; then
|
||||||
ifelse([$3],,[AC_MSG_ERROR([Backend $backend not found.])],[$3])
|
ifelse([$4],,[AC_MSG_ERROR([Backend $backend not found.])],[$4])
|
||||||
else
|
else
|
||||||
ifelse([$2],,[:],[$2])
|
ifelse([$3],,[:],[$3])
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user