--- Makefile.in	2010-02-02 14:13:56.000000000 -0500
+++ Makefile.in	2010-08-03 13:47:07.000000000 -0400
@@ -214,8 +214,8 @@
 PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
 
-am_jbig2dec_OBJECTS = jbig2dec.$(OBJEXT) sha1.$(OBJEXT)
+am_jbig2dec_OBJECTS = jbig2dec.$(OBJEXT)
 jbig2dec_OBJECTS = $(am_jbig2dec_OBJECTS)
 jbig2dec_DEPENDENCIES = libjbig2dec.la @LIBOBJS@
-jbig2dec_LDFLAGS =
+jbig2dec_LDFLAGS = -lmd
 am_test_arith_OBJECTS = test_arith-jbig2_arith.$(OBJEXT)
 test_arith_OBJECTS = $(am_test_arith_OBJECTS)
@@ -228,5 +228,5 @@
 am_test_sha1_OBJECTS = test_sha1-sha1.$(OBJEXT)
 test_sha1_OBJECTS = $(am_test_sha1_OBJECTS)
-test_sha1_LDADD = $(LDADD)
+test_sha1_LDADD = -lmd
 test_sha1_DEPENDENCIES =
 test_sha1_LDFLAGS =
--- jbig2dec.c	2010-02-02 14:02:55.000000000 -0500
+++ jbig2dec.c	2010-08-03 13:36:41.000000000 -0400
@@ -37,5 +37,8 @@
 
 #include "os_types.h"
-#include "sha1.h"
+#include <sha.h>
+#ifndef SHA1_DIGEST_SIZE
+#	define SHA1_DIGEST_SIZE	20
+#endif
 
 #include "jbig2.h"
--- sha1.c	2009-07-16 00:44:49.000000000 -0400
+++ sha1.c	2010-08-03 13:45:09.000000000 -0400
@@ -87,4 +87,11 @@
 
 #include "os_types.h"
+
+#include <sha.h>
+#ifndef SHA1_DIGEST_SIZE
+#	define SHA1_DIGEST_SIZE	20
+#endif
+
+#if 0
 #include "sha1.h"
 
@@ -261,5 +268,4 @@
 /*************************************************************/
 
-#if 0
 int main(int argc, char** argv)
 {
