On Tue, Sep 13, 2011 at 10:45:27PM -0400, Mike Frysinger wrote: > On Tuesday, September 13, 2011 19:08:09 Brian Harring wrote: > > Making it overridable seems wiser- > > > > usex() { > > local flag="$1" > > local tval=${2-yes} > > local fval=${3-no} > > if use $flag; then > > echo "${tval}" > > else > > echo "${fval}" > > fi > > } > > i dont get it. mine already does exactly this, just in one line. > usex() { use $1 && echo ${2:-yes} || echo ${3:-no} ; }
Err. Mines prettier? *cough* Only real difference is ${2:-yes} versus ${2-yes}; the latter should be used so that `usex flag '' '--disable-some-feature'` is usable. > > While a bit longer, we likely can gut most of the use_* logic to > > use that, and it makes it easier to deal w/ the situations where a > > configure's options always assume --enable-blah thus don't export the > > option, but *do* export a --disable-blah. > > yeah, i thought about replacing use_{with,enable} with usex, but we'd have to > extend usex() a little bit more Only extension I can think of is adding a prefix/postfix... which frankly seems a bit too much. Anything else you were looking for? To be clear, I'm more interested in this from the standpoint of making econf invocations simpler- simplifying use_enable/use_with in the PM isn't a huge concern to me since they're already pretty bloody straightforward at this point. ~brian