Added SILC Thread Queue API
[crypto.git] / apps / silcer / macros / gnome-x-checks.m4
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
26         saved_ldflags="$LDFLAGS"
27         LDFLAGS="$LDFLAGS $GTK_LIBS"
28
29         gnome_cv_passdown_x_libs="$GTK_LIBS"
30         gnome_cv_passdown_X_LIBS="$GTK_LIBS"
31         gnome_cv_passdown_X_CFLAGS="$GTK_CFLAGS"
32         gnome_cv_passdown_GTK_LIBS="$GTK_LIBS"
33
34         LDFLAGS="$saved_ldflags $GTK_LIBS"
35
36 dnl We are requiring GTK >= 1.1.1, which means this will be fine anyhow.
37         USE_DEVGTK=true
38
39 dnl     AC_MSG_CHECKING([whether to use features from (unstable) GTK+ 1.1.x])
40 dnl     AC_EGREP_CPP(answer_affirmatively,
41 dnl     [#include <gtk/gtkfeatures.h>
42 dnl     #ifdef GTK_HAVE_FEATURES_1_1_0
43 dnl        answer_affirmatively
44 dnl     #endif
45 dnl     ], dev_gtk=yes, dev_gtk=no)
46 dnl     if test "$dev_gtk" = "yes"; then
47 dnl        USE_DEVGTK=true
48 dnl     fi
49 dnl     AC_MSG_RESULT("$dev_gtk")
50
51         GNOME_HAVE_SM=true
52         case "$GTK_LIBS" in
53          *-lSM*)
54             dnl Already found it.
55             ;;
56          *)
57             dnl Assume that if we have -lSM then we also have -lICE.
58             AC_CHECK_LIB(SM, SmcSaveYourselfDone,
59                 [GTK_LIBS="-lSM -lICE $GTK_LIBS"],GNOME_HAVE_SM=false,
60                 $x_libs -lICE)
61             ;;
62         esac
63
64         if test "$GNOME_HAVE_SM" = true; then
65            AC_CHECK_HEADERS(X11/SM/SMlib.h,,GNOME_HAVE_SM=false)
66         fi
67
68         if test "$GNOME_HAVE_SM" = true; then
69            AC_DEFINE(HAVE_LIBSM)
70         fi
71
72         XPM_LIBS=""
73         AC_CHECK_LIB(Xpm, XpmFreeXpmImage, [XPM_LIBS="-lXpm"], , $x_libs)
74         AC_SUBST(XPM_LIBS)
75
76         AC_REQUIRE([GNOME_PTHREAD_CHECK])
77         LDFLAGS="$saved_ldflags"
78
79         AC_PROVIDE([GNOME_X_CHECKS])
80 ])