[PATCH] configure: check whether shell is capable of parameter substring processing
[notmuch-archives.git] / 98 / b20be5639be7346a6bf4830b5afd5bc7a60c1b
1 Return-Path: <too@guru.guru-group.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id D1FE3431FBC\r
6         for <notmuch@notmuchmail.org>; Thu,  3 May 2012 12:00:08 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id D9-xk2YHbbUk for <notmuch@notmuchmail.org>;\r
16         Thu,  3 May 2012 12:00:07 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])\r
18         by olra.theworths.org (Postfix) with ESMTP id 7637D431FB6\r
19         for <notmuch@notmuchmail.org>; Thu,  3 May 2012 12:00:07 -0700 (PDT)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id A9A5568057; Thu,  3 May 2012 22:00:00 +0300 (EEST)\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>\r
23 To: notmuch@notmuchmail.org\r
24 Subject: [PATCH] configure: check whether shell is capable of parameter\r
25         substring processing\r
26 Date: Thu,  3 May 2012 21:59:58 +0300\r
27 Message-Id: <1336071598-18930-1-git-send-email-tomi.ollila@iki.fi>\r
28 X-Mailer: git-send-email 1.7.6.1\r
29 In-Reply-To: <1334589199-25894-1-git-send-email-tomi.ollila@iki.fi>\r
30 References: <1334589199-25894-1-git-send-email-tomi.ollila@iki.fi>\r
31 Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
32 X-BeenThere: notmuch@notmuchmail.org\r
33 X-Mailman-Version: 2.1.13\r
34 Precedence: list\r
35 List-Id: "Use and development of the notmuch mail system."\r
36         <notmuch.notmuchmail.org>\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
38         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
40 List-Post: <mailto:notmuch@notmuchmail.org>\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
44 X-List-Received-Date: Thu, 03 May 2012 19:00:09 -0000\r
45 \r
46 'configure' script uses parameter substring extensively. It is Posix shell\r
47 feature. Original Bourne shell does not have such features. Some systems\r
48 still ships such shells as /bin/sh (for compatibility reasons -- shell\r
49 scripts written on those platforms are expected to work on 1990's systems).\r
50 \r
51 Just testing whether parameter substring processing works will make the\r
52 shell exit due to syntax error if it is not compatible. Therefore the test\r
53 is executed in a subshell -- subshell exits with nonzero value when the\r
54 operation in question fails.\r
55 \r
56 As 'if ! ...' does not work in Bourne shell, Short-circuiting construct\r
57 '||' is used to print information message and exit when expected.\r
58 ---\r
59 This is now based on last short talk on IRC. Anyone good with words\r
60 care to comment on text content ? :)\r
61 \r
62 This patch obsoletes:\r
63 \r
64 id:"1334643263-30207-1-git-send-email-tomi.ollila@iki.fi" , \r
65 id:"1334589199-25894-1-git-send-email-tomi.ollila@iki.fi"\r
66 and\r
67 id:"1333966665-10469-2-git-send-email-Vladimir.Marek@oracle.com"\r
68 \r
69  configure |   14 ++++++++++++++\r
70  1 files changed, 14 insertions(+), 0 deletions(-)\r
71 \r
72 diff --git a/configure b/configure\r
73 index 71981b7..7a13102 100755\r
74 --- a/configure\r
75 +++ b/configure\r
76 @@ -1,5 +1,19 @@\r
77  #! /bin/sh\r
78  \r
79 +# Test whether this shell is capable of parameter substring processing.\r
80 +( option='a/b'; : ${option#*/} ) 2>/dev/null || {\r
81 +    echo "\r
82 +The shell interpreting '$0' is lacking some required features.\r
83 +\r
84 +To work around this problem you may try to execute:\r
85 +\r
86 +    ksh $0 $*\r
87 + or\r
88 +    bash $0 $*\r
89 +"\r
90 +    exit 1\r
91 +}\r
92 +\r
93  # Store original IFS value so it can be changed (and restored) in many places.\r
94  readonly DEFAULT_IFS=$IFS\r
95  \r
96 -- \r
97 1.7.8.2\r
98 \r