Fix of mouse and ca capabilities check.
[midnight-commander.git] / m4.include / ac-g-module-supported.m4
blob359b6cf41c70a23cab8fb160c653111fb97e1714
1 dnl
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.
5 dnl
6 AC_DEFUN([AC_G_MODULE_SUPPORTED], [
8     g_module_supported=""
9     if test x"$no_x" = xyes; then
10         textmode_x11_support="no"
11     else
12         found_gmodule=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"
16         else
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"
21             fi
22         fi
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])
29                 else
30                     g_module_supported=""
31                 fi
32                 ;;
33             *)
34                 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
35                 g_module_supported=""
36                 ;;
37         esac
39         AC_DEFINE([HAVE_TEXTMODE_X11_SUPPORT], [1],
40                         [Define to enable getting events from X Window System])
41         textmode_x11_support="yes"
42     fi
44     AM_CONDITIONAL([HAVE_GMODULE], [test x"$g_module_supported" != x])