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(); ])])