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