diff --git a/BUILD_DIR/hd_install.c b/BUILD_DIR/hd_install.c --- a/BUILD_DIR/hd_install.c +++ b/BUILD_DIR/hd_install.c @@ -1459,6 +1459,7 @@ int HDinstall_file(int argc, char** argv, int status) { char** nextArg; char** tmpArg; char* tmp_cp; + char* destdir; InstallOptions opts = DEFAULT; /* Process command line options which apply to this program. */ @@ -1555,6 +1556,15 @@ int HDinstall_file(int argc, char** argv, int status) { continue; } + /* Prepend $DESTDIR if defined. */ + if(NULL != (destdir = getenv("DESTDIR"))) { + char* newdest = NULL; + if(OK != (status = AppendPath(destdir, dest, &newdest, status))) + continue; + free(dest); + dest = newdest; + } + /* Give information. */ /* Perform installation. */ status = InstallFiles(src, dest, nextArg, &opts, status);