From e61ebcd649a0260c9a143a5ddebfb0199581ee45 Mon Sep 17 00:00:00 2001 From: Thomas Jahns Date: Fri, 8 Aug 2014 13:18:56 +0200 Subject: [PATCH] Fix relative path in ac_install_sh for MKDIR_P. --- lib/autoconf/programs.m4 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4 index 32f737a..0f214bf 100644 --- a/lib/autoconf/programs.m4 +++ b/lib/autoconf/programs.m4 @@ -687,7 +687,17 @@ if test -z "$MKDIR_P"; then # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" + # 1. extract (relative) path of install script from ac_install_sh + MKDIR_P=`echo "$ac_install_sh" | sed 's:\(.*\)/.*:\1:'` + AS_CASE(["$MKDIR_P"], + # 2. leave as-is if no path component or already absolute ... + ["" | [\\/]* | ?:[\\/]*],[], + # ... or convert to absolute if relative + [MKDIR_P=`cd "$MKDIR_P" && pwd` + test -d "$MKDIR_P" || + AC_MSG_FAILURE([Cannot derive absolute path from relative of path of "$ac_install_sh"]) + ]) + MKDIR_P="$MKDIR_P"`echo "$ac_install_sh" | sed 's:.*\(/.*\):\1:'`" -d" fi fi dnl status.m4 does special magic for MKDIR_P instead of AC_SUBST, -- 1.7.10.4