summaryrefslogtreecommitdiffstats
path: root/m4.include/mc-glib.m4
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:22:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:22:03 +0000
commitffccd5b2b05243e7976db80f90f453dccfae9886 (patch)
tree39a43152d27f7390d8f7a6fb276fa6887f87c6e8 /m4.include/mc-glib.m4
parentInitial commit. (diff)
downloadmc-upstream/3%4.8.30.tar.xz
mc-upstream/3%4.8.30.zip
Adding upstream version 3:4.8.30.upstream/3%4.8.30
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--m4.include/mc-glib.m487
1 files changed, 87 insertions, 0 deletions
diff --git a/m4.include/mc-glib.m4 b/m4.include/mc-glib.m4
new file mode 100644
index 0000000..4008207
--- /dev/null
+++ b/m4.include/mc-glib.m4
@@ -0,0 +1,87 @@
+dnl
+dnl Check whether the g_module_* family of functions works
+dnl on this system. We need to know that at the compile time to
+dnl decide whether to link with X11.
+dnl
+AC_DEFUN([mc_G_MODULE_SUPPORTED], [
+
+ g_module_supported=""
+
+ found_gmodule=no
+ PKG_CHECK_MODULES(GMODULE, [gmodule-no-export-2.0 >= 2.30], [found_gmodule=yes], [:])
+ if test x"$found_gmodule" = xyes; then
+ g_module_supported="gmodule-no-export-2.0"
+ else
+ dnl try fallback to the generic gmodule
+ PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.30], [found_gmodule=yes], [:])
+ if test x"$found_gmodule" = xyes; then
+ g_module_supported="gmodule-2.0"
+ fi
+ fi
+
+ case x"$g_module_supported" in
+ xgmodule-no-export-2.0|xgmodule-2.0)
+ if test x`$PKG_CONFIG --variable=gmodule_supported "$g_module_supported"` = xtrue; then
+ AC_DEFINE([HAVE_GMODULE], [1], [Defined if gmodule functionality is supported])
+ else
+ g_module_supported=""
+ fi
+ ;;
+ *)
+ g_module_supported=""
+ ;;
+ esac
+
+ dnl
+ dnl Try to find static libraries for glib and gmodule.
+ dnl
+ if test x$with_glib_static = xyes; then
+ new_GLIB_LIBS=
+ for i in $GLIB_LIBS; do
+ case x$i in
+ x-lglib*)
+ lib=glib ;;
+ x-lgmodule*)
+ lib=gmodule ;;
+ *)
+ lib=
+ add="$i" ;;
+ esac
+
+ if test -n "$lib"; then
+ lib1=`echo $i | ${SED-sed} 's/^-l//'`
+ if test -f "$GLIB_LIBDIR/lib${lib1}.a"; then
+ add="$GLIB_LIBDIR/lib${lib1}.a"
+ else
+ if test -f "$GLIB_LIBDIR/lib${lib}.a"; then
+ add="$GLIB_LIBDIR/lib${lib}.a"
+ else
+ AC_MSG_ERROR([Cannot find static $lib])
+ fi
+ fi
+ fi
+ new_GLIB_LIBS="$new_GLIB_LIBS $add"
+ done
+ GLIB_LIBS="$new_GLIB_LIBS"
+ fi
+
+])
+
+AC_DEFUN([mc_CHECK_GLIB], [
+ dnl
+ dnl First try glib 2.x.
+ dnl Keep this check close to the beginning, so that the users
+ dnl without any glib won't have their time wasted by other checks.
+ dnl
+
+ AC_ARG_WITH([glib_static],
+ AS_HELP_STRING([--with-glib-static], [Link glib statically @<:@no@:>@]))
+
+ glib_found=no
+ PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.30], [glib_found=yes], [:])
+ if test x"$glib_found" = xno; then
+ AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.30)])
+ fi
+
+])
+