--- xpm-nox-4.2.0/cxpm/cxpm.c	2002-01-20 08:53:35.000000000 +0100
+++ xpm-nox-4.2.0/cxpm/cxpm.c	2010-09-11 10:03:45.000000000 +0200
@@ -36,6 +36,15 @@
 
 #include "../lib/XpmI.h"
 
+#ifdef XPM_NO_X
+#  include "../lib/simx.c"
+#  include "../lib/rgb.c"
+#  ifndef NEED_STRCASECMP
+#    define NEED_STRCASECMP
+#  endif
+FUNC(xpmstrcasecmp, int, (char *s1, char *s2));
+#endif
+
 #undef xpmGetC
 #define xpmGetC(data) sGetc(data, data->stream.file)
 #define Getc sGetc
@@ -74,6 +83,25 @@
     }
 }
 
+#ifdef NEED_STRCASECMP
+int
+xpmstrcasecmp(s1, s2)
+    register char *s1, *s2;
+{
+    register int c1, c2;
+
+    while (*s1 && *s2) {
+        c1 = tolower(*s1);
+        c2 = tolower(*s2);
+        if (c1 != c2)
+            return (c1 - c2);
+        s1++;
+        s2++;
+    }
+    return (int) (*s1 - *s2);
+}
+#endif
+
 /* include all the code we need (yeah, I know, quite ugly...) */
 #include "../lib/data.c"
 #include "../lib/parse.c"
--- xpm-nox-4.2.0/cxpm/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ xpm-nox-4.2.0/cxpm/Makefile	2010-09-11 10:13:44.000000000 +0200
@@ -0,0 +1,80 @@
+#
+#  Copyright (C) 1998 Arnaud LE HORS
+#
+#  Permission is hereby granted, free of charge, to any person obtaining a copy
+#  of this software and associated documentation files (the "Software"), to
+#  deal in the Software without restriction, including without limitation the
+#  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#  sell copies of the Software, and to permit persons to whom the Software is
+#  furnished to do so, subject to the following conditions:
+#
+#  The above copyright notice and this permission notice shall be included in
+#  all copies or substantial portions of the Software.
+#
+#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+#  Arnaud LE HORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+#  Except as contained in this notice, the name of Arnaud LE HORS shall not be
+#  used in advertising or otherwise to promote the sale, use or other dealings
+#  in this Software without prior written authorization from Arnaud LE HORS.
+#
+
+#
+# XPM Makefile - Arnaud LE HORS
+#
+
+VER=4.2.0
+MAJVER=4
+
+prefix?=/usr
+incpath=$(prefix)/include
+libpath=$(prefix)/lib
+binpath=$(prefix)/bin
+manpath=$(prefix)/share/man
+man1path=$(manpath)/man1
+
+DEFINES = -DXPM_NO_X -DFOR_MSW
+
+CC ?= gcc
+RM = rm -f
+# on sysV, define this as cp.
+INSTALL = install -c
+EXE=.exe
+
+CDEBUGFLAGS= #-O0 -g
+
+INCLUDES= -I..
+
+OBJS= cxpm.o
+
+CFLAGSEX = $(CDEBUGFLAGS) $(INCLUDES) $(DEFINES)
+
+all: cxpm-noX$(EXE)
+
+clean: 
+	$(RM) *.o cxpm-noX$(EXE)
+
+cxpm.o: cxpm.c
+	$(CC) $(CFLAGS) $(CFLAGSEX) -o $@ -c $<
+
+cxpm-noX$(EXE): cxpm.o
+	$(CC) $(CFLAGS) $(CFLAGSEX) $< -o $@ -lgdi32 -luser32
+
+install: install.prog install.man
+
+install.prog: cxpm-noX$(EXE)
+	-@if [ ! -d $(DESTDIR)$(binpath) ]; then mkdir -p $(DESTDIR)$(binpath); fi   
+	$(INSTALL) -m 0755 cxpm-noX$(EXE) $(DESTDIR)$(binpath)/cxpm-noX$(EXE)
+
+install.man:
+	-@if [ ! -d $(DESTDIR)$(man1path) ]; then mkdir -p $(DESTDIR)$(man1path); fi   
+	$(INSTALL) -m 0644 cxpm.man $(DESTDIR)$(man1path)/cxpm-noX.1
+
+# Other dependencies.
+cxpm.o: ../lib/XpmI.h ../lib/data.c ../lib/parse.c ../lib/RdFToI.c \
+  ../lib/hashtab.c ../lib/misc.c ../lib/Attrib.c ../lib/Image.c \
+  ../lib/simx.c ../lib/rgb.c
--- xpm-nox-4.2.0/lib/create.c	2002-01-20 08:53:45.000000000 +0100
+++ xpm-nox-4.2.0/lib/create.c	2010-09-11 10:03:45.000000000 +0200
@@ -35,7 +35,7 @@
 /* $XFree86: xc/extras/Xpm/lib/create.c,v 1.3 2002/01/07 19:40:49 dawes Exp $ */
 
 /*
- * The code related to FOR_MSW has been added by
+ * The code related to XPM_NO_X has been added by
  * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94
  */
 
@@ -54,7 +54,7 @@
 LFUNC(FreeColors, int, (Display *display, Colormap colormap,
 			Pixel *pixels, int n, void *closure));
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 LFUNC(SetCloseColor, int, (Display *display, Colormap colormap,
 			   Visual *visual, XColor *col,
 			   Pixel *image_pixel, Pixel *mask_pixel,
@@ -85,14 +85,14 @@
                           Pixel *alloc_pixels, unsigned int *nalloc_pixels,
                           Pixel *used_pixels, unsigned int *nused_pixels));
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 LFUNC(ParseAndPutPixels, int, (xpmData *data, unsigned int width,
 			       unsigned int height, unsigned int ncolors,
 			       unsigned int cpp, XpmColor *colorTable,
 			       xpmHashTable *hashtable,
 			       XImage *image, Pixel *image_pixels,
 			       XImage *mask, Pixel *mask_pixels));
-#else  /* FOR_MSW */
+#else  /* XPM_NO_X */
 LFUNC(ParseAndPutPixels, int, (Display *dc, xpmData *data, unsigned int width,
 			       unsigned int height, unsigned int ncolors,
 			       unsigned int cpp, XpmColor *colorTable,
@@ -101,7 +101,7 @@
 			       XImage *mask, Pixel *mask_pixels));
 #endif
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 # ifndef AMIGA
 /* XImage pixel routines */
 LFUNC(PutImagePixels, void, (XImage *image, unsigned int width,
@@ -140,12 +140,12 @@
 			      unsigned int height, unsigned int *pixelindex,
 			      Pixel *pixels));
 # endif/* AMIGA */
-#else  /* FOR_MSW */
-/* FOR_MSW pixel routine */
+#else  /* XPM_NO_X */
+/* XPM_NO_X pixel routine */
 LFUNC(MSWPutImagePixels, void, (Display *dc, XImage *image,
 				unsigned int width, unsigned int height,
 				unsigned int *pixelindex, Pixel *pixels));
-#endif /* FOR_MSW */
+#endif /* XPM_NO_X */
 
 #ifdef NEED_STRCASECMP
 FUNC(xpmstrcasecmp, int, (char *s1, char *s2));
@@ -180,7 +180,7 @@
 xpmVisualType(visual)
     Visual *visual;
 {
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 # ifndef AMIGA
     switch (visual->class) {
     case StaticGray:
@@ -243,7 +243,7 @@
 }
 
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 /*
  * set a close color in case the exact one can't be set
  * return 0 if success, 1 otherwise.
@@ -425,7 +425,7 @@
       || attributes->blue_closeness != 0)))
 
 #else
-    /* FOR_MSW part */
+    /* XPM_NO_X part */
     /* nothing to do here, the window system does it */
 #endif
 
@@ -465,7 +465,7 @@
 	    return (1);
 
 	if (status == 0) {
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 	    if (USE_CLOSECOLOR)
 		return (SetCloseColor(display, colormap, visual, &xcolor,
 				      image_pixel, mask_pixel,
@@ -473,12 +473,12 @@
 				      attributes, cols, ncols,
 				      allocColor, closure));
 	    else
-#endif /* ndef FOR_MSW */
+#endif /* ndef XPM_NO_X */
 		return (1);
 	} else
 	    alloc_pixels[(*nalloc_pixels)++] = xcolor.pixel;
 	*image_pixel = xcolor.pixel;
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 	*mask_pixel = 1;
 #else
 	*mask_pixel = RGB(0,0,0);
@@ -486,7 +486,7 @@
 	used_pixels[(*nused_pixels)++] = xcolor.pixel;
     } else {
 	*image_pixel = 0;
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 	*mask_pixel = 0;
 #else
   	*mask_pixel = RGB(255,255,255);
@@ -567,7 +567,7 @@
     else
 	closure = NULL;
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
     if (USE_CLOSECOLOR) {
 	/* originally from SetCloseColor */
 #if 0
@@ -598,7 +598,7 @@
 	}
 #endif
     }
-#endif /* ndef FOR_MSW */
+#endif /* ndef XPM_NO_X */
 
     switch (key) {
     case XPM_MONO:
@@ -858,7 +858,7 @@
 	if (ErrorStatus != XpmSuccess)
 	    RETURN(ErrorStatus);
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 # ifndef AMIGA
 
 	/*
@@ -885,7 +885,7 @@
 	APutImagePixels(ximage, image->width, image->height,
 			image->data, image_pixels);
 # endif
-#else  /* FOR_MSW */
+#else  /* XPM_NO_X */
 	MSWPutImagePixels(display, ximage, image->width, image->height,
 			  image->data, image_pixels);
 #endif
@@ -897,7 +897,7 @@
 	if (ErrorStatus != XpmSuccess)
 	    RETURN(ErrorStatus);
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 # ifndef AMIGA
 	PutImagePixels1(shapeimage, image->width, image->height,
 			image->data, mask_pixels);
@@ -905,7 +905,7 @@
 	APutImagePixels(shapeimage, image->width, image->height,
 			image->data, mask_pixels);
 # endif
-#else  /* FOR_MSW */
+#else  /* XPM_NO_X */
 	MSWPutImagePixels(display, shapeimage, image->width, image->height,
 			  image->data, mask_pixels);
 #endif
@@ -990,7 +990,7 @@
     if (!*image_return)
 	return (XpmNoMemory);
 
-#if !defined(FOR_MSW) && !defined(AMIGA)
+#if !defined(XPM_NO_X) && !defined(AMIGA)
     /* now that bytes_per_line must have been set properly alloc data */
     (*image_return)->data =
 	(char *) XpmMalloc((*image_return)->bytes_per_line * height);
@@ -1001,12 +1001,12 @@
 	return (XpmNoMemory);
     }
 #else
-    /* under FOR_MSW and AMIGA XCreateImage has done it all */
+    /* under XPM_NO_X and AMIGA XCreateImage has done it all */
 #endif
     return (XpmSuccess);
 }
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 # ifndef AMIGA
 /*
  * The functions below are written from X11R5 MIT's code (XImUtil.c)
@@ -1716,7 +1716,7 @@
 }
 
 # endif/* AMIGA */
-#else  /* FOR_MSW part follows */
+#else  /* XPM_NO_X part follows */
 static void
 MSWPutImagePixels(dc, image, width, height, pixelindex, pixels)
     Display *dc;
@@ -1739,11 +1739,11 @@
     SelectObject(*dc, obm);
 }
 
-#endif /* FOR_MSW */
+#endif /* XPM_NO_X */
 
 
 
-#if !defined(FOR_MSW) && !defined(AMIGA)
+#if !defined(XPM_NO_X) && !defined(AMIGA)
 
 static int
 PutPixel1(ximage, x, y, pixel)
@@ -1929,7 +1929,7 @@
     return 1;
 }
 
-#endif /* not FOR_MSW && not AMIGA */
+#endif /* not XPM_NO_X && not AMIGA */
 
 /*
  * This function parses an Xpm file or data and directly create an XImage
@@ -2099,7 +2099,7 @@
 	if (ErrorStatus != XpmSuccess)
 	    RETURN(ErrorStatus);
 
-#if !defined(FOR_MSW) && !defined(AMIGA)
+#if !defined(XPM_NO_X) && !defined(AMIGA)
 
 	/*
 	 * set the XImage pointer function, to be used with XPutPixel,
@@ -2133,7 +2133,7 @@
 	    ximage->f.put_pixel = PutPixel1;
 	else
 	    ximage->f.put_pixel = PutPixel;
-#endif /* not FOR_MSW && not AMIGA */
+#endif /* not XPM_NO_X && not AMIGA */
     }
 
     /* create the shape mask image */
@@ -2143,7 +2143,7 @@
 	if (ErrorStatus != XpmSuccess)
 	    RETURN(ErrorStatus);
 
-#if !defined(FOR_MSW) && !defined(AMIGA)
+#if !defined(XPM_NO_X) && !defined(AMIGA)
 	if (shapeimage->bitmap_bit_order == MSBFirst)
 	    shapeimage->f.put_pixel = PutPixel1MSB;
 	else
@@ -2155,7 +2155,7 @@
      * read pixels and put them in the XImage
      */
     ErrorStatus = ParseAndPutPixels(
-#ifdef FOR_MSW
+#ifdef XPM_NO_X
 				    display,
 #endif
 				    data, width, height, ncolors, cpp,
@@ -2275,12 +2275,12 @@
 
 static int
 ParseAndPutPixels(
-#ifdef FOR_MSW
+#ifdef XPM_NO_X
 		  dc,
 #endif
 		  data, width, height, ncolors, cpp, colorTable, hashtable,
 		  image, image_pixels, shapeimage, shape_pixels)
-#ifdef FOR_MSW
+#ifdef XPM_NO_X
     Display *dc;
 #endif
     xpmData *data;
@@ -2303,7 +2303,7 @@
 					 * colors */
 	{
 	    unsigned short colidx[256];
-#ifdef FOR_MSW
+#ifdef XPM_NO_X
 	    HDC shapedc;
 	    HBITMAP obm, sobm;
 
@@ -2327,7 +2327,7 @@
 		    int c = xpmGetC(data);
 
 		    if (c > 0 && c < 256 && colidx[c] != 0) {
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 			XPutPixel(image, x, y, image_pixels[colidx[c] - 1]);
 			if (shapeimage)
 			    XPutPixel(shapeimage, x, y,
@@ -2342,7 +2342,7 @@
 			return (XpmFileInvalid);
 		}
 	    }
-#ifdef FOR_MSW
+#ifdef XPM_NO_X
 	    if ( shapedc ) {
 	        SelectObject(shapedc, sobm);
 		DeleteDC(shapedc);
@@ -2386,7 +2386,7 @@
 			int cc2 = xpmGetC(data);
 			if (cc2 > 0 && cc2 < 256 &&
 			    cidx[cc1] && cidx[cc1][cc2] != 0) {
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 			    XPutPixel(image, x, y,
 				      image_pixels[cidx[cc1][cc2] - 1]);
 			    if (shapeimage)
@@ -2433,7 +2433,7 @@
 			slot = xpmHashSlot(hashtable, buf);
 			if (!*slot)	/* no color matches */
 			    return (XpmFileInvalid);
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 			XPutPixel(image, x, y,
 				  image_pixels[HashColorIndex(slot)]);
 			if (shapeimage)
@@ -2462,7 +2462,7 @@
 				break;
 			if (a == ncolors)	/* no color matches */
 			    return (XpmFileInvalid);
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 			XPutPixel(image, x, y, image_pixels[a]);
 			if (shapeimage)
 			    XPutPixel(shapeimage, x, y, shape_pixels[a]);
--- xpm-nox-4.2.0/lib/libXpm-noX.def	1970-01-01 01:00:00.000000000 +0100
+++ xpm-nox-4.2.0/lib/libXpm-noX.def	2010-09-11 10:03:45.000000000 +0200
@@ -0,0 +1,69 @@
+EXPORTS
+XpmAttributesSize @1
+XpmCreateBufferFromImage @2
+XDefaultVisual @3
+XImageFree @4
+XpmCreateBufferFromXpmImage @5
+XpmCreateDataFromImage @6
+XpmCreateDataFromXpmImage @7
+XpmCreateImageFromBuffer @8
+XpmCreateImageFromData @9
+XpmCreateImageFromXpmImage @10
+XpmCreateXpmImageFromBuffer @11
+XpmCreateXpmImageFromData @12
+XpmFree @13
+XpmFreeExtensions @14
+XpmGetErrorString @15
+XpmCreateXpmImageFromImage @16
+XpmLibraryVersion @17
+XpmReadFileToImage @18
+XpmFreeAttributes @19
+XpmReadFileToXpmImage @20
+XpmFreeXpmImage @21
+XpmFreeXpmInfo @22
+XpmWriteFileFromBuffer @23
+boundCheckingRealloc @24
+XpmReadFileToBuffer @25
+XpmReadFileToData @26
+xpmFreeColorTable @27
+xpmFreeRgbNames @28
+xpmGetCmt @29
+xpmGetRGBfromName @30
+XpmWriteFileFromData @31
+XpmWriteFileFromImage @32
+xpmGetRgbName @33
+XpmWriteFileFromXpmImage @34
+xpmGetString @35
+xpmHashIntern @36
+xpmHashSlot @37
+xpmHashTableFree @38
+xpmHashTableInit @39
+xpmInitAttributes @40
+xpmInitXpmImage @41
+xpmInitXpmInfo @42
+xpmNextString @43
+xpmNextUI @44
+xpmNextWord @45
+xpmParseColors @46
+xpmParseData @47
+xpmParseDataAndCreate @48
+xpmParseExtensions @49
+xpmParseHeader @50
+xpmParseValues @51
+xpmReadRgbNames @52
+xpmSetAttributes @53
+xpmSetInfo @54
+xpmSetInfoMask @55
+xpmatoui @56
+xpmstrcasecmp @57
+boundCheckingMalloc @100
+boundCheckingCalloc @101
+XDefaultScreen @104
+XDefaultDepth @105
+XDefaultColormap @106
+XParseColor @107
+XAllocColor @108
+XQueryColors @109
+XFreeColors @110
+XCreateImage @111
+XDestroyImage @113
--- xpm-nox-4.2.0/lib/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ xpm-nox-4.2.0/lib/Makefile	2010-09-11 10:14:38.000000000 +0200
@@ -0,0 +1,166 @@
+#
+#  Copyright (C) 1989-95 GROUPE BULL
+#
+#  Permission is hereby granted, free of charge, to any person obtaining a copy
+#  of this software and associated documentation files (the "Software"), to
+#  deal in the Software without restriction, including without limitation the
+#  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#  sell copies of the Software, and to permit persons to whom the Software is
+#  furnished to do so, subject to the following conditions:
+#
+#  The above copyright notice and this permission notice shall be included in
+#  all copies or substantial portions of the Software.
+#
+#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+#  GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+#  AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+#  Except as contained in this notice, the name of GROUPE BULL shall not be
+#  used in advertising or otherwise to promote the sale, use or other dealings
+#  in this Software without prior written authorization from GROUPE BULL.
+#
+
+#
+# XPM Makefile - Arnaud LE HORS
+#
+
+VER=4.2.0
+MAJVER=4
+
+prefix?=/usr
+incpath=$(prefix)/include
+libpath=$(prefix)/lib
+binpath=$(prefix)/bin
+manpath=$(prefix)/share/man
+man1path=$(manpath)/man1
+
+# if your system doesn't provide strcasecmp add -DNEED_STRCASECMP
+# if your system doesn't provide strdup add -DNEED_STRDUP
+# if your system doesn't provide pipe add -DNO_ZPIPE
+# if on your system sprintf doesn't return the number of bytes transmitted
+# add -DVOID_SPRINTF
+DEFINES = -DXPM_NO_X -DFOR_MSW
+
+CC ?= gcc
+AR ?= ar
+RANLIB ?= ranlib
+RM = rm -f
+# on sysV, define this as cp.
+INSTALL = install -c
+MKDIRHIER = mkdir -p
+LN = cp
+
+CDEBUGFLAGS= #-O0 -g
+
+INCLUDES=
+
+OBJS = data.o create.o misc.o rgb.o scan.o parse.o hashtab.o \
+      WrFFrI.o RdFToI.o CrIFrDat.o CrDatFrI.o \
+      CrIFrBuf.o CrBufFrI.o \
+      RdFToDat.o WrFFrDat.o \
+      Attrib.o Image.o Info.o RdFToBuf.o WrFFrBuf.o simx.o
+OBJSDLL= ${OBJS:.o=.pic.o}
+
+SHAREDLIB=libXpm-noX${MAJVER}.dll
+STATLIB=libXpm.a
+IMPLIB=libXpm.dll.a
+SHAREDDEF=libXpm-noX.def
+
+LIBS=$(SHAREDLIB) $(STATLIB)
+
+EXE=.exe
+LDSHARED=$(CC) -shared -Wl,--export-all
+LDEXTRA=-Wl,--out-implib=$(IMPLIB) # $(SHAREDDEF)
+
+CFLAGSEX = $(CDEBUGFLAGS) $(DEFINES) $(INCLUDES)
+
+.SUFFIXES:	.c .o .pic.o
+
+%.o : %.c
+	$(CC) -c $(CFLAGS) $(CFLAGSEX) -o $@ $<
+
+%.pic.o : %.c
+	$(CC) -c $(CFLAGS) $(CFLAGSEX) -o $@ $<
+
+all: ../X11/xpm.h $(LIBS) $(STATLIB) $(IMPLIB)
+
+clean: 
+	-@$(RM) *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
+		$(STATLIB_BASE) $(IMPLIB_BASE)
+	-@$(RM) ../X11/*
+	-@rmdir ../X11
+
+$(STATLIB): $(OBJS)
+	$(AR) rc $(STATLIB) $(OBJS)
+	$(RANLIB) $@
+
+$(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
+	$(LDSHARED) -o $(SHAREDLIB) $(LDEXTRA) $(OBJSDLL) -lgdi32 -luser32
+
+install: $(STATLIB) $(SHAREDLIB)
+	-@if [ ! -d $(DESTDIR)$(incpath) ]; then mkdir -p $(DESTDIR)$(incpath); fi   
+	-@if [ ! -d $(DESTDIR)$(incpath)/X11 ]; then mkdir -p $(DESTDIR)$(incpath)/X11; fi   
+	-@if [ ! -d $(DESTDIR)$(binpath) ]; then mkdir -p $(DESTDIR)$(binpath); fi   
+	-@if [ ! -d $(DESTDIR)$(libpath) ]; then mkdir -p $(DESTDIR)$(libpath); fi   
+	$(INSTALL) -m 0644 $(STATLIB) $(DESTDIR)$(libpath)
+	$(INSTALL) -m 0644 $(IMPLIB) $(DESTDIR)$(libpath)
+	$(INSTALL) -m 0644 xpm.h $(DESTDIR)$(incpath)/X11
+	$(INSTALL) -m 0644 simx.h $(DESTDIR)$(incpath)/X11
+	$(INSTALL) -m 0755 $(SHAREDLIB) $(DESTDIR)$(binpath)
+
+../X11/xpm.h: xpm.h simx.h
+	@if [ -d ../X11 ]; then set +x; \
+	else (set -x; $(MKDIRHIER) ../X11); fi
+	$(RM) ../X11/xpm.h; \
+	$(RM) ../X11/simx.h; \
+	cp ../lib/xpm.h ../X11; \
+	cp ../lib/simx.h ../X11
+
+# Other dependencies.
+CrBufFrI.o:  XpmI.h xpm.h
+CrDatFI.o:  XpmI.h xpm.h
+CrIFrBuf.o:  XpmI.h xpm.h
+CrIFrDat.o:  XpmI.h xpm.h
+RdFToDat.o:  XpmI.h xpm.h
+RdFToI.o:  XpmI.h xpm.h
+WrFFrDat.o:  XpmI.h xpm.h
+WrFFrI.o:  XpmI.h xpm.h
+create.o:  XpmI.h xpm.h
+data.o:  XpmI.h xpm.h
+hashtab.o:  XpmI.h xpm.h
+misc.o:  XpmI.h xpm.h
+parse.o:  XpmI.h xpm.h
+rgb.o:  XpmI.h xpm.h
+scan.o:  XpmI.h xpm.h
+Attrib.o:  XpmI.h xpm.h
+Image.o:  XpmI.h xpm.h
+Info.o:  XpmI.h xpm.h
+RdFToBuf.o:  XpmI.h xpm.h
+WrFFrBuf.o:  XpmI.h xpm.h
+simx.o:  XpmI.h xpm.h
+
+CrBufFrI.pic.o:  XpmI.h xpm.h
+CrDatFI.pic.o:  XpmI.h xpm.h
+CrIFrBuf.pic.o:  XpmI.h xpm.h
+CrIFrDat.pic.o:  XpmI.h xpm.h
+RdFToDat.pic.o:  XpmI.h xpm.h
+RdFToI.pic.o:  XpmI.h xpm.h
+WrFFrDat.pic.o:  XpmI.h xpm.h
+WrFFrI.pic.o:  XpmI.h xpm.h
+create.pic.o:  XpmI.h xpm.h
+data.pic.o:  XpmI.h xpm.h
+hashtab.pic.o:  XpmI.h xpm.h
+misc.pic.o:  XpmI.h xpm.h
+parse.pic.o:  XpmI.h xpm.h
+rgb.pic.o:  XpmI.h xpm.h
+scan.pic.o:  XpmI.h xpm.h
+Attrib.pic.o:  XpmI.h xpm.h
+Image.pic.o:  XpmI.h xpm.h
+Info.pic.o:  XpmI.h xpm.h
+RdFToBuf.pic.o:  XpmI.h xpm.h
+WrFFrBuf.pic.o:  XpmI.h xpm.h
+simx.pic.o:  XpmI.h xpm.h
+
--- xpm-nox-4.2.0/lib/misc.c	1999-01-11 14:23:12.000000000 +0100
+++ xpm-nox-4.2.0/lib/misc.c	2010-09-11 10:03:45.000000000 +0200
@@ -79,8 +79,7 @@
  * Function returning a character string related to an error code.
  */
 char *
-XpmGetErrorString(errcode)
-    int errcode;
+XpmGetErrorString(int errcode)
 {
     switch (errcode) {
     case XpmColorError:
--- xpm-nox-4.2.0/lib/parse.c	2002-01-20 08:53:46.000000000 +0100
+++ xpm-nox-4.2.0/lib/parse.c	2010-09-11 10:03:45.000000000 +0200
@@ -36,7 +36,7 @@
 /* $XFree86: xc/extras/Xpm/lib/parse.c,v 1.3 2001/10/28 03:32:10 tsi Exp $ */
 
 /*
- * The code related to FOR_MSW has been added by
+ * The code related to XPM_NO_X has been added by
  * HeDu (hedu@cul-ipn.uni-kiel.de) 4/94
  */
 
@@ -341,7 +341,7 @@
     unsigned int *iptr, *iptr2;
     unsigned int a, x, y;
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
     iptr2 = (unsigned int *) XpmMalloc(sizeof(unsigned int) * width * height);
 #else
 
--- xpm-nox-4.2.0/lib/RdFToBuf.c	1999-01-11 14:23:10.000000000 +0100
+++ xpm-nox-4.2.0/lib/RdFToBuf.c	2010-09-11 10:03:45.000000000 +0200
@@ -39,18 +39,20 @@
 
 #include "XpmI.h"
 #include <sys/stat.h>
-#if !defined(FOR_MSW) && !defined(WIN32)
+#if !defined(XPM_NO_X) && !defined(WIN32)
 #include <unistd.h>
 #endif
 #ifndef VAX11C
 #include <fcntl.h>
 #endif
-#if defined(FOR_MSW) || defined(WIN32)
+#if defined(XPM_NO_X) || defined(WIN32)
 #include <io.h>
+/*
 #define stat _stat
 #define fstat _fstat
 #define fdopen _fdopen
 #define O_RDONLY _O_RDONLY
+*/
 #endif
 
 int
--- xpm-nox-4.2.0/lib/rgb.c	1999-01-11 14:23:12.000000000 +0100
+++ xpm-nox-4.2.0/lib/rgb.c	2010-09-11 10:03:45.000000000 +0200
@@ -45,7 +45,7 @@
 #include "XpmI.h"
 #include <ctype.h>
 
-#ifndef FOR_MSW				/* normal part first, MSW part at
+#ifndef XPM_NO_X				/* normal part first, MSW part at
 					 * the end, (huge ifdef!) */
 /*
  * Read a rgb text file.  It stores the rgb values (0->65535)
--- xpm-nox-4.2.0/lib/scan.c	2002-01-20 08:53:49.000000000 +0100
+++ xpm-nox-4.2.0/lib/scan.c	2010-09-11 10:03:45.000000000 +0200
@@ -77,7 +77,7 @@
 typedef int (*storeFuncPtr)(Pixel pixel, PixelsMap *pmap,
 			    unsigned int *index_return);
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 # ifndef AMIGA
 LFUNC(GetImagePixels, int, (XImage *image, unsigned int width,
 			    unsigned int height, PixelsMap *pmap));
@@ -99,7 +99,7 @@
 			     unsigned int height, PixelsMap *pmap,
 			     storeFuncPtr storeFunc));
 # endif/* AMIGA */
-#else  /* ndef FOR_MSW */
+#else  /* ndef XPM_NO_X */
 LFUNC(MSWGetImagePixels, int, (Display *d, XImage *image, unsigned int width,
 			       unsigned int height, PixelsMap *pmap,
 			       storeFuncPtr storeFunc));
@@ -245,7 +245,7 @@
      * scan shape mask if any
      */
     if (shapeimage) {
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 # ifndef AMIGA
 	ErrorStatus = GetImagePixels1(shapeimage, width, height, &pmap,
 				      storeMaskPixel);
@@ -270,7 +270,7 @@
      */
 
     if (image) {
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 # ifndef AMIGA
 	if (((image->bits_per_pixel | image->depth) == 1)  &&
 	    (image->byte_order == image->bitmap_bit_order))
@@ -417,7 +417,7 @@
     Colormap colormap;
     char *rgb_fname;
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
     xpmRgbName rgbn[MAX_RGBNAMES];
 #else
     xpmRgbName *rgbn = NULL; 
@@ -471,12 +471,12 @@
     }
     XQueryColors(display, colormap, xcolors, ncolors);
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
     /* read the rgb file if any was specified */
     if (rgb_fname)
 	rgbn_max = xpmReadRgbNames(attributes->rgb_fname, rgbn);
 #else
-    /* FOR_MSW: rgb names and values are hardcoded in rgbtab.h */
+    /* XPM_NO_X: rgb names and values are hardcoded in rgbtab.h */
     rgbn_max = xpmReadRgbNames(NULL, NULL);
 #endif
 
@@ -541,7 +541,7 @@
 	    else {
 		/* at last store the rgb value */
 		char buf[BUFSIZ];
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 		sprintf(buf, "#%04X%04X%04X",
 			xcolor->red, xcolor->green, xcolor->blue);
 #else   
@@ -563,7 +563,7 @@
     return (XpmSuccess);
 }
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 # ifndef AMIGA
 /*
  * The functions below are written from X11R5 MIT's code (XImUtil.c)
@@ -932,7 +932,7 @@
 #undef CLEAN_UP
 
 # endif/* AMIGA */
-#else  /* ndef FOR_MSW */
+#else  /* ndef XPM_NO_X */
 static int
 MSWGetImagePixels(display, image, width, height, pmap, storeFunc)
     Display *display;
@@ -961,7 +961,7 @@
 
 #endif
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 # ifndef AMIGA
 int
 XpmCreateXpmImageFromPixmap(display, pixmap, shapemask,
@@ -1004,4 +1004,4 @@
 }
 
 # endif/* not AMIGA */
-#endif /* ndef FOR_MSW */
+#endif /* ndef XPM_NO_X */
--- xpm-nox-4.2.0/lib/simx.c	1999-01-11 14:23:12.000000000 +0100
+++ xpm-nox-4.2.0/lib/simx.c	2010-09-11 10:03:45.000000000 +0200
@@ -33,10 +33,10 @@
 * Developed by HeDu 3/94 (hedu@cul-ipn.uni-kiel.de)                           *
 \*****************************************************************************/
 
-#ifdef FOR_MSW
+#ifdef XPM_NO_X
 
 #include "xpm.h"
-#include "xpmi.h"			/* for XpmMalloc */
+#include "XpmI.h"			/* for XpmMalloc */
 
 /*
  * On DOS size_t is only 2 bytes, thus malloc(size_t s) can only malloc
@@ -213,7 +213,7 @@
 
 
 int 
-XAllocColor(Display *d, Colormap cmap, XColor *color)
+XAllocColor(Display *d, Colormap *cmap, XColor *color)
 {
 /* colormap not used yet so color->pixel is the real COLORREF (RBG) and not an
    index in some colormap as in X */
@@ -224,7 +224,7 @@
 	     XColor *xcolors, int ncolors)
 {
 /* under X this fills the rgb values to given .pixel */
-/* since there no colormap use FOR_MSW (not yet!!), rgb is plain encoded */
+/* since there no colormap use XPM_NO_X (not yet!!), rgb is plain encoded */
     XColor *xc = xcolors;
     int i;
 
--- xpm-nox-4.2.0/lib/simx.h	1999-01-11 14:23:12.000000000 +0100
+++ xpm-nox-4.2.0/lib/simx.h	2010-09-11 10:03:45.000000000 +0200
@@ -37,9 +37,9 @@
 #ifndef _SIMX_H
 #define _SIMX_H
 
-#ifdef FOR_MSW
+#ifdef XPM_NO_X
 
-#include "windows.h"			/* MS windows GDI types */
+#include <windows.h>		/* MS windows GDI types */
 
 /*
  * minimal portability layer between ansi and KR C
@@ -134,6 +134,6 @@
 #undef LFUNC
 #undef FUNC
 
-#endif /* def FOR_MSW */
+#endif /* def XPM_NO_X */
 
 #endif /* _SIMX_H */
--- xpm-nox-4.2.0/lib/xpm.h	2002-01-20 08:53:49.000000000 +0100
+++ xpm-nox-4.2.0/lib/xpm.h	2010-09-11 10:03:45.000000000 +0200
@@ -43,6 +43,11 @@
  * Lorens Younes (d93-hyo@nada.kth.se) 4/96
  */
 
+/* 
+ * The code related to CYGWIN has been added by
+ * Charles Wilson (cwilson@ece.gatech.edu) 10/00
+ */
+
 #ifndef XPM_h
 #define XPM_h
 
@@ -63,21 +68,33 @@
 #define XpmRevision 11
 #define XpmIncludeVersion ((XpmFormat * 100 + XpmVersion) * 100 + XpmRevision)
 
+/* XPM_NO_X and FOR_MSW are synonymous */
+#ifdef XPM_NO_X
+#  ifndef FOR_MSW
+#    define FOR_MSW
+#  endif
+#endif
+#ifdef FOR_MSW
+#  ifndef XPM_NO_X
+#    define XPM_NO_X
+#  endif
+#endif
+
 #ifndef XPM_NUMBERS
 
-#ifdef FOR_MSW
+#ifdef XPM_NO_X
 # define SYSV			/* uses memcpy string.h etc. */
 # include <malloc.h>
 # include "simx.h"		/* defines some X stuff using MSW types */
 #define NEED_STRCASECMP		/* at least for MSVC++ */
-#else /* FOR_MSW */
+#else /* XPM_NO_X */
 # ifdef AMIGA
 #  include "amigax.h"
 # else /* not AMIGA */
 #  include <X11/Xlib.h>
 #  include <X11/Xutil.h>
 # endif /* not AMIGA */
-#endif /* FOR_MSW */
+#endif /* XPM_NO_X */
 
 /* let's define Pixel if it is not done yet */
 #if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED)
@@ -270,7 +287,7 @@
 #define XpmReturnComments  XpmComments
 
 /* XpmAttributes mask_pixel value when there is no mask */
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 #define XpmUndefPixel 0x80000000
 #else
 /* int is only 16 bit for MSW */
@@ -307,10 +324,10 @@
 extern "C" {
 #endif
 
-/* FOR_MSW, all ..Pixmap.. are excluded, only the ..XImage.. are used */
+/* XPM_NO_X, all ..Pixmap.. are excluded, only the ..XImage.. are used */
 /* Same for Amiga! */
 
-#if !defined(FOR_MSW) && !defined(AMIGA)
+#if !defined(XPM_NO_X) && !defined(AMIGA)
     FUNC(XpmCreatePixmapFromData, int, (Display *display,
 					Drawable d,
 					char **data,
@@ -367,7 +384,7 @@
 					 XImage **image_return,
 					 XImage **shapemask_return,
 					 XpmAttributes *attributes));
-#if !defined(FOR_MSW) && !defined(AMIGA)
+#if !defined(XPM_NO_X) && !defined(AMIGA)
     FUNC(XpmCreatePixmapFromBuffer, int, (Display *display,
 					  Drawable d,
 					  char *buffer,
@@ -411,7 +428,7 @@
     FUNC(XpmWriteFileFromXpmImage, int, (char *filename,
 					 XpmImage *image,
 					 XpmInfo *info));
-#if !defined(FOR_MSW) && !defined(AMIGA)
+#if !defined(XPM_NO_X) && !defined(AMIGA)
     FUNC(XpmCreatePixmapFromXpmImage, int, (Display *display,
 					    Drawable d,
 					    XpmImage *image,
@@ -430,7 +447,7 @@
 					   XImage *shapeimage,
 					   XpmImage *xpmimage,
 					   XpmAttributes *attributes));
-#if !defined(FOR_MSW) && !defined(AMIGA)
+#if !defined(XPM_NO_X) && !defined(AMIGA)
     FUNC(XpmCreateXpmImageFromPixmap, int, (Display *display,
 					    Pixmap pixmap,
 					    Pixmap shapemask,
--- xpm-nox-4.2.0/lib/XpmI.h	2002-01-20 08:56:34.000000000 +0100
+++ xpm-nox-4.2.0/lib/XpmI.h	2010-09-11 10:03:45.000000000 +0200
@@ -56,8 +56,39 @@
 extern FILE *popen();
 #endif
 
-#include <X11/Xos.h>
-#include <X11/Xfuncs.h>
+#if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(WIN32) || defined(linux) || defined(__CYGWIN__)
+#include <string.h>
+
+#ifndef index
+#define index strchr
+#endif
+
+#ifndef rindex
+#define rindex strrchr
+#endif
+
+#else  /* defined(SYSV) || defined(SVR4) || defined(VMS) */
+#include <strings.h>
+#endif
+
+
+
+#if defined(SYSV) || defined(SVR4) || defined(VMS) || defined(WIN32)
+#ifndef bcopy
+#define bcopy(source, dest, count) memcpy(dest, source, count)
+#endif
+#ifndef bzero
+#define bzero(b, len) memset(b, 0, len)
+#endif
+#endif
+
+/* the following is defined in X11R6 but not in previous versions */
+#if defined(__alpha) || defined(__alpha__) || \
+    defined(ia64) || defined(__ia64__)
+#ifndef LONG64
+#define LONG64
+#endif
+#endif
 
 #ifdef VMS
 #include <unixio.h>
@@ -73,7 +104,7 @@
  */
 #define XpmFree(ptr) free(ptr)
 
-#ifndef FOR_MSW
+#ifndef XPM_NO_X
 #define XpmMalloc(size) malloc((size))
 #define XpmRealloc(ptr, size) realloc((ptr), (size))
 #define XpmCalloc(nelem, elsize) calloc((nelem), (elsize))
@@ -168,7 +199,7 @@
 FUNC(xpmSetAttributes, void, (XpmAttributes *attributes, XpmImage *image,
 			      XpmInfo *info));
 
-#if !defined(FOR_MSW) && !defined(AMIGA)
+#if !defined(XPM_NO_X) && !defined(AMIGA)
 FUNC(xpmCreatePixmapFromImage, void, (Display *display, Drawable d,
 				      XImage *ximage, Pixmap *pixmap_return));
 
@@ -234,7 +265,7 @@
 FUNC(xpmGetRgbName, char *, (xpmRgbName *rgbn, int rgbn_max,
 			     int red, int green, int blue));
 FUNC(xpmFreeRgbNames, void, (xpmRgbName *rgbn, int rgbn_max));
-#ifdef FOR_MSW
+#ifdef XPM_NO_X
 FUNC(xpmGetRGBfromName,int, (char *name, int *r, int *g, int *b));
 #endif
 
--- xpm-nox-4.2.0/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ xpm-nox-4.2.0/Makefile	2010-09-11 10:04:07.000000000 +0200
@@ -0,0 +1,74 @@
+#
+#  Copyright (C) 1989-95 GROUPE BULL
+#
+#  Permission is hereby granted, free of charge, to any person obtaining a copy
+#  of this software and associated documentation files (the "Software"), to
+#  deal in the Software without restriction, including without limitation the
+#  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+#  sell copies of the Software, and to permit persons to whom the Software is
+#  furnished to do so, subject to the following conditions:
+#
+#  The above copyright notice and this permission notice shall be included in
+#  all copies or substantial portions of the Software.
+#
+#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+#  GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+#  AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+#  Except as contained in this notice, the name of GROUPE BULL shall not be
+#  used in advertising or otherwise to promote the sale, use or other dealings
+#  in this Software without prior written authorization from GROUPE BULL.
+#
+
+#
+# XPM Makefile - Arnaud LE HORS
+#
+
+VER=4.2.0
+MAJVER=4
+
+prefix?=/usr
+incpath=$(prefix)/include
+libpath=$(prefix)/lib
+binpath=$(prefix)/bin
+manpath=$(prefix)/share/man
+man1path=$(manpath)/man1
+
+# NOTE: if the build fails on your system using this Makefile, you need to check
+# and possibly edit each of the Makefile in the subdirs lib, sxpm, and cxpm.
+
+SUBDIRS= lib cxpm
+DOCS=CHANGES COPYRIGHT FAQ.html README.MSW README.XFree86 README.html doc/xpm.PS.gz
+ 
+MAKE=make
+MFLAGS=-f Makefile
+INSTALL= install -c
+CURRENT_DIR=.
+
+all::
+	@case '${MFLAGS}' in *[ik]*) set +e;; esac; \
+	for i in $(SUBDIRS) ;\
+	do \
+	(cd $$i ; echo "making" all "in $(CURRENT_DIR)/$$i..."; \
+	$(MAKE) $(MFLAGS)  all); \
+	done
+clean::
+	@case '${MFLAGS}' in *[ik]*) set +e;; esac; \
+	for i in $(SUBDIRS) ;\
+	do \
+	(cd $$i ; echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \
+	$(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean); \
+	done
+
+
+install:: 
+	@case '${MFLAGS}' in *[ik]*) set +e;; esac; \
+	for i in $(SUBDIRS) ;\
+	do \
+	(cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \
+	$(MAKE) $(MFLAGS) prefix='$(prefix)' DESTDIR='$(DESTDIR)' INSTALL='$(INSTALL)' install); \
+	done
+
