diff -urN mgp-snap-20000228-vanilla/configure.in mgp-snap-20000228/configure.in
--- mgp-snap-20000228-vanilla/configure.in	Tue Feb 22 16:28:57 2000
+++ mgp-snap-20000228/configure.in	Sun Mar  5 17:37:45 2000
@@ -54,6 +54,25 @@
 	[mgp_locale="no"])
 AC_MSG_RESULT($mgp_locale)
 
+AC_HEADER_STDC
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(fcntl.h strings.h sys/file.h unistd.h sys/time.h sys/select.h stdarg.h varargs.h termios.h locale.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+AC_CHECK_TYPE(u_int, unsigned int)
+AC_CHECK_TYPE(u_char, unsigned char)
+
+dnl Checks for library functions.
+AC_FUNC_MEMCMP
+AC_TYPE_SIGNAL
+AC_CHECK_FUNCS(poll strstr _setbufend)
+AC_REPLACE_FUNCS(usleep strsep strdup mkstemp snprintf memcmp)
+
 dnl Checks for libraries.
 LIBS="-lm $LIBS"
 
@@ -271,30 +290,49 @@
 			break
 		fi
 	done
+	if test -f /usr/include/gif_lib.h; then
+		gif_h_ok=yes
+	fi
 	if test "x$gif_h_ok" != "xyes"; then
 		echo 'FATAL: can not find gif_lib.h.  pass proper CPPFLAGS to configure.'
 		exit 1
 	fi
 fi
 
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h strings.h sys/file.h unistd.h sys/time.h sys/select.h stdarg.h varargs.h termios.h locale.h)
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_C_INLINE
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_CHECK_TYPE(u_int, unsigned int)
-AC_CHECK_TYPE(u_char, unsigned char)
-
-dnl Checks for library functions.
-AC_FUNC_MEMCMP
-AC_TYPE_SIGNAL
-AC_CHECK_FUNCS(poll strstr _setbufend)
-AC_REPLACE_FUNCS(usleep strsep strdup mkstemp snprintf memcmp)
+USE_IMLIB=0
+AC_SUBST(USE_IMLIB)
+AC_MSG_CHECKING(if --enable-imlib option specified)
+AC_ARG_ENABLE(imlib,
+	[  --enable-imlib          use imlib exclusively to load images.],
+	[mgp_imlib="yes"],
+	[mgp_imlib="no"])
+AC_MSG_RESULT($mgp_imlib)
+if test $mgp_imlib = "yes"; then
+	AC_CHECK_LIB(Imlib, Imlib_init,
+		[imlib_ok=yes
+		LIBS="$LIBS -lImlib"
+		AC_DEFINE(USE_IMLIB)
+		USE_IMLIB=1],
+		[], [-L$x_libraries -lX11 -lXext])
+	if test "x$imlib_ok" != "xyes"; then
+		echo 'FATAL: You need libImlib to use Imlib loading.  pass proper LIBS to configure.'
+		exit 1
+	fi
+	for i in /usr/pkg /usr/local; do
+		if test -f $i/include/Imlib.h; then
+			imlib_h_ok=yes
+			OPTFLAGS="$OPTFLAGS -I$i/include"
+			break
+		fi
+	done
+	if test -f /usr/include/Imlib.h; then
+		imlib_h_ok=yes
+	fi
+	if test "x$imlib_h_ok" != "xyes"; then
+		echo 'FATAL: can not find Imlib.h.  pass proper CPPFLAGS to configure.'
+		exit 1
+	fi
+fi
 
 dnl keyword substitution.
 mgp_keywords=`$mgp_cv_path_perl $srcdir/keywords.pl $srcdir/globals.c`
diff -urN mgp-snap-20000228-vanilla/image/Imakefile.in mgp-snap-20000228/image/Imakefile.in
--- mgp-snap-20000228-vanilla/image/Imakefile.in	Mon Feb 14 19:45:36 2000
+++ mgp-snap-20000228/image/Imakefile.in	Sun Mar  5 17:47:50 2000
@@ -1,5 +1,14 @@
 TARGET0=	mgpimage
 TARGET=	lib$(TARGET0).a
+#if @USE_IMLIB@
+SRCS=	imagetypes.c send.c zio.c zoom.c new.c compress.c reduce.c\
+	value.c misc.c rotate.c rle.c rlelib.c smooth.c halftone.c clip.c\
+	dither.c path.c bright.c window.c imlib_loader.c
+
+OBJS=	imagetypes.o send.o zio.o zoom.o new.o compress.o reduce.o\
+	value.o misc.o rotate.o rle.o rlelib.o smooth.o halftone.o clip.o\
+	dither.o path.o bright.o window.o imlib_loader.o
+#else
 SRCS=	imagetypes.c gif.c send.c zio.c zoom.c new.c compress.c reduce.c\
 	value.c misc.c rotate.c rle.c rlelib.c smooth.c halftone.c clip.c\
 	dither.c xbitmap.c xpixmap.c pbm.c pcx.c xwd.c mac.c jpeg.c g3.c\
@@ -11,6 +20,7 @@
 	dither.o xbitmap.o xpixmap.o pbm.o pcx.o xwd.o mac.o jpeg.o g3.o\
 	path.o sunraster.o mcidas.o fbm.o faces.o cmuwmraster.o bright.o\
 	img.o mc_tables.o window.o
+#endif
 
 DEFS=	@DEFS@
 OPTFLAGS=@OPTFLAGS@
@@ -21,6 +31,7 @@
 SpecialObjectRule(gif.o,gif.c,$(DEFS) $(OPTFLAGS))
 SpecialObjectRule(imagetypes.o,imagetypes.c,$(DEFS))
 #SpecialObjectRule(png.o,png.c,$(DEFS) $(OPTFLAGS))
+SpecialObjectRule(imlib_loader.o,imlib_loader.c,$(DEFS))
 
 #ifndef NullParameter
 #define  NullParameter 
diff -urN mgp-snap-20000228-vanilla/image/imagetypes.c mgp-snap-20000228/image/imagetypes.c
--- mgp-snap-20000228-vanilla/image/imagetypes.c	Fri Aug 27 21:02:56 1999
+++ mgp-snap-20000228/image/imagetypes.c	Sun Mar  5 04:15:40 2000
@@ -21,6 +21,9 @@
   Image *(*loader)();     /* load image if this kind of image */
   char  *name;            /* name of this image format */
 } ImageTypes[] = {
+#ifdef USE_IMLIB
+  { imIdent,        imLoad,        "Imlib" },
+#else
   { fbmIdent,       fbmLoad,       "FBM Image" },
   { sunRasterIdent, sunRasterLoad, "Sun Rasterfile" },
   { cmuwmIdent,     cmuwmLoad,     "CMU WM Raster" },
@@ -39,6 +42,7 @@
   { macIdent,       macLoad,       "MacPaint Image" },
   { xpixmapIdent,   xpixmapLoad,   "X Pixmap" },
   { xbitmapIdent,   xbitmapLoad,   "X Bitmap" },
+#endif
   { NULL,           NULL,          NULL }
 };
 /* SUPPRESS 560 */
diff -urN mgp-snap-20000228-vanilla/image/imagetypes.h mgp-snap-20000228/image/imagetypes.h
--- mgp-snap-20000228-vanilla/image/imagetypes.h	Fri Aug 27 21:02:58 1999
+++ mgp-snap-20000228/image/imagetypes.h	Sun Mar  5 04:15:40 2000
@@ -23,6 +23,7 @@
 Image *cmuwmLoad();
 Image *mcidasLoad();
 Image *jpegLoad();
+Image *imLoad();
 
 int facesIdent();
 int pbmIdent();
@@ -40,4 +41,5 @@
 int cmuwmIdent();
 int mcidasIdent();
 int jpegIdent();
+int imIdent();
 
diff -urN mgp-snap-20000228-vanilla/image/imlib_loader.c mgp-snap-20000228/image/imlib_loader.c
--- mgp-snap-20000228-vanilla/image/imlib_loader.c	Thu Jan  1 01:00:00 1970
+++ mgp-snap-20000228/image/imlib_loader.c	Sun Mar  5 04:15:40 2000
@@ -0,0 +1,51 @@
+
+#ifdef USE_IMLIB
+
+#include "image.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/shape.h>
+#include <Imlib.h>
+
+int imIdent(char *fullname, char *name)
+{
+	return 1;
+}
+
+Image *imLoad(char *fullname, char *name, unsigned int verbose)
+{
+	static Display *disp = NULL;
+	Image *image;
+	ImlibData *id;
+	ImlibImage *im;
+	ImlibColor shape;
+	unsigned int w,h, size;
+
+	if (disp == NULL) {
+		disp=XOpenDisplay(NULL);
+	}
+	id=Imlib_init(disp);
+	im=Imlib_load_image(id, fullname);
+	if (im == NULL) {
+		return NULL;
+	}
+	w = im->rgb_width;
+	h = im->rgb_height;
+	size = w * h * 3;
+
+	image = newTrueImage(w, h);
+	memcpy(image->data, im->rgb_data, size);
+	
+	Imlib_get_image_shape(id, im, &shape);
+	image->trans = \
+		((shape.r & 0xff) << 16) |
+		((shape.g & 0xff) <<  8) |
+		((shape.b & 0xff) <<  0);
+
+	image->title = dupString(name);
+	
+	return image;
+}
+
+#endif

