chiark / gitweb /
Support DESTDIR=/some/absolute/path on `make install'
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 8 Jun 2020 16:12:41 +0000 (17:12 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 11 Jun 2020 15:13:02 +0000 (16:13 +0100)
You must have done `make' *without* DESTDIR, first.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
common.make.in

index 46add1c3585b5d74a57cccdb76224bf94b208288..5e0e80b32a0ae43ef6bce75b330489f4522a0de1 100644 (file)
@@ -45,11 +45,22 @@ MKSHLIB_1=  @MKSHLIB_1@
 MKSHLIB_2=     @MKSHLIB_2@
 MKSHLIB_3=     @MKSHLIB_3@
 
 MKSHLIB_2=     @MKSHLIB_2@
 MKSHLIB_3=     @MKSHLIB_3@
 
-prefix=                @prefix@
-exec_prefix=   @exec_prefix@
-bindir=                @bindir@
-libdir=                @libdir@
-includedir=    @includedir@
+prefix         := @prefix@
+exec_prefix    := @exec_prefix@
+bindir         := @bindir@
+libdir         := @libdir@
+includedir     := @includedir@
+
+ifneq ($(DESTDIR),)
+# autoconf likes to define some of these in terms of each other
+# so if we want to add a prefix to each one we have to do it this way:
+destdir_prefix=$(DESTDIR)/
+prefix         := ${destdir_prefix}${prefix}
+exec_prefix    := ${destdir_prefix}${exec_prefix}
+bindir         := ${destdir_prefix}${bindir}
+libdir         := ${destdir_prefix}${libdir}
+includedir     := ${destdir_prefix}${includedir}
+endif
 
 AC_INSTALL=    @INSTALL@
 ifeq ($(AC_INSTALL),./install-sh -c)
 
 AC_INSTALL=    @INSTALL@
 ifeq ($(AC_INSTALL),./install-sh -c)