@@ -52,6 +52,7 @@ enum Kind {
52
52
Disable ,
53
53
With ,
54
54
Without ,
55
+ Arbitrary ,
55
56
}
56
57
57
58
/// Builder style configuration for a pending autotools build.
@@ -63,7 +64,6 @@ pub struct Config {
63
64
cxxflags : OsString ,
64
65
ldflags : OsString ,
65
66
options : Vec < ( Kind , OsString , Option < OsString > ) > ,
66
- config_options : Vec < ( OsString , Option < OsString > ) > ,
67
67
target : Option < String > ,
68
68
make_args : Option < Vec < String > > ,
69
69
make_targets : Option < Vec < String > > ,
@@ -108,7 +108,6 @@ impl Config {
108
108
cxxflags : OsString :: new ( ) ,
109
109
ldflags : OsString :: new ( ) ,
110
110
options : Vec :: new ( ) ,
111
- config_options : Vec :: new ( ) ,
112
111
make_args : None ,
113
112
make_targets : None ,
114
113
out_dir : None ,
@@ -159,10 +158,7 @@ impl Config {
159
158
160
159
/// Passes `--<opt><=optarg>` to configure.
161
160
pub fn config_option < P : AsRef < OsStr > > ( & mut self , opt : P , optarg : Option < P > ) -> & mut Config {
162
- let optarg = optarg. as_ref ( ) . map ( |v| v. as_ref ( ) . to_owned ( ) ) ;
163
- self . config_options . push ( ( opt. as_ref ( ) . to_owned ( ) ,
164
- optarg) ) ;
165
- self
161
+ self . set_opt ( Kind :: Arbitrary , opt, optarg)
166
162
}
167
163
168
164
/// Passes `--enable-<opt><=optarg>` to configure.
@@ -377,30 +373,21 @@ impl Config {
377
373
} ;
378
374
}
379
375
376
+ let mut config_host = false ;
377
+
380
378
for & ( ref kind, ref k, ref v) in & self . options {
381
379
let mut os = OsString :: from ( "--" ) ;
382
380
match * kind {
383
- Kind :: Enable => os. push ( "enable" ) ,
384
- Kind :: Disable => os. push ( "disable" ) ,
385
- Kind :: With => os. push ( "with" ) ,
386
- Kind :: Without => os. push ( "without" )
381
+ Kind :: Enable => os. push ( "enable-" ) ,
382
+ Kind :: Disable => os. push ( "disable-" ) ,
383
+ Kind :: With => os. push ( "with-" ) ,
384
+ Kind :: Without => os. push ( "without-" ) ,
385
+ Kind :: Arbitrary => {
386
+ if k == "host" {
387
+ config_host = true ;
388
+ }
389
+ }
387
390
} ;
388
- os. push ( "-" ) ;
389
- os. push ( k) ;
390
- if let & Some ( ref v) = v {
391
- os. push ( "=" ) ;
392
- os. push ( v) ;
393
- }
394
- cmd. arg ( os) ;
395
- }
396
-
397
- let mut config_host = false ;
398
-
399
- for & ( ref k, ref v) in & self . config_options {
400
- let mut os = OsString :: from ( "--" ) ;
401
- if k == "host" {
402
- config_host = true ;
403
- }
404
391
os. push ( k) ;
405
392
if let & Some ( ref v) = v {
406
393
os. push ( "=" ) ;
0 commit comments