mc-glib.m4 2.6 KB

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