From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXbP6-0005ip-CB for qemu-devel@nongnu.org; Wed, 20 Jan 2010 09:19:28 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXbP1-0005ev-CX for qemu-devel@nongnu.org; Wed, 20 Jan 2010 09:19:27 -0500 Received: from [199.232.76.173] (port=58796 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXbP1-0005em-7R for qemu-devel@nongnu.org; Wed, 20 Jan 2010 09:19:23 -0500 Received: from lo.gmane.org ([80.91.229.12]:45682) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NXbP0-0004uy-IG for qemu-devel@nongnu.org; Wed, 20 Jan 2010 09:19:23 -0500 Received: from list by lo.gmane.org with local (Exim 4.50) id 1NXbOv-0006X5-HK for qemu-devel@nongnu.org; Wed, 20 Jan 2010 15:19:17 +0100 Received: from 93-34-208-53.ip51.fastwebnet.it ([93.34.208.53]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Jan 2010 15:19:17 +0100 Received: from pbonzini by 93-34-208-53.ip51.fastwebnet.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Jan 2010 15:19:17 +0100 From: Paolo Bonzini Date: Wed, 20 Jan 2010 15:18:53 +0100 Message-ID: References: <20100117124528.GA24106@bee.dooz.org> <4B531406.2070904@mail.berlios.de> <20100119101119.GA11358@bee.dooz.org> <20100119114750.GB11613@bee.dooz.org> <20100120113741.GA31679@pig.zood.org> <20100120134940.GA547@pig.zood.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit In-Reply-To: <20100120134940.GA547@pig.zood.org> Sender: news Subject: [Qemu-devel] Re: Stop using "which" in ./configure List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 01/20/2010 02:49 PM, Loïc Minier wrote: > On Wed, Jan 20, 2010, Paolo Bonzini wrote: >> On 01/20/2010 12:37 PM, Loïc Minier wrote: >>> + # not found >>> + IFS="$local_ifs" >> If you do this, you should set IFS to space-tab-lf at the beginning of >> the script, like this: >> >> IFS=" "" "" >> " > > Are you saying that I can't backup/restore IFS without setting it > first? Yes, it affects the behavior of read for example: $ echo a b c | (read a b c; echo $a; echo $b; echo $c) a b c $ IFS= $ echo a b c | (read a b c; echo $a; echo $b; echo $c) a b c $ (It's not used by QEMU's configure, but it's better to be defensive). >> or this (better because it does not rely on embedding whitespace >> characters within the line): >> IFS=`printf ' \t'`" >> " > > If we go that route, perhaps IFS="`printf ' \t\n'`" would be more > readable? I'm not sure how common printf is though. I tried that, but backtick strips trailing newlines (or something like that but anyway it does not work). IFS=`printf ' \n\t'` would work (the double quotes are not needed) but the Autoconf manual suggests space-tab-newline in that order (even though only the leading space seems important from the rest of the paragraph). printf is fine, though it may not be a builtin. It's actually more portable (even if slower on some shells) to use printf than echo if you have variable substitutions in the string, because it handles consistently the case when the output starts with a minus sign. Paolo