@@ -330,6 +330,30 @@ pub struct Deliverables {
330330}
331331
332332impl 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+
333357 fn make_args ( & self ) -> Vec < String > {
334358 let mut args = Vec :: new ( ) ;
335359 if self . no_static {
@@ -467,6 +491,7 @@ impl Configure {
467491 . stdout ( out)
468492 . stderr ( err)
469493 . args ( & self . make_args ( ) )
494+ . args ( & self . cross_compile_args ( ) ?)
470495 . args ( [ "all" ] )
471496 . env_remove ( "TARGET" )
472497 . check_call ( )
0 commit comments