[PATCH] configure: test shell parameter substring processing and possibly exec one
authorTomi Ollila <tomi.ollila@iki.fi>
Mon, 16 Apr 2012 15:13:19 +0000 (18:13 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:28 +0000 (09:46 -0800)
b2/9427d688d4612439497d3851bb46d0a88db9c9 [new file with mode: 0644]

diff --git a/b2/9427d688d4612439497d3851bb46d0a88db9c9 b/b2/9427d688d4612439497d3851bb46d0a88db9c9
new file mode 100644 (file)
index 0000000..005b61f
--- /dev/null
@@ -0,0 +1,90 @@
+Return-Path: <too@guru.guru-group.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id A5B0F431FAF\r
+       for <notmuch@notmuchmail.org>; Mon, 16 Apr 2012 08:13:28 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id RcbzVNATEMdz for <notmuch@notmuchmail.org>;\r
+       Mon, 16 Apr 2012 08:13:28 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])\r
+       by olra.theworths.org (Postfix) with ESMTP id D8611431FAE\r
+       for <notmuch@notmuchmail.org>; Mon, 16 Apr 2012 08:13:27 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+       id 6445768055; Mon, 16 Apr 2012 18:13:21 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] configure: test shell parameter substring processing and\r
+       possibly exec one\r
+Date: Mon, 16 Apr 2012 18:13:19 +0300\r
+Message-Id: <1334589199-25894-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.7.6.1\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 16 Apr 2012 15:13:28 -0000\r
+\r
+configure script uses parameter substring extensively. It is Posix shell\r
+feature. Original Bourne shell does not have such features. Some systems\r
+still ships such shells as /bin/sh (for compatibility reasons -- shell\r
+scripts written on those platforms are expected to work in 1990's systems...)\r
+\r
+To tackle this situation the beginning of configure attemts to do a silent\r
+parameter substitution in a subshell; in case this fails the subshell exits\r
+with nonzero value which is easy to detect.\r
+\r
+The || constructs are used twice. The first one is used as Bourne shell\r
+chokes on 'if ! ... ' construct (and if ...; then :; else do_things; fi\r
+looks stupid). The second one(liner) takes care of the possible future\r
+'set -eu' in the beginning of this script.\r
+---\r
+\r
+This patch obsoletes id:"1333966665-10469-2-git-send-email-Vladimir.Marek@oracle.com"\r
+\r
+ configure |   14 ++++++++++++++\r
+ 1 files changed, 14 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/configure b/configure\r
+index 71981b7..06fbeff 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -1,5 +1,19 @@\r
+ #! /bin/sh\r
\r
++# Test whether this sh is capable of parameter substring processing.\r
++# If not, attempt to locate and launch one which probably can.\r
++( option=option=value; : ${option#*=} ) 2>/dev/null || {\r
++    if test x"${_NOTMUCH_CONFIGURE-}" = x ; then\r
++      NOTMUCH_CONFIGURE=1; export _NOTMUCH_CONFIGURE\r
++      for x in /bin/ksh /bin/bash /usr/bin/bash\r
++      do test ! -x "$x" || exec "$x" "$0" "$@"\r
++      done\r
++    fi\r
++    echo "Cannot find compatible shell to execute '$0'" >&2\r
++    exit 1\r
++}\r
++unset _NOTMUCH_CONFIGURE\r
++\r
+ # Store original IFS value so it can be changed (and restored) in many places.\r
+ readonly DEFAULT_IFS=$IFS\r
\r
+-- \r
+1.7.8.2\r
+\r