1 dnl Copyright (C) 2010 Nick Bowler
2 dnl Copying and distribution of this file, with or without modification,
3 dnl are permitted in any medium without royalty provided the copyright
4 dnl notice and this notice are preserved. This file is offered as-is,
5 dnl without any warranty.
7 dnl _DX_GTK2_TEST_PROGRAM(major, minor, micro)
8 AC_DEFUN([_DX_GTK2_TEST_PROGRAM], [AC_LANG_PROGRAM([dnl
10 #if !GTK_CHECK_VERSION( \
11 ifelse([$1], [], [2], [$1]), \
12 ifelse([$2], [], [0], [$2]), \
13 ifelse([$3], [], [0], [$3]))
14 # error Insufficient GTK version
18 char *argv[] = {NULL};
19 gtk_init(&argc, &argv);
23 dnl DX_CHECK_GTK2([min-version], [action-if-ok], [action-if-fail])
24 AC_DEFUN([DX_CHECK_GTK2],
25 [DX_PKG_CONFIG([gtk], [gtk+-2.0], [GTK+])
28 [for GTK+ version at least ifelse([$1], [], [2.0], [$1])],
29 [m4_apply([_DX_GTK2_TEST_PROGRAM], m4_split([$1], [\.]))], [dnl
30 [[$GTK_CFLAGS], [$GTK_LIBS]],
31 [[$pkg_cv_gtk_cflags], [$pkg_cv_gtk_libs],
32 [test ! x"$pkg_failed" = x"yes"]],
35 if test x"$dx_cv_gtk_found" = x"yes"; then
36 ifelse([$2], [], [:], [$2])
38 ifelse([$3], [], [AC_MSG_FAILURE([dnl
39 GTK+ version at least ifelse([$1], [], [2.0], [$1]) is required. The latest
40 version can be obtained from ftp://ftk.gtk.org/.
42 If GTK+ is installed but was not found by this configure script,
43 consider adjusting GTK_CFLAGS and/or GTK_LIBS as necessary.
45 If pkg-config is installed, it may help to adjust PKG_CONFIG_PATH
46 if GTK+ is installed in a non-standard prefix.