2 dnl Check whether the g_module_* family of functions works
3 dnl on this system. We need to know that at the compile time to
4 dnl decide whether to link with X11.
6 AC_DEFUN([AC_G_MODULE_SUPPORTED], [
9 if test x"$no_x" = xyes; then
10 textmode_x11_support="no"
13 PKG_CHECK_MODULES(GMODULE, [gmodule-no-export-2.0 >= 2.8], [found_gmodule=yes], [:])
14 if test x"$found_gmodule" = xyes; then
15 g_module_supported="gmodule-no-export-2.0"
17 dnl try fallback to the generic gmodule
18 PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.8], [found_gmodule=yes], [:])
19 if test x"$found_gmodule" = xyes; then
20 g_module_supported="gmodule-2.0"
24 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
25 case x"$g_module_supported" in
26 xgmodule-no-export-2.0|xgmodule-2.0)
27 if test x`$PKG_CONFIG --variable=gmodule_supported "$g_module_supported"` = xtrue; then
28 AC_DEFINE([HAVE_GMODULE], [1], [Defined if gmodule functionality is supported])
34 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
39 AC_DEFINE([HAVE_TEXTMODE_X11_SUPPORT], [1],
40 [Define to enable getting events from X Window System])
41 textmode_x11_support="yes"
44 AM_CONDITIONAL([HAVE_GMODULE], [test x"$g_module_supported" != x])
47 dnl Try to find static libraries for glib and gmodule.
49 if test x$with_glib_static = xyes; then
51 for i in $GLIB_LIBS; do
62 if test -n "$lib"; then
63 lib1=`echo $i | sed 's/^-l//'`
64 if test -f "$GLIB_LIBDIR/lib${lib1}.a"; then
65 add="$GLIB_LIBDIR/lib${lib1}.a"
67 if test -f "$GLIB_LIBDIR/lib${lib}.a"; then
68 add="$GLIB_LIBDIR/lib${lib}.a"
70 AC_MSG_ERROR([Cannot find static $lib])
74 new_GLIB_LIBS="$new_GLIB_LIBS $add"
76 GLIB_LIBS="$new_GLIB_LIBS"
81 AC_DEFUN([AC_CHECK_GLIB], [
83 dnl First try glib 2.x.
84 dnl Keep this check close to the beginning, so that the users
85 dnl without any glib won't have their time wasted by other checks.
88 AC_ARG_WITH([glib_static],
89 AS_HELP_STRING([--with-glib-static], [Link glib statically @<:@no@:>@]))
92 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.8], [glib_found=yes], [:])
93 if test x"$glib_found" = xno; then
94 AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.8)])