From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org
Cc: Tomi Ollila <tomi.ollila@iki.fi>
Subject: [PATCH] configure: check whether shell is capable of parameter substring processing
Date: Thu, 3 May 2012 21:59:58 +0300 [thread overview]
Message-ID: <1336071598-18930-1-git-send-email-tomi.ollila@iki.fi> (raw)
In-Reply-To: <1334589199-25894-1-git-send-email-tomi.ollila@iki.fi>
'configure' script uses parameter substring extensively. It is Posix shell
feature. Original Bourne shell does not have such features. Some systems
still ships such shells as /bin/sh (for compatibility reasons -- shell
scripts written on those platforms are expected to work on 1990's systems).
Just testing whether parameter substring processing works will make the
shell exit due to syntax error if it is not compatible. Therefore the test
is executed in a subshell -- subshell exits with nonzero value when the
operation in question fails.
As 'if ! ...' does not work in Bourne shell, Short-circuiting construct
'||' is used to print information message and exit when expected.
---
This is now based on last short talk on IRC. Anyone good with words
care to comment on text content ? :)
This patch obsoletes:
id:"1334643263-30207-1-git-send-email-tomi.ollila@iki.fi" ,
id:"1334589199-25894-1-git-send-email-tomi.ollila@iki.fi"
and
id:"1333966665-10469-2-git-send-email-Vladimir.Marek@oracle.com"
configure | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index 71981b7..7a13102 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,19 @@
#! /bin/sh
+# Test whether this shell is capable of parameter substring processing.
+( option='a/b'; : ${option#*/} ) 2>/dev/null || {
+ echo "
+The shell interpreting '$0' is lacking some required features.
+
+To work around this problem you may try to execute:
+
+ ksh $0 $*
+ or
+ bash $0 $*
+"
+ exit 1
+}
+
# Store original IFS value so it can be changed (and restored) in many places.
readonly DEFAULT_IFS=$IFS
--
1.7.8.2
next prev parent reply other threads:[~2012-05-03 19:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-16 15:13 [PATCH] configure: test shell parameter substring processing and possibly exec one Tomi Ollila
2012-04-17 6:14 ` Tomi Ollila
2012-05-02 22:25 ` David Bremner
2012-05-03 18:59 ` Tomi Ollila [this message]
2012-07-25 11:21 ` [PATCH] configure: check whether shell is capable of parameter substring processing David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1336071598-18930-1-git-send-email-tomi.ollila@iki.fi \
--to=tomi.ollila@iki.fi \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).