diff options
author | Matthew Allum <breakfast@10.am> | 2004-01-02 22:25:09 +0000 |
---|---|---|
committer | Matthew Allum <breakfast@10.am> | 2004-01-02 22:25:09 +0000 |
commit | d87556675bb367cece7947e72d020e3ba8c50cc9 (patch) | |
tree | 7561f78b22609b927ebc16bcbf40f6178fa36995 | |
parent | 0753131e3fa2a396a2d6a3dec09d5041e6ed1248 (diff) |
Applied patch from Alan Coopersmith with mainly Solaris fixes
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | configure.ac | 41 | ||||
-rw-r--r-- | xrestop.c | 11 |
3 files changed, 51 insertions, 12 deletions
@@ -1,3 +1,14 @@ +2004-01-02 Matthew Allum <mallum@handhelds.com> + + Applied patch from Alan Coopersmith; + + * configure.ac: + check for xres header and lib. Check Solaris X bits. Check for + curses if no ncurses + + * xrestop.c: (window_get_pid), (window_get_utf8_name): + Solaris cc tweaks. Compile with curses if no ncurses. + 2003-12-24 Matthew Allum <mallum@handhelds.com> * doc/Makefile.am: diff --git a/configure.ac b/configure.ac index 1f00f86..af69967 100644 --- a/configure.ac +++ b/configure.ac @@ -20,28 +20,51 @@ if test $have_libx11pc = yes; then PKG_CHECK_MODULES(XLIBS, x11 xres xext) else dnl **** Check for xlibs 'non pc' way **** - AC_PATH_XTRA ALL_X_LIBS="$X_LIBS -lX11" +found_xres_lib=no +AC_CHECK_LIB(XRes, XResQueryClients, XRES_LIBS=-lXRes found_xres_lib=yes,, + -lXext $ALL_X_LIBS) + +if test "x$found_xres_lib" = "xno"; then + # Try again, overriding defaults for certain platforms + case `uname -sr` in + "SunOS 5"*) + # Solaris ships libXres in /usr/openwin/sfw/lib + save_LDFLAGS=$LDFLAGS + SOL_XRES_LDFLAGS="-L/usr/openwin/sfw/lib -R/usr/openwin/sfw/lib" + LDFLAGS="$LDFLAGS $SOL_XRES_LDFLAGS" + AC_CHECK_LIB(XRes, XResQueryClientResources, + found_xres_lib=yes XRES_LIBS="$SOL_XRES_LDFLAGS -lXRes", + ,-lXext $ALL_X_LIBS) + LDFLAGS="$save_LDFLAGS" + ;; + esac +fi + + +if test "x$found_xres_lib" = "xno"; then + AC_MSG_ERROR([Cannot find XRes extension library]) + exit 1 +fi + found_xres=no -AC_CHECK_LIB(XRes, XResQueryClients, - [AC_CHECK_HEADER(X11/extensions/XRes.h, - XRES_LIBS=-lXRes found_xres=yes,, - [#include <X11/Xlib.h>])], - , -lXRes -lXext $ALL_X_LIBS) + +AC_CHECK_HEADER(X11/extensions/XRes.h,found_xres=yes,,[#include <X11/Xlib.h>]) if test "x$found_xres" = "xno"; then - AC_MSG_ERROR([Cannot find XRes extension]) + AC_MSG_ERROR([Cannot find XRes extension headers]) exit 1 fi -XLIBS_LIBS="-lXRes -lXext $ALL_X_LIBS" +XLIBS_LIBS="$XRES_LIBS -lXext $ALL_X_LIBS" fi -AC_CHECK_LIB([ncurses], [initscr]) +# check for ncurses, fall back to curses +AC_CHECK_LIB([ncurses], [initscr],,AC_CHECK_LIB([curses], [initscr])) if test "x$GCC" = "xyes"; then GCC_WARNINGS="-Wall -fno-strict-aliasing" @@ -44,15 +44,21 @@ #include <X11/Xatom.h> #include <X11/extensions/XRes.h> +#ifdef HAVE_LIBNCURSES #include <ncurses.h> +#else +#include <curses.h> +#endif #define DEBUG 1 +#ifdef __GNUC__ #ifdef DEBUG #define DBG(txt, args... ) fprintf(stderr, txt , ##args ) #else #define DBG(txt, args... ) /* nothing */ #endif +#endif enum { ATOM_PIXMAP = 0, @@ -164,7 +170,7 @@ pid_t window_get_pid(XResTopApp *app, Window win) { Atom type; - long bytes_after, n_items; + unsigned long bytes_after, n_items; long *data = NULL; pid_t result = -1; int format; @@ -190,9 +196,8 @@ window_get_utf8_name(XResTopApp *app, Window win) { Atom type; int format; - long bytes_after; + unsigned long bytes_after, n_items; unsigned char *str = NULL; - long n_items; int result; result = XGetWindowProperty (app->dpy, win, app->atoms[ATOM_NET_WM_NAME], |