Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D1FE3431FBC for ; Thu, 3 May 2012 12:00:08 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D9-xk2YHbbUk for ; Thu, 3 May 2012 12:00:07 -0700 (PDT) Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66]) by olra.theworths.org (Postfix) with ESMTP id 7637D431FB6 for ; Thu, 3 May 2012 12:00:07 -0700 (PDT) Received: by guru.guru-group.fi (Postfix, from userid 501) id A9A5568057; Thu, 3 May 2012 22:00:00 +0300 (EEST) From: Tomi Ollila To: notmuch@notmuchmail.org Subject: [PATCH] configure: check whether shell is capable of parameter substring processing Date: Thu, 3 May 2012 21:59:58 +0300 Message-Id: <1336071598-18930-1-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 1.7.6.1 In-Reply-To: <1334589199-25894-1-git-send-email-tomi.ollila@iki.fi> References: <1334589199-25894-1-git-send-email-tomi.ollila@iki.fi> Cc: Tomi Ollila X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2012 19:00:09 -0000 '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