--- Makefile.in	2005-05-22 16:06:14.000000000 +0200
+++ Makefile.in	2005-07-13 14:34:15.000000000 +0200
@@ -26,7 +26,7 @@
 libdir = $(exec_prefix)/lib
 incdir = $(exec_prefix)/include
 manext = 1
-mandir = $(prefix)/man/man$(manext)
+mandir = @mandir@/man$(manext)
 
 # HP 9000 series, if you don't have gcc
 #   CC = cc
@@ -290,40 +290,40 @@
 	 inst-script-interpreters
 
 inst-vm:
-	$(INSTALL_PROGRAM) $(VM) $(LIB)
+	$(INSTALL_PROGRAM) $(VM) $(DESTDIR)$(LIB)
 
 inst-image:
 	rm -f '/tmp/$(IMAGE)' &&					\
 	$(srcdir)/build/build-usual-image $(srcdir) '$(LIB)'            \
 	         '/tmp/$(IMAGE)' './$(VM)' '$(INITIAL)' &&		\
-	$(INSTALL_DATA) /tmp/$(IMAGE) $(LIB) &&				\
+	$(INSTALL_DATA) /tmp/$(IMAGE) $(DESTDIR)$(LIB) &&				\
 	rm /tmp/$(IMAGE)
 
 inst-man:
-	$(srcdir)/mkinstalldirs $(mandir)
+	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
 	sed 's=LBIN=$(bindir)=g' $(srcdir)/doc/scheme48.man |	   \
 		sed 's=LLIB=$(LIB)=g' |				   \
 		sed 's=LS48=$(RUNNABLE)=g' >$(MANPAGE) &&	   \
-	$(INSTALL_DATA) $(MANPAGE) $(mandir) &&			   \
+	$(INSTALL_DATA) $(MANPAGE) $(DESTDIR)$(mandir) &&			   \
 	rm $(MANPAGE);						   \
 
 inst-inc:
-	$(INSTALL_DATA) $(srcdir)/c/scheme48.h $(incdir)
-	$(INSTALL_DATA) $(srcdir)/c/scheme48write-barrier.h $(incdir)
+	$(INSTALL_DATA) $(srcdir)/c/scheme48.h $(DESTDIR)$(incdir)
+	$(INSTALL_DATA) $(srcdir)/c/scheme48write-barrier.h $(DESTDIR)$(incdir)
 
 inst-misc:
 	for stub in env big sort opt misc link posix cml srfi; do	\
 		for f in $(srcdir)/scheme/$$stub/*.scm; do		\
-			$(INSTALL_DATA) $$f $(LIB)/$$stub || exit 1;	\
+			$(INSTALL_DATA) $$f $(DESTDIR)$(LIB)/$$stub || exit 1;	\
 		done;							\
 	done &&								\
 	for f in $(srcdir)/scheme/rts/*num.scm 				\
 		 $(srcdir)/scheme/rts/jar-defrecord.scm; do		\
-		$(INSTALL_DATA) $$f $(LIB)/rts || exit 1;		\
+		$(INSTALL_DATA) $$f $(DESTDIR)$(LIB)/rts || exit 1;		\
 	done
 
 inst-script:
-	script=$(bindir)/$(RUNNABLE) &&					\
+	script=$(DESTDIR)$(bindir)/$(RUNNABLE) &&					\
 	echo '#!/bin/sh'	>$$script &&				\
 	echo			>>$$script &&				\
 	echo 'lib=$(LIB)'	>>$$script &&				\
@@ -333,7 +333,7 @@
 
 inst-script-interpreters:
 	for dialect in r5rs srfi-7; do					\
-		$(INSTALL_PROGRAM) script-interpreter $(bindir)/scheme-$$dialect; \
+		$(INSTALL_PROGRAM) script-interpreter $(DESTDIR)$(bindir)/scheme-$$dialect; \
 	done
 
 # Script to run scheme48 in this directory.
@@ -347,11 +347,11 @@
 
 dirs:
 	for dir in $(libdir) $(bindir) $(incdir); do			 \
-		$(srcdir)/mkinstalldirs $$dir || exit 1;	 		 \
+		$(srcdir)/mkinstalldirs $(DESTDIR)$$dir || exit 1;	 		 \
 	done
-	$(srcdir)/mkinstalldirs $(LIB)
+	$(srcdir)/mkinstalldirs $(DESTDIR)$(LIB)
 	for dir in rts env big sort opt misc link posix cml srfi; do	  \
-		$(srcdir)/mkinstalldirs $(LIB)/$$dir || exit 1;	 	  \
+		$(srcdir)/mkinstalldirs $(DESTDIR)$(LIB)/$$dir || exit 1;	 	  \
 	done
 
 configure: configure.in
