Update translations from Transifex
[midnight-commander.git] / m4.include / mc-glib.m4
blobba4901f793b50a9456365036d565f1096244eb0f
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([mc_G_MODULE_SUPPORTED], [
8     g_module_supported=""
10     found_gmodule=no
11     PKG_CHECK_MODULES(GMODULE, [gmodule-no-export-2.0 >= 2.30], [found_gmodule=yes], [:])
12     if test x"$found_gmodule" = xyes; then
13         g_module_supported="gmodule-no-export-2.0"
14     else
15         dnl try fallback to the generic gmodule
16         PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.30], [found_gmodule=yes], [:])
17         if test x"$found_gmodule" = xyes; then
18             g_module_supported="gmodule-2.0"
19         fi
20     fi
22     case x"$g_module_supported" in
23         xgmodule-no-export-2.0|xgmodule-2.0)
24             if test x`$PKG_CONFIG --variable=gmodule_supported "$g_module_supported"` = xtrue; then
25                 AC_DEFINE([HAVE_GMODULE], [1], [Defined if gmodule functionality is supported])
26             else
27                 g_module_supported=""
28             fi
29             ;;
30         *)
31             g_module_supported=""
32             ;;
33     esac
35     dnl
36     dnl Try to find static libraries for glib and gmodule.
37     dnl
38     if test x$with_glib_static = xyes; then
39         new_GLIB_LIBS=
40         for i in $GLIB_LIBS; do
41             case x$i in
42             x-lglib*)
43                 lib=glib ;;
44             x-lgmodule*)
45                 lib=gmodule ;;
46             *)
47                 lib=
48                 add="$i" ;;
49             esac
51             if test -n "$lib"; then
52                 lib1=`echo $i | sed 's/^-l//'`
53                 if test -f "$GLIB_LIBDIR/lib${lib1}.a"; then
54                     add="$GLIB_LIBDIR/lib${lib1}.a"
55                 else
56                     if test -f "$GLIB_LIBDIR/lib${lib}.a"; then
57                         add="$GLIB_LIBDIR/lib${lib}.a"
58                     else
59                         AC_MSG_ERROR([Cannot find static $lib])
60                     fi
61                 fi
62             fi
63             new_GLIB_LIBS="$new_GLIB_LIBS $add"
64         done
65         GLIB_LIBS="$new_GLIB_LIBS"
66     fi
70 AC_DEFUN([mc_CHECK_GLIB], [
71     dnl
72     dnl First try glib 2.x.
73     dnl Keep this check close to the beginning, so that the users
74     dnl without any glib won't have their time wasted by other checks.
75     dnl
77     AC_ARG_WITH([glib_static],
78         AS_HELP_STRING([--with-glib-static], [Link glib statically @<:@no@:>@]))
80     glib_found=no
81     PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.30], [glib_found=yes], [:])
82     if test x"$glib_found" = xno; then
83         AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.30)])
84     fi