OS/2 EMX -Zmtd build of gd library v2.0.15 for programmatic graphic output.
Requires freetyp2.dll, iconv.dll, jpeg.dll, z.dll (all included).  Will use
Xpm.dll (included) if X11 is present.  Compiled-in support: GIF (via
patch_gd2.0.15_gif_030801.gz, JPEG, Freetype 2.x, Xpm.

This version is backward-compatible with applications requiring gd with GIF
support.

---------------------------------------------------  INSTALL Procedure

Extract to d:/emx directory or an equivalent:

  unzip gd-2-0-15.zip -d d:/emx

One needs to edit the configuration files to correct /usr/local to the actual
install directory.  One possible way (requires sh and perl): edit install_dir=
line in

 try-relocate.cmd

(with the above example, it should be install_dir=d:/emx), then run the script.

If your system has no required support DLLs, or if your z.dll is not 1.1.4 (as
compiled by Franz Bakan), move the support DLLs from d:/emx/dll/support to
d:/emx/dll (the supplied z.dll is compatible with both (mutually incompatible)
existing variants of 1.1.3 DLLs).

The DLLs freetyp2.dll, iconv.dll are from iconv0.2.1.zip and freetype2.zip
(uploaded to Hobbes), should be on
  http://hobbes.nmsu.edu/pub/os2/util/iconv0.2.1.zip
  http://hobbes.nmsu.edu/pub/os2/util/font/freetype2.zip
jpeg.dll is from
  ftp://ftp.leo.org/pub/comp/os/os2/leo/devtools/libraries/jpeg6b.zip
Xpm.dll from
  http://hobbes.nmsu.edu/pub/os2/dev/x11/xpm34k.zip

---------------------------------------------------  BUILD Procedure

The Perl script convert_configure is available from ilyaz.org/software/os2.

convert_configure -zomf
(sh configure && make && make test) |& tee 00c1
os2\make_dll.cmd

Compiling to make xpm support dynamically-loaded:

gcc -O2 -Zomf -c xpm_delayed_load.c
cd libs
gcc -s -Zdll -Zomf -Zmtd -o gd_gif.dll ./static/gd.lib gd_gif.def -lfreetype -lpng_import -ljpeg -lz_import -liconv ../xpm_delayed_load.obj  |& tee 00l1

Below is the patch to create tools for creation of DLLs, and make xpm support
dynamically-loaded:

--- ./os2/make-dll.cmd-pre	Fri Nov 14 19:42:38 2003
+++ ./os2/make-dll.cmd	Wed Oct  8 21:30:34 2003
@@ -0,0 +1,10 @@
+cd .libs
+mkdir static
+emxomf gd.a
+cp gd.lib static/
+cp ../os2/gd.def-base  ../os2/gd_gif.def
+emxexp static/gd.lib >>..\os2\gd_gif.def
+gcc -s -Zdll -Zomf -Zmtd -o gd_gif.dll -L./static -lgd ../os2/gd_gif.def -lfreetype -lpng_import -ljpeg -lz_import -lXpm -liconv
+lxlite *.dll
+emximp -o gd-dyn.lib ../os2/gd_gif.def
+emximp -o gd-dyn.a   ../os2/gd_gif.def
--- ./os2/gd.def-base-pre	Fri Nov 14 19:42:32 2003
+++ ./os2/gd.def-base	Wed Oct  8 21:34:48 2003
@@ -0,0 +1,6 @@
+LIBRARY 'gd_gif' INITINSTANCE TERMINSTANCE
+DESCRIPTION '@#www.boutell.com/gd/:2.0.15#@A graphics library for fast image creation.  Build for EMX -Zmtd'
+STACKSIZE 32768
+CODE LOADONCALL
+DATA LOADONCALL NONSHARED MULTIPLE
+EXPORTS
--- ./xpm_delayed_load.c-pre	Fri Nov 14 19:46:06 2003
+++ ./xpm_delayed_load.c	Tue Nov 11 20:52:30 2003
@@ -0,0 +1,24 @@
+#define INCL_DOSMODULEMGR
+#include <os2.h>
+#include <X11/xpm.h>
+
+int (*pXpmReadFileToXpmImage)(char *filename, XpmImage *image, XpmInfo *info);
+
+int
+XpmReadFileToXpmImage(char *filename, XpmImage *image, XpmInfo *info)
+{
+    static int tried;
+    static HMODULE hXPM = 0;
+
+    if (pXpmReadFileToXpmImage) 
+	return pXpmReadFileToXpmImage(filename, image, info);
+    if (!tried++) {
+	char bad_module[CCHMAXPATH];
+	if (DosLoadModule(bad_module, sizeof(bad_module), "XPM", &hXPM))
+	    return XpmNoMemory;	/* XXX Is there a better code? */
+	if (DosQueryProcAddr(hXPM, 24, NULL, (PFN *)&pXpmReadFileToXpmImage))
+	    return XpmNoMemory;
+	return pXpmReadFileToXpmImage(filename, image, info);
+    }
+    return XpmNoMemory;
+}
