libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add an XSI replacement for func_split_short_opt.


From: Eric Blake
Subject: Re: [PATCH] Add an XSI replacement for func_split_short_opt.
Date: Tue, 29 Jun 2010 13:32:45 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.2 Thunderbird/3.0.5

On 06/29/2010 12:35 PM, Ralf Wildenhues wrote:
> * Gary V. Vaughan wrote on Tue, Jun 29, 2010 at 08:30:43PM CEST:
>> On 30 Jun 2010, at 01:22, Ralf Wildenhues wrote:
>>> I think m4sh can simply use code like
>>>
>>>  if ( eval '$smart_works' ) >/dev/null 2>&1; then
>>>    func_foo () { smart code; }
>>>  else
>>>    func_foo () { safe code; }
>>>  fi
>>>
>>> for code run a handful of times, without need for extra m4 magic, it's
>>> just that libtool is easily run hundreds of times in a typical large
>>> software build so it warrants optimization.
>>
>> In that case might the retarded shell choke and die as it parses 'smart
>> code;'?
> 
> Good point.  IIRC gnulib-tool uses e.g.,
>   eval 'func_foo () { smart code; }'

That's how m4sh already does it for AS_VAR_APPEND (take a look at
practically any configure script built with recent autoconf):

if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
  eval 'as_fn_append ()
  {
    eval $1+=\$2
  }'
else
  as_fn_append ()
  {
    eval $1=\$$1\$2
  }
fi # as_fn_append

which works just fine with retarded Solaris /bin/sh.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]