[PATCH] devel: add dkg's printmimestructure script to notmuch devel scripts
[notmuch-archives.git] / 6d / 47130e645a817ce6c071c9e39ccb36803d606e
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 39BD1431FB6\r
6         for <notmuch@notmuchmail.org>; Mon, 16 Apr 2012 23:14:38 -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 OO8UHsRLv-hr for <notmuch@notmuchmail.org>;\r
16         Mon, 16 Apr 2012 23:14:34 -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 D4769431FAE\r
19         for <notmuch@notmuchmail.org>; Mon, 16 Apr 2012 23:14:33 -0700 (PDT)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id 1991C68055; Tue, 17 Apr 2012 09:14:30 +0300 (EEST)\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>\r
23 To: notmuch@notmuchmail.org\r
24 Subject: [PATCH] configure: test shell parameter substring processing and\r
25         possibly exec one\r
26 Date: Tue, 17 Apr 2012 09:14:23 +0300\r
27 Message-Id: <1334643263-30207-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: Tue, 17 Apr 2012 06:14:38 -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 To tackle this situation the beginning of configure attemts to do a silent\r
52 parameter substitution in a subshell; in case this fails the subshell exits\r
53 with nonzero value which is easy to detect.\r
54 \r
55 The || constructs are used twice. The first one is used as Bourne shell\r
56 chokes on 'if ! ... ' construct (and if ...; then :; else do_things; fi\r
57 looks stupid). The second one(liner) takes care of the possible future\r
58 addition of 'set -eu' in the beginning of this script.\r
59 ---\r
60 \r
61 This patch obsoleted id:"1334589199-25894-1-git-send-email-tomi.ollila@iki.fi"\r
62 diff:\r
63 -+      NOTMUCH_CONFIGURE=1; export _NOTMUCH_CONFIGURE\r
64 ++      _NOTMUCH_CONFIGURE=1; export _NOTMUCH_CONFIGURE\r
65 \r
66 \r
67 This patch obsoletes 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..06fbeff 100755\r
74 --- a/configure\r
75 +++ b/configure\r
76 @@ -1,6 +1,19 @@\r
77  #! /bin/sh\r
78  \r
79 +# Test whether this sh is capable of parameter substring processing.\r
80 +# If not, attempt to locate and launch one which probably can.\r
81 +( option=option=value; : ${option#*=} ) 2>/dev/null || {\r
82 +    if test x"${_NOTMUCH_CONFIGURE-}" = x ; then\r
83 +       _NOTMUCH_CONFIGURE=1; export _NOTMUCH_CONFIGURE\r
84 +       for x in /bin/ksh /bin/bash /usr/bin/bash\r
85 +       do test ! -x "$x" || exec "$x" "$0" "$@"\r
86 +       done\r
87 +    fi\r
88 +    echo "Cannot find compatible shell to execute '$0'" >&2\r
89 +    exit 1\r
90 +}\r
91 +unset _NOTMUCH_CONFIGURE\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