/tags/rel-0-2-0/FreeSpeech/visix/macros/gnome-x-checks.m4

# · m4 · 80 lines · 69 code · 11 blank · 0 comment · 0 complexity · ace820a0d7c47cab6f341d02cd508cee MD5 · raw file

  1. dnl GNOME_X_CHECKS
  2. dnl
  3. dnl Basic X11 related checks for X11. At the end, the following will be
  4. dnl defined/changed:
  5. dnl GTK_{CFLAGS,LIBS} From AM_PATH_GTK
  6. dnl CPPFLAGS Will include $X_CFLAGS
  7. dnl GNOME_HAVE_SM `true' or `false' depending on whether session
  8. dnl management is available. It is available if
  9. dnl both -lSM and X11/SM/SMlib.h exist. (Some
  10. dnl Solaris boxes have the library but not the header)
  11. dnl XPM_LIBS -lXpm if Xpm library is present, otherwise ""
  12. dnl
  13. dnl The following configure cache variables are defined (but not used):
  14. dnl gnome_cv_passdown_{x_libs,X_LIBS,X_CFLAGS}
  15. dnl
  16. AC_DEFUN([GNOME_X_CHECKS],
  17. [
  18. AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path))
  19. dnl Hope that GTK_CFLAGS have only -I and -D. Otherwise, we could
  20. dnl test -z "$x_includes" || CPPFLAGS="$CPPFLAGS -I$x_includes"
  21. dnl
  22. dnl Use CPPFLAGS instead of CFLAGS because AC_CHECK_HEADERS uses
  23. dnl CPPFLAGS, not CFLAGS
  24. CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
  25. saved_ldflags="$LDFLAGS"
  26. LDFLAGS="$LDFLAGS $GTK_LIBS"
  27. gnome_cv_passdown_x_libs="$GTK_LIBS"
  28. gnome_cv_passdown_X_LIBS="$GTK_LIBS"
  29. gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS"
  30. gnome_cv_passdown_GTK_LIBS="$GTK_LIBS"
  31. LDFLAGS="$saved_ldflags $GTK_LIBS"
  32. dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow.
  33. USE_DEVGTK=true
  34. dnl AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x])
  35. dnl AC_EGREP_CPP(answer_affirmatively,
  36. dnl [#include <gtk/gtkfeatures.h>
  37. dnl #ifdef GTK_HAVE_FEATURES_1_1_0
  38. dnl answer_affirmatively
  39. dnl #endif
  40. dnl ], dev_gtk=yes, dev_gtk=no)
  41. dnl if test "$dev_gtk" = "yes"; then
  42. dnl USE_DEVGTK=true
  43. dnl fi
  44. dnl AC_MSG_RESULT("$dev_gtk")
  45. GNOME_HAVE_SM=true
  46. case "$GTK_LIBS" in
  47. *-lSM*)
  48. dnl Already found it.
  49. ;;
  50. *)
  51. dnl Assume that if we have -lSM then we also have -lICE.
  52. AC_CHECK_LIB(SM, SmcSaveYourselfDone,
  53. [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false,
  54. $x_libs -lICE)
  55. ;;
  56. esac
  57. if test "$GNOME_HAVE_SM" = true; then
  58. AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false)
  59. fi
  60. if test "$GNOME_HAVE_SM" = true; then
  61. AC_DEFINE(HAVE_LIBSM)
  62. fi
  63. XPM_LIBS=""
  64. AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs)
  65. AC_SUBST(XPM_LIBS)
  66. AC_REQUIRE([GNOME_PTHREAD_CHECK])
  67. LDFLAGS="$saved_ldflags"
  68. AC_PROVIDE([GNOME_X_CHECKS])
  69. ])