@@ -330,6 +330,30 @@ pub struct Deliverables {
330
330
}
331
331
332
332
impl Configure {
333
+ fn cross_compile_args ( & self ) -> Result < Vec < String > , Error > {
334
+ let mut args = Vec :: new ( ) ;
335
+ for name in [ "CC" , "FC" , "HOSTCC" ] {
336
+ if let Ok ( value) = std:: env:: var ( format ! ( "OPENBLAS_{}" , name) ) {
337
+ args. push ( format ! ( "{}={}" , name, value) ) ;
338
+ eprintln ! ( "{}={}" , name, value) ;
339
+ } else {
340
+ eprintln ! ( "not found {}" , name) ;
341
+ }
342
+ }
343
+ // for successful compile all 3 env-vars must be set
344
+ if !args. is_empty ( ) && args. len ( ) != 3 {
345
+ return Err ( Error :: MissingCrossCompileInfo ) ;
346
+ }
347
+ // optional flags
348
+ for name in [ "RANLIB" ] {
349
+ if let Ok ( value) = std:: env:: var ( format ! ( "OPENBLAS_{}" , name) ) {
350
+ args. push ( format ! ( "{}={}" , name, value) ) ;
351
+ eprintln ! ( "{}={}" , name, value) ;
352
+ }
353
+ }
354
+ Ok ( args)
355
+ }
356
+
333
357
fn make_args ( & self ) -> Vec < String > {
334
358
let mut args = Vec :: new ( ) ;
335
359
if self . no_static {
@@ -467,6 +491,7 @@ impl Configure {
467
491
. stdout ( out)
468
492
. stderr ( err)
469
493
. args ( & self . make_args ( ) )
494
+ . args ( & self . cross_compile_args ( ) ?)
470
495
. args ( [ "all" ] )
471
496
. env_remove ( "TARGET" )
472
497
. check_call ( )
0 commit comments