--- a/Makefile.in
+++ b/Makefile.in
@@ -44,8 +44,8 @@ all:
 	done && test -z "$$fail"
 
 install:
-	$(top_srcdir)/mkinstalldirs $(libdir)/pkgconfig
-	$(INSTALL_DATA) serdisplib.pc $(libdir)/pkgconfig/
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
+	$(INSTALL_DATA) serdisplib.pc $(DESTDIR)$(libdir)/pkgconfig/
 	@for dir in ${subdirs}; do \
 	  (cd $(srcdir) && cd $$dir && $(MAKE) install) \
 	  || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
--- a/server/Makefile.in
+++ b/server/Makefile.in
@@ -102,9 +102,9 @@ distclean: clean
 
 
 install: $(PROGRAMS)
-	$(top_srcdir)/mkinstalldirs $(bindir)
-	$(top_srcdir)/mkinstalldirs $(sbindir)
-	$(top_srcdir)/mkinstalldirs $(sysconfdir)
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(sbindir)
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir)
 	list='$(PROGRAMS_SBIN)'; \
 	for prog in $$list; do \
 	  $(INSTALL_PROGRAM) $$prog $(sbindir)/ ; \
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -28,7 +28,7 @@ includedir = @includedir@
 datarootdir = @datarootdir@
 
 CC=@CC@
-AR=@AR@ -r
+AR=@AR@
 LN_S=@LN_S@
 INSTALL=@INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -184,14 +184,14 @@ programs: $(PROGRAMS)
 	$(CC) $(CFLAGS) $(DEFINES) -c $<
 
 $(LIB_DIR)/$(LIB_STATIC): $(LIB_OBJECTS)
-	$(top_srcdir)/mkinstalldirs $(top_srcdir)/lib
-	$(AR) $(LIB_DIR)/$(LIB_STATIC) $(LIB_OBJECTS)
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(top_srcdir)/lib
+	$(AR) -r -- $(LIB_DIR)/$(LIB_STATIC) $(LIB_OBJECTS)
 
 $(LIB_DIR)/$(LIB_SHARED): $(LIB_OBJECTS)
-	$(top_srcdir)/mkinstalldirs $(top_srcdir)/lib
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(top_srcdir)/lib
 	$(CC) -fPIC -shared $(SONAME_FLAG) -o $(LIB_DIR)/$(LIB_SHARED) $(LIB_OBJECTS) $(LDFLAGS) $(EXTRA_LIBS)
-	cd $(LIB_DIR) && $(LN_S) -f $(LIB_SHARED) lib$(LIB_NAME).so.$(VERSION_MAJOR)
-	cd $(LIB_DIR) && $(LN_S) -f lib$(LIB_NAME).so.$(VERSION_MAJOR) lib$(LIB_NAME).so
+	cd $(DESTDIR)$(LIB_DIR) && $(LN_S) -f $(LIB_SHARED) lib$(LIB_NAME).so.$(VERSION_MAJOR)
+	cd $(DESTDIR)$(LIB_DIR) && $(LN_S) -f lib$(LIB_NAME).so.$(VERSION_MAJOR) lib$(LIB_NAME).so
 
 testserdisp: $(LIB_DIR)/$(LIB_STATIC) $(OBJECTS)
 	$(CC) -o testserdisp $(OBJECTS) $(LIB_SERDISP) $(EXTRA_LIBS_STATIC)
@@ -204,20 +204,20 @@ distclean: clean
 	/bin/rm -f Makefile
 
 install: $(LIB_DIR)/$(LIB_SHARED) $(LIB_DIR)/$(LIB_STATIC)
-	$(top_srcdir)/mkinstalldirs $(bindir)
-	$(top_srcdir)/mkinstalldirs $(libdir)
-	$(top_srcdir)/mkinstalldirs $(includedir)
-	$(top_srcdir)/mkinstalldirs $(includedir)/serdisplib
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir)
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(includedir)
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(includedir)/serdisplib
 	
-	$(INSTALL_PROGRAM) $(PROGRAMS) $(bindir)/
-	$(INSTALL_PROGRAM) $(LIB_DIR)/$(LIB_SHARED) $(libdir)/
-	$(INSTALL_DATA) $(LIB_DIR)/$(LIB_STATIC) $(libdir)/
+	$(INSTALL_PROGRAM) $(PROGRAMS) $(DESTDIR)$(bindir)/
+	$(INSTALL_PROGRAM) $(LIB_DIR)/$(LIB_SHARED) $(DESTDIR)$(libdir)/
+	$(INSTALL_DATA) $(LIB_DIR)/$(LIB_STATIC) $(DESTDIR)$(libdir)/
 	list='$(LIB_HEADERFILES)'; \
 	for headerfile in $$list; do \
-	  $(INSTALL_DATA) ../include/serdisplib/$$headerfile $(includedir)/serdisplib/ ; \
+	  $(INSTALL_DATA) ../include/serdisplib/$$headerfile $(DESTDIR)$(includedir)/serdisplib/ ; \
 	done
-	cd $(libdir) && $(LN_S) -f $(LIB_SHARED) lib$(LIB_NAME).so.$(VERSION_MAJOR)
-	cd $(libdir) && $(LN_S) -f lib$(LIB_NAME).so.$(VERSION_MAJOR) lib$(LIB_NAME).so
+	cd $(DESTDIR)$(libdir) && $(LN_S) -f $(LIB_SHARED) lib$(LIB_NAME).so.$(VERSION_MAJOR)
+	cd $(DESTDIR)$(libdir) && $(LN_S) -f lib$(LIB_NAME).so.$(VERSION_MAJOR) lib$(LIB_NAME).so
 
 uninstall:
 	-/bin/rm -f $(libdir)/libserdisp*
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -151,7 +151,7 @@ distclean: clean
 install: $(PROGRAMS)
 	list='$(PROGRAMS)'; \
 	for prog in $$list; do \
-	  $(INSTALL_PROGRAM) $$prog $(bindir)/ ; \
+	  $(INSTALL_PROGRAM) $$prog $(DESTDIR)$(bindir)/ ; \
 	done
 
 uninstall: $(PROGRAMS)