-dnl> test to find the hard-to-find libXpm
-dnl> mostly copied from AC_PATH_X & AC_PATH_DIRECT, but explictly set
-
-AC_DEFUN([VT_FIND_LIBXPM],
-[
-AC_REQUIRE_CPP()
-
-# Initialize some more variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-
-# If we find XPM, set shell vars xpm_includes and xpm_libraries to the
-# paths, otherwise set no_xpm=yes.
-# Uses ac_ vars as temps to allow command line to override cache and checks.
-AC_MSG_CHECKING(for libXpm)
-
-AC_ARG_WITH(xpm_includes,
- [ --with-xpm-includes=DIR use XPM includes in DIR],
- xpm_includes="$withval", xpm_includes=NO)
-AC_ARG_WITH(xpm_library,
- [ --with-xpm-library=DIR use XPM library in DIR],
- xpm_libraries="$withval", xpm_libraries=NO)
-
-# --without-xpm overrides everything else, but does not touch the cache.
-AC_ARG_WITH(xpm,
- [ --with-xpm use XPM])
-if test "$with_xpm" = no; then
- have_xpm=disabled
-else
- AC_CACHE_VAL(ac_cv_have_xpm, [
- vt_xpm_include_X11=no
- if test -n "$xpm_includes"; then
- vt_xpm_includes=$xpm_includes
- else
- vt_xpm_includes=NO
- fi
- if test -n "$xpm_libraries"; then
- vt_xpm_libraries=$xpm_libraries
- else
- vt_xpm_libraries=NO
- fi
-
- VT_XPM_DIRECT
-
- if test "$vt_xpm_includes" = NO -o "$vt_xpm_libraries" = NO; then
- ac_cv_have_xpm="have_xpm=no"
- else
- ac_cv_have_xpm="have_xpm=yes \
- vt_xpm_includes=$vt_xpm_includes vt_xpm_libraries=$vt_xpm_libraries \
- vt_xpm_include_X11=$vt_xpm_include_X11"
- fi])dnl
- eval "$ac_cv_have_xpm"
-fi
-
-if test "$have_xpm" != yes; then
- AC_MSG_RESULT($have_xpm)
- no_xpm=yes
-else
- if test "$xpm_includes" != NO; then
- if test "$xpm_includes" = "$vt_xpm_includes"; then
- if test -r "$xpm_includes/X11/xpm.h"; then
- vt_xpm_include_X11=yes
- fi
- else
- vt_xpm_include_X11=no
- if test -z "$xpm_includes"; then
- AC_TRY_CPP([#include <X11/xpm.h>],
- vt_xpm_include_X11=yes)
- else
- if test -r "$xpm_includes/X11/xpm.h"; then
- vt_xpm_include_X11=yes
- fi
- fi
- fi
- vt_xpm_includes=$xpm_includes
- fi
- if test "x$xpm_libraries" != xNO; then
- vt_xpm_libraries=$xpm_libraries
- fi
- # Update the cache value to reflect the command line values.
- ac_cv_have_xpm="have_xpm=yes \
- vt_xpm_includes=$vt_xpm_includes vt_xpm_libraries=$vt_xpm_libraries \
- vt_xpm_include_X11=$vt_xpm_include_X11"
- eval "$ac_cv_have_xpm"
- AC_MSG_RESULT([-I$vt_xpm_includes, -L$vt_xpm_libraries])
- if test -n "$vt_xpm_includes"; then
- XPM_CPPFLAGS="-DHAVE_LIBXPM"
- fi
- if test -n "$vt_xpm_includes"; then
- XPM_CFLAGS="-I$vt_xpm_includes"
- fi
- XPM_LIBS="-lXpm"
- if test -n "$vt_xpm_libraries"; then
- XPM_LIBS="-L$vt_xpm_libraries $XPM_LIBS"
- fi
- if test "x$vt_xpm_include_X11" = xyes; then
- AC_DEFINE(XPM_INC_X11, 1, Define if you include <X11/xpm.h> on a normal include path (be careful))
- fi
-fi
-
-AC_SUBST(XPM_CPPFLAGS)
-AC_SUBST(XPM_CFLAGS)
-AC_SUBST(XPM_LIBS)
-])
-
-dnl Internal subroutine of VT_FIND_LIBXPM
-dnl Set vt_xpm_include and vt_xpm_libr
-# -------------- find xpm.h and Xpm.a/Xpm.so/Xpm.sl
-AC_DEFUN([VT_XPM_DIRECT],
-[if test "$vt_xpm_includes" = NO; then
- # Guess where to find xpm.h
-
-ac_save_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
- # First, try using that file with no special directory specified.
-AC_TRY_CPP([#include <X11/xpm.h>],
-[# We can compile using X headers with no special include directory.
-vt_xpm_includes=
-vt_xpm_include_X11=yes],
-[CPPFLAGS="$ac_save_CPPFLAGS"
-# Look for the header file in a standard set of common directories.
- for ac_dir in \
- /usr/X11/include \
- /usr/X11R6/include \
- /usr/X11R5/include \
- /usr/X11R4/include \
- \
- /usr/include/X11 \
- /usr/include/X11R6 \
- /usr/include/X11R5 \
- /usr/include/X11R4 \
- \
- /usr/local/X11/include \
- /usr/local/X11R6/include \
- /usr/local/X11R5/include \
- /usr/local/X11R4/include \
- \
- /usr/local/include/X11 \
- /usr/local/include/X11R6 \
- /usr/local/include/X11R5 \
- /usr/local/include/X11R4 \
- \
- /usr/X386/include \
- /usr/x386/include \
- /usr/XFree86/include/X11 \
- \
- /usr/include \
- /usr/local/include \
- /usr/unsupported/include \
- /usr/athena/include \
- /usr/local/x11r5/include \
- /usr/lpp/Xamples/include \
- \
- /usr/openwin/include \
- /usr/openwin/share/include \
- ; \
- do
- if test -r "$ac_dir/X11/xpm.h"; then
- vt_xpm_includes="$ac_dir"
- vt_xpm_include_X11=yes
- break
- else
- if test -r "$ac_dir/xpm.h"; then
- vt_xpm_includes=$ac_dir
- break
- fi
- fi
- done])
-fi
-
-if test "$vt_xpm_libraries" = NO; then
- # Check for the libraries.
-
- # See if we find them without any special options.
- # Don't add to $LIBS permanently.
- ac_save_LIBS="$LIBS"
- LIBS="$LIBS $X_LIBS -lXpm -lX11"
-AC_TRY_LINK(, [XpmReadFileToPixmap()],
-[LIBS="$ac_save_LIBS"
-# We can link libXpm with no special library path.
-vt_xpm_libraries=],
-[LIBS="$ac_save_LIBS"
-# First see if replacing the include by lib works.
-for ac_dir in \
- `echo "$vt_xpm_includes" | sed 's,include/X11,lib,;s,include,lib,'` \
- /usr/X11/lib \
- /usr/X11R6/lib \
- /usr/X11R5/lib \
- /usr/X11R4/lib \
- \
- /usr/lib/X11 \
- /usr/lib/X11R6 \
- /usr/lib/X11R5 \
- /usr/lib/X11R4 \
- \
- /usr/local/X11/lib \
- /usr/local/X11R6/lib \
- /usr/local/X11R5/lib \
- /usr/local/X11R4/lib \
- \
- /usr/local/lib/X11 \
- /usr/local/lib/X11R6 \
- /usr/local/lib/X11R5 \
- /usr/local/lib/X11R4 \
- \
- /usr/X386/lib \
- /usr/x386/lib \
- /usr/XFree86/lib/X11 \
- \
- /usr/lib \
- /usr/local/lib \
- /usr/unsupported/lib \
- /usr/athena/lib \
- /usr/local/x11r5/lib \
- /usr/lpp/Xamples/lib \
- \
- /usr/openwin/lib \
- /usr/openwin/share/lib \
- ; \
-do
-dnl XXX Shouldn't this really use AC_TRY_LINK to be portable & robust??
- for ac_extension in a so sl; do
- if test -r $ac_dir/libXpm.$ac_extension; then
- vt_xpm_libraries=$ac_dir
- break 2
- fi
- done
-done])
-fi
-])
-
m4_include([ptytty.m4])
support_scroll_xterm=yes
support_scroll_plain=yes
support_xim=yes
-support_xpm=yes
support_afterimage=yes
support_afterstep=yes
support_xft=yes
support_utmp=no
support_wtmp=no
support_xim=no
- support_xpm=no
support_afterimage=no
support_afterstep=no
support_xft=no
support_utmp=yes
support_wtmp=yes
support_xim=yes
- support_xpm=yes
support_afterimage=yes
support_afterstep=yes
support_xft=yes
support_styles=$enableval
fi])
-AC_ARG_ENABLE(xpm-background,
- [ --enable-xpm-background enable background pixmaps],
- [if test x$enableval = xyes -o x$enableval = xno; then
- support_xpm=$enableval
- fi])
-
AC_ARG_ENABLE(afterimage,
[ --enable-afterimage enable integration with libAfterImage for background images],
[if test x$enableval = xyes -o x$enableval = xno; then
AC_PATH_XTRA
-dnl# the only reasonable way to find libXpm is do-it-yourself
-dnl# only check if we want xpm-background
-
AFTERIMAGE_CFLAGS=
AFTERIMAGE_LIBS=
AFTERIMAGE_VERSION=
fi
fi
-if test x$support_afterimage != xyes -a x$support_xpm = xyes ; then
- VT_FIND_LIBXPM
- if test x$no_xpm = xyes; then
- support_xpm=needsmanualspecification
- fi
-fi
-
dnl# --------------------------------------------------------------------------
dnl# CHECKING FOR HEADER FILES
dnl# --------------------------------------------------------------------------
if test x$support_mouseslipwheel = xyes; then
AC_DEFINE(MOUSE_SLIP_WHEELING, 1, Define to have CTRL cause wheel events to accelerate scrolling. Release CTRL to halt scrolling)
fi
-if test x$support_xpm = xyes -o x$support_afterimage = xyes ; then
- AC_DEFINE(XPM_BACKGROUND, 1, Define if you want to have sexy-looking background pixmaps. Needs libXpm or libAfterImage)
-fi
-
if test x$support_afterimage = xyes; then
AC_DEFINE(HAVE_AFTERIMAGE, 1, Define if you want to use libAfterImage for image processing)
+ AC_DEFINE(XPM_BACKGROUND, 1, Define if you want to have sexy-looking background pixmaps. Needs libAfterImage)
fi
dnl if test x$support_afterstep = xyes; then
Compiler flags: $CXXFLAGS
Linker: $LINKER"
-if test x$support_xpm = xyes; then
- echo " Xpm library: $XPM_LIBS"
-fi
-
if test x$support_afterimage = xyes; then
echo " AfterImage support: yes"
fi
echo " embedded perl: $support_perl"
echo " libafterimage: $support_afterimage"
echo
-if test x$support_xpm = xneedsmanualspecification; then
- echo ".----------------------------------------------------------------."
- echo ". WARNING: --enable-xpm-background was specified however the ."
- echo ". XPM includes files and libraries could not be found. ."
- echo ". XPM backgrounds are now being DISABLED! If you want ."
- echo ". to use them you should rerun configure with the ."
- echo ". appropriate --with-xpm-includes=/path/to/xpm/includes ."
- echo ". and --with-xpm-library=/path/to/xpm/library lines. ."
- echo ".----------------------------------------------------------------."
-fi
if test x$support_xim = xyes -a x$rxvt_cv_func_xlocale = xno; then
echo ".----------------------------------------------------------------."
echo ". WARNING: --enable-xim was specified however the locale support ."
F<lastlogin>) at start of rxvt execution. This option requires
--enable-utmp to also be specified.
-=item --enable-xpm-background (default: on)
-
-Add support for XPM background pixmaps.
-
=item --enable-afterimage (default: on)
Add support for libAfterImage to be used for transparency and background
Use the X Window System (pretty much default, eh?).
-=item --with-xpm-includes=DIR
-
-Look for the XPM includes in DIR.
-
-=item --with-xpm-library=DIR
-
-Look for the XPM library in DIR.
-
-=item --with-xpm
-
-Not needed - define via --enable-xpm-background.
-
=back
=head1 AUTHORS
INSTALL_PROGRAM = @INSTALL@ -m 755
INSTALL_DATA = @INSTALL@ -m 644
CXXFLAGS = @CXXFLAGS@
-CPPFLAGS = @CPPFLAGS@ @XPM_CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
DEFS = @DEFS@
LIBS = @LIBS@
-XINC = @X_CFLAGS@ @XPM_CFLAGS@ @AFTERIMAGE_CFLAGS@
-XLIB = @X_LIBS@ @XPM_LIBS@ @AFTERIMAGE_LIBS@ -lX11 @X_EXTRA_LIBS@
+XINC = @X_CFLAGS@ @AFTERIMAGE_CFLAGS@
+XLIB = @X_LIBS@ @AFTERIMAGE_LIBS@ -lX11 @X_EXTRA_LIBS@
COMPILE = $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(DEBUG) $(XINC) -I.. -I$(srcdir) -I.
LINK = @LINKER@ $(LDFLAGS)
#ifdef XPM_BACKGROUND
-#ifndef HAVE_AFTERIMAGE
-/*
- * search for FILE in the current working directory, and within the
- * colon-delimited PATHLIST, adding the file extension EXT if required.
- *
- * FILE is either semi-colon or zero terminated
- */
-static char *
-rxvt_File_search_path (const char *pathlist, const char *file, const char *ext)
-{
- int maxpath, len;
- const char *p, *path;
- char name[256];
-
- if (!access (file, R_OK)) /* found (plain name) in current directory */
- return strdup (file);
-
- /* semi-colon delimited */
- if ((p = strchr (file, ';')))
- len = (p - file);
- else
- len = strlen (file);
-
- /* leave room for an extra '/' and trailing '\0' */
- maxpath = sizeof (name) - (len + (ext ? strlen (ext) : 0) + 2);
- if (maxpath <= 0)
- return NULL;
-
- /* check if we can find it now */
- strncpy (name, file, len);
- name[len] = '\0';
-
- if (!access (name, R_OK))
- return strdup (name);
- if (ext)
- {
- strcat (name, ext);
- if (!access (name, R_OK))
- return strdup (name);
- }
- for (path = pathlist; path != NULL && *path != '\0'; path = p)
- {
- int n;
-
- /* colon delimited */
- if ((p = strchr (path, ':')) == NULL)
- p = strchr (path, '\0');
-
- n = (p - path);
- if (*p != '\0')
- p++;
-
- if (n > 0 && n <= maxpath)
- {
- strncpy (name, path, n);
- if (name[n - 1] != '/')
- name[n++] = '/';
- name[n] = '\0';
- strncat (name, file, len);
-
- if (!access (name, R_OK))
- return strdup (name);
- if (ext)
- {
- strcat (name, ext);
- if (!access (name, R_OK))
- return strdup (name);
- }
- }
- }
- return NULL;
-}
-
-/*
- * Calculate tiling sizes and increments
- * At start, p == 0, incr == xpmwidthheight
- */
-static void
-rxvt_pixmap_incr (unsigned int *wh, unsigned int *xy, float *incr, float *p, unsigned int widthheight, unsigned int xpmwidthheight)
-{
- unsigned int cwh, cxy;
- float cincr, cp;
-
- cp = 0;
- cincr = (float)xpmwidthheight;
- cxy = *xy;
- cwh = *wh;
- if (cwh == 1)
- { /* display one image, no horizontal/vertical scaling */
- cincr = (float)widthheight;
- if (xpmwidthheight <= widthheight)
- {
- cwh = xpmwidthheight;
- cxy = (cxy * (widthheight - cwh)) / 100; /* beware! order */
- cwh += cxy;
- }
- else
- {
- cxy = 0;
- cwh = widthheight;
- }
- }
- else if (cwh < 10)
- { /* fit WH images across/down screen */
- cincr *= cwh;
- cxy = 0;
- cwh = widthheight;
- }
- else
- {
- cincr *= 100.0 / cwh;
- if (cwh < 100)
- { /* contract */
- float pos;
-
- cwh = (cwh * widthheight) / 100;
- pos = (float)cxy / 100 * widthheight - (cwh / 2);
-
- cxy = (widthheight - cwh);
- if (pos <= 0)
- cxy = 0;
- else if (pos < cxy)
- cxy = (int) pos;
- cwh += cxy;
- }
- else
- { /* expand */
- if (cxy > 0)
- { /* position */
- float pos;
-
- pos = (float)cxy / 100 * xpmwidthheight - (cincr / 2);
- cp = xpmwidthheight - cincr;
- if (pos <= 0)
- cp = 0;
- else if (pos < cp)
- cp = pos;
- }
- cxy = 0;
- cwh = widthheight;
- }
- }
- cincr /= widthheight;
- *wh = cwh;
- *xy = cxy;
- *incr = cincr;
- *p = cp;
-}
-#endif
-
/*
* These GEOM strings indicate absolute size/position:
* @ `WxH+X+Y'
XCopyArea (dpy, bgPixmap.pixmap, pixmap, gc, 0, 0, x, y, xpmw - x, xpmh - y);
}
else
-#ifdef HAVE_AFTERIMAGE
#ifdef ENABLE_TRANSPARENCY
if (!option(Opt_transparent) || !am_transparent)
/* will do that in check_our_parents otherwise */
destroy_asimage (&scaled_im);
}
}
-#else /* HAVE_AFTERIMAGE */
- {
- float incr, p;
- Pixmap tmp;
-
- pixmap = XCreatePixmap (dpy, vt, width, height, depth);
- /*
- * horizontal scaling
- */
- rxvt_pixmap_incr (&w, &x, &incr, &p, width, xpmw);
-
- tmp = XCreatePixmap (dpy, vt, width, xpmh, depth);
- XFillRectangle (dpy, tmp, gc, 0, 0, width, xpmh);
-
- for ( /*nil */ ; x < w; x++, p += incr)
- {
- if (p >= xpmw)
- p = 0;
-
- /* copy one column from the original pixmap to the tmp pixmap */
- XCopyArea (dpy, bgPixmap.pixmap, tmp, gc, (int)p, 0, 1, xpmh, (int)x, 0);
- }
-
- /*
- * vertical scaling
- */
- rxvt_pixmap_incr (&h, &y, &incr, &p, height, xpmh);
-
- if (y > 0)
- XFillRectangle (dpy, pixmap, gc, 0, 0, width, y);
-
- if (h < height)
- XFillRectangle (dpy, pixmap, gc, 0, (int)h, width, height - h + 1);
-
- for ( /*nil */ ; y < h; y++, p += incr)
- {
- if (p >= xpmh)
- p = 0;
-
- /* copy one row from the tmp pixmap to the main pixmap */
- XCopyArea (dpy, tmp, pixmap, gc, 0, (int)p, width, 1, 0, (int)y);
- }
-
- XFreePixmap (dpy, tmp);
- }
-#endif /* HAVE_AFTERIMAGE */
}
XSetWindowBackgroundPixmap (dpy, vt, pixmap);
*/
/* XGetWindowAttributes (dpy, vt, &attr); */
-#ifdef HAVE_AFTERIMAGE
if (asimman == NULL)
asimman = create_generic_imageman(rs[Rs_path]);
if ((f = strchr (file, ';')) == NULL)
xpmAttr.width = original_asim->width ;
xpmAttr.height = original_asim->height ;
}
-#else /* HAVE_AFTERIMAGE */
- xpmAttr.closeness = 30000;
- xpmAttr.colormap = cmap;
- xpmAttr.visual = visual;
- xpmAttr.depth = depth;
- xpmAttr.valuemask = (XpmCloseness | XpmColormap | XpmVisual
- | XpmDepth | XpmSize | XpmReturnPixels);
-
- /* search environment variables here too */
- f = rxvt_File_search_path (rs[Rs_path], file, ".xpm");
- if (f == NULL
- || XpmReadFileToPixmap (dpy, display->root, f,
- &bgPixmap.pixmap, NULL,
- &xpmAttr))
- {
- char *p;
-
- /* semi-colon delimited */
- if ((p = strchr (file, ';')) == NULL)
- p = strchr (file, '\0');
-
- rxvt_warn ("couldn't load XPM file \"%.*s\", ignoring.\n", (p - file), file);
- }
- free (f);
-#endif /* HAVE_AFTERIMAGE */
}
resize_pixmap ();