From 436fb98d63b0847f57636fc92f4180ba97cff3cb Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Mon, 9 Jun 2014 19:49:29 -0400 Subject: [PATCH] Import GTK2 detection macro. Now that we have this support we can start bringing in other library tests. --- m4/gtk2.m4 | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 m4/gtk2.m4 diff --git a/m4/gtk2.m4 b/m4/gtk2.m4 new file mode 100644 index 0000000..e292a62 --- /dev/null +++ b/m4/gtk2.m4 @@ -0,0 +1,49 @@ +dnl Copyright © 2010, 2014 Nick Bowler +dnl +dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2. +dnl This is free software: you are free to do what the fuck you want to. +dnl There is NO WARRANTY, to the extent permitted by law. + +dnl DX_LIB_GTK2([min-version], [action-if-ok], [action-if-failed]) +dnl +dnl Search for a working GTK+-2 installation. If such a library is found, +dnl appropriate compiler and linker flags are stored in GTK_CFLAGS and +dnl GTK_LIBS, respectively, and the action-if-ok is performed (may be empty). +dnl If no suitable library is found, then action-if-failed is performed if +dnl non-empty, oherwise configure will stop with a fatal error. +AC_DEFUN([DX_LIB_GTK2], [dnl +DX_LIB_SETUP([gtk], [GTK+])dnl +DX_LIB_PKGCONFIG_FLAGS([gtk], [gtk+-2.0]) +AC_MSG_CHECKING([for GTK+ at least version m4_default([$1], [2.0])]) +DX_LIB_SEARCH_LINK([gtk], + [m4_apply([_DX_LIB_GTK2_TEST], m4_split([$1], [\.]))], + [ + [[$GTK_CFLAGS], [$GTK_LIBS]], + [[$dx_cv_gtk_pkg_cflags], [$dx_cv_gtk_pkg_libs], + [test x"$dx_cv_gtk_pkg_found" = x"yes"]], + ]) +AS_IF([test x"$dx_cv_gtk_lib_found" = x"yes"], [$2], + [m4_default([$3], [AC_MSG_FAILURE([dnl +GTK+ version m4_default([$1], [2.0]) or newer is required. The latest +version may be found at . +m4_newline([DX_LIB_USERFLAG_BLURB([gtk], [GTK+])]) +m4_newline([DX_LIB_PKGCONFIG_BLURB([gtk], [GTK+])]) +])])])]) + +dnl Internal test program for GTK+. Check that the version numbers in the +dnl header are sufficient and that some important functions are defined. +m4_define([_DX_LIB_GTK2_TEST], [AC_LANG_PROGRAM([dnl +#include +@%:@if !GTK_CHECK_VERSION(m4_do( + [m4_default([$1], [2]), ], + [m4_default([$2], [0]), ], + [m4_default([$3], [0]))]) +DX_LIB_COMPILE_ERROR([insufficient GTK version]) +#endif +], [dnl +int argc = 0; +char *arg = NULL; +char **argv = &arg; +gtk_init(&argc, &argv); +gtk_main(); +])]) -- 2.43.0