diff -aprNU5 dcraw.orig/dcraw.c dcraw/dcraw.c
--- dcraw.orig/dcraw.c	2007-01-21 01:03:32 +0000
+++ dcraw/dcraw.c	2007-02-27 06:35:22 +0000
@@ -53,11 +53,11 @@
 #define _(String) gettext(String)
 #else
 #define _(String) (String)
 #endif
 
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__DJGPP__)
 #include <io.h>
 #endif
 #ifdef WIN32
 #include <sys/utime.h>
 #include <winsock2.h>
@@ -137,11 +137,13 @@ struct {
   int format, key_off, black, black_off, split_col, tag_21a;
   float tag_210;
 } ph1;
 
 #define CLASS
+#ifndef __DJGPP__
 #define fgetc getc_unlocked
+#endif
 
 #define FORC3 for (c=0; c < 3; c++)
 #define FORC4 for (c=0; c < 4; c++)
 #define FORCC for (c=0; c < colors; c++)
 
diff -aprNU5 dcraw.orig/install dcraw/install
--- dcraw.orig/install	2007-01-21 04:26:36 +0000
+++ dcraw/install	2007-03-02 20:52:00 +0000
@@ -1,18 +1,40 @@
 #!/bin/sh
 # Simple installer for dcraw executable, manpages, and message catalogs.
 # Dave Coffin, dcoffin a cybercom o net
+#
+# Following changes have been added for djgpp support:
+# 1) Allow for an installation prefix that can be set
+#    with a value at the command line.
+# 2) Allow for a binary extension that can be set
+#    with a value at the command line.
+# 3) No LOCALE support still, so undefine LOCALEDIR.
+#    Do not install translation of man pages.
+#
+
+
+prefix=$1
+if [ -z "$prefix" ]; then
+  prefix=/dev/env/DJDIR
+fi
+
+EXEEXT=$2
+if [ -z "$EXEEXT" ]; then
+  EXEEXT=.exe
+fi
 
-prefix=/usr/local
 
 # Add a CPU-specific "-march=" for greater speed
-gcc -O4 -Wall -o $prefix/bin/dcraw dcraw.c -lm -ljpeg -llcms -s \
-	-DLOCALEDIR=\"$prefix/share/locale/\"
+gcc -O4 -Wall -o dcraw$EXEEXT dcraw.c -lm -ljpeg -llcms -s -march=i386
+mkdir -pv $prefix/bin
+cp -vf dcraw$EXEEXT $prefix/bin/dcraw$EXEEXT
 
-cp dcraw.1 $prefix/share/man/man1
+groff -mman -Tascii dcraw.1 > dcraw.1-t
+mkdir -pv $prefix/share/man/cat1
+cp -vf dcraw.1-t $prefix/share/man/cat1/dcraw.1
 
-# Please help me add more languages
-for lang in eo ru fr it de pt es zh_TW zh_CN
-do
-  cp dcraw_$lang.1 $prefix/share/man/$lang/man1/dcraw.1
-  msgfmt -o $prefix/share/locale/$lang/LC_MESSAGES/dcraw.mo dcraw_$lang.po
-done
+# # Please help me add more languages
+# for lang in eo ru fr it de pt es zh_TW zh_CN
+# do
+#   cp dcraw_$lang.1 $prefix/share/man/$lang/man1/dcraw.1
+#   msgfmt -o $prefix/share/locale/$lang/LC_MESSAGES/dcraw.mo dcraw_$lang.po
+# done
