@@ -93,6 +93,7 @@ pub struct Config {
93
93
atleast_version : Option < String > ,
94
94
extra_args : Vec < OsString > ,
95
95
cargo_metadata : bool ,
96
+ print_system_libs : bool ,
96
97
}
97
98
98
99
#[ derive( Debug ) ]
@@ -274,6 +275,7 @@ impl Config {
274
275
statik : None ,
275
276
atleast_version : None ,
276
277
extra_args : vec ! [ ] ,
278
+ print_system_libs : true ,
277
279
cargo_metadata : true ,
278
280
}
279
281
}
@@ -308,6 +310,15 @@ impl Config {
308
310
self
309
311
}
310
312
313
+ /// Enable or disable the `PKG_CONFIG_ALLOW_SYSTEM_LIBS` environment
314
+ /// variable.
315
+ ///
316
+ /// This env var is enabled by default.
317
+ pub fn print_system_libs ( & mut self , print : bool ) -> & mut Config {
318
+ self . print_system_libs = print;
319
+ self
320
+ }
321
+
311
322
/// Deprecated in favor fo the `probe` function
312
323
#[ doc( hidden) ]
313
324
pub fn find ( & self , name : & str ) -> Result < Library , String > {
@@ -359,8 +370,11 @@ impl Config {
359
370
cmd. arg ( "--static" ) ;
360
371
}
361
372
cmd. args ( args)
362
- . args ( & self . extra_args )
363
- . env ( "PKG_CONFIG_ALLOW_SYSTEM_LIBS" , "1" ) ;
373
+ . args ( & self . extra_args ) ;
374
+
375
+ if self . print_system_libs {
376
+ cmd. env ( "PKG_CONFIG_ALLOW_SYSTEM_LIBS" , "1" ) ;
377
+ }
364
378
if let Some ( ref version) = self . atleast_version {
365
379
cmd. arg ( & format ! ( "{} >= {}" , name, version) ) ;
366
380
} else {
0 commit comments