From f7867154129781ee1522344bef50890c01f2b47a Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Wed, 27 Jun 2012 21:21:18 +0300
Subject: [PATCH] Fix install program detection

configure handles INSTALL as a substitution variable specially, and
apparently it gets confused when it's set to empty.  Use INSTALL_
instead as a workaround to avoid the issue.
---
 configure              | 5 ++++-
 configure.in           | 4 +++-
 src/Makefile.global.in | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index fd297702051..1661be7d29f 100755
--- a/configure
+++ b/configure
@@ -693,6 +693,7 @@ MKDIR_P
 AWK
 LN_S
 TAR
+INSTALL_
 INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
@@ -6955,9 +6956,11 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 # a relative path to it in each makefile where it subsitutes it. This clashes
 # with our Makefile.global concept. This workaround helps.
 case $INSTALL in
-  *install-sh*) INSTALL='';;
+  *install-sh*) INSTALL_='';;
+  *) INSTALL_=$INSTALL;;
 esac
 
+
 # Extract the first word of "tar", so it can be a program name with args.
 set dummy tar; ac_word=$2
 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
diff --git a/configure.in b/configure.in
index 01869305b91..5e5318b9b7e 100644
--- a/configure.in
+++ b/configure.in
@@ -814,8 +814,10 @@ AC_PROG_INSTALL
 # a relative path to it in each makefile where it subsitutes it. This clashes
 # with our Makefile.global concept. This workaround helps.
 case $INSTALL in
-  *install-sh*) INSTALL='';;
+  *install-sh*) INSTALL_='';;
+  *) INSTALL_=$INSTALL;;
 esac
+AC_SUBST(INSTALL_)
 
 AC_PATH_PROG(TAR, tar)
 AC_PROG_LN_S
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 97dea8a0581..1e61e73b0df 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -290,7 +290,7 @@ BZIP2	= bzip2
 # Installation.
 
 install_sh = $(SHELL) $(top_srcdir)/config/install-sh -c
-INSTALL = $(if $(use_install_sh),$(install_sh),$(or @INSTALL@,$(install_sh)))
+INSTALL = $(if $(use_install_sh),$(install_sh),$(or @INSTALL_@,$(install_sh)))
 
 INSTALL_SCRIPT_MODE	= 755
 INSTALL_DATA_MODE	= 644
-- 
GitLab