1From dc0a5c3d2dd4e79d12a150a246a95c4dc88326f1 Mon Sep 17 00:00:00 2001
2From: Koen Kooi <koen@dominion.thruhere.net>
3Date: Tue, 16 Aug 2011 16:04:35 +0200
4Subject: [PATCH] Upstream: not yet
5
6Fix configure to accept "--prefix=" (a blank prefix).
7
8---
9 build/make/configure.sh | 20 ++++++++++++++++----
10 1 file changed, 16 insertions(+), 4 deletions(-)
11
12diff --git a/build/make/configure.sh b/build/make/configure.sh
13index 007e020..04d5cbf 100644
14--- a/build/make/configure.sh
15+++ b/build/make/configure.sh
16@@ -581,6 +581,8 @@ process_common_cmdline() {
17         ;;
18       --prefix=*)
19         prefix="${optval}"
20+        # Distinguish between "prefix not set" and "prefix set to ''"
21+        prefixset=1
22         ;;
23       --libdir=*)
24         libdir="${optval}"
25@@ -614,13 +616,23 @@ process_cmdline() {
26 }
27
28 post_process_common_cmdline() {
29-  prefix="${prefix:-/usr/local}"
30+  if [ "$prefixset" != "1" ]
31+  then
32+      prefix=/usr/local
33+  fi
34+
35+  # Strip trailing slash
36   prefix="${prefix%/}"
37+
38   libdir="${libdir:-${prefix}/lib}"
39   libdir="${libdir%/}"
40-  if [ "${libdir#${prefix}}" = "${libdir}" ]; then
41-    die "Libdir ${libdir} must be a subdirectory of ${prefix}"
42-  fi
43+
44+  case "$libdir" in
45+      "${prefix}/"*) ;;
46+      *)
47+          die "Libdir ${libdir} must be a subdirectory of ${prefix}"
48+          ;;
49+  esac
50 }
51
52 post_process_cmdline() {
53