Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | From dc0a5c3d2dd4e79d12a150a246a95c4dc88326f1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Koen Kooi <koen@dominion.thruhere.net> |
| 3 | Date: Tue, 16 Aug 2011 16:04:35 +0200 |
| 4 | Subject: [PATCH] Upstream: not yet |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 5 | |
| 6 | Fix configure to accept "--prefix=" (a blank prefix). |
| 7 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 8 | --- |
| 9 | build/make/configure.sh | 20 ++++++++++++++++---- |
| 10 | 1 file changed, 16 insertions(+), 4 deletions(-) |
| 11 | |
| 12 | diff --git a/build/make/configure.sh b/build/make/configure.sh |
| 13 | index 007e020..04d5cbf 100644 |
| 14 | --- a/build/make/configure.sh |
| 15 | +++ b/build/make/configure.sh |
| 16 | @@ -581,6 +581,8 @@ process_common_cmdline() { |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 17 | ;; |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 18 | --prefix=*) |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 19 | prefix="${optval}" |
| 20 | + # Distinguish between "prefix not set" and "prefix set to ''" |
| 21 | + prefixset=1 |
| 22 | ;; |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 23 | --libdir=*) |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 24 | libdir="${optval}" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 25 | @@ -614,13 +616,23 @@ process_cmdline() { |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 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() { |