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], [
11 PKG_CHECK_MODULES(GMODULE, [gmodule-no-export-2.0 >= 2.12], [found_gmodule=yes], [:])
12 if test x"$found_gmodule" = xyes; then
13 g_module_supported="gmodule-no-export-2.0"
15 dnl try fallback to the generic gmodule
16 PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.12], [found_gmodule=yes], [:])
17 if test x"$found_gmodule" = xyes; then
18 g_module_supported="gmodule-2.0"
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])
35 AM_CONDITIONAL([HAVE_GMODULE], [test x"$g_module_supported" != x])
38 dnl Try to find static libraries for glib and gmodule.
40 if test x$with_glib_static = xyes; then
42 for i in $GLIB_LIBS; do
53 if test -n "$lib"; then
54 lib1=`echo $i | sed 's/^-l//'`
55 if test -f "$GLIB_LIBDIR/lib${lib1}.a"; then
56 add="$GLIB_LIBDIR/lib${lib1}.a"
58 if test -f "$GLIB_LIBDIR/lib${lib}.a"; then
59 add="$GLIB_LIBDIR/lib${lib}.a"
61 AC_MSG_ERROR([Cannot find static $lib])
65 new_GLIB_LIBS="$new_GLIB_LIBS $add"
67 GLIB_LIBS="$new_GLIB_LIBS"
72 AC_DEFUN([AC_CHECK_GLIB], [
74 dnl First try glib 2.x.
75 dnl Keep this check close to the beginning, so that the users
76 dnl without any glib won't have their time wasted by other checks.
79 AC_ARG_WITH([glib_static],
80 AS_HELP_STRING([--with-glib-static], [Link glib statically @<:@no@:>@]))
83 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.12], [glib_found=yes], [:])
84 if test x"$glib_found" = xno; then
85 AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.12)])