ac-glib.m4 3.1 KB

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