@@ -1549,10 +1549,10 @@ impl Build {
1549
1549
}
1550
1550
let host = self . get_host ( ) ?;
1551
1551
let target = self . get_target ( ) ?;
1552
- let ( env, msvc, gnu, traditional) = if self . cpp {
1553
- ( "CXX" , "cl.exe" , "g++" , "c++" )
1552
+ let ( env, msvc, gnu, traditional, clang ) = if self . cpp {
1553
+ ( "CXX" , "cl.exe" , "g++" , "c++" , "clang++" )
1554
1554
} else {
1555
- ( "CC" , "cl.exe" , "gcc" , "cc" )
1555
+ ( "CC" , "cl.exe" , "gcc" , "cc" , "clang" )
1556
1556
} ;
1557
1557
1558
1558
// On Solaris, c++/cc unlikely to exist or be correct.
@@ -1607,15 +1607,20 @@ impl Build {
1607
1607
format ! ( "{}.exe" , gnu)
1608
1608
}
1609
1609
} else if target. contains ( "android" ) {
1610
- format ! (
1611
- "{}-{}" ,
1612
- target
1613
- . replace( "armv7" , "arm" )
1614
- . replace( "armv7neon" , "arm" )
1615
- . replace( "thumbv7" , "arm" )
1616
- . replace( "thumbv7neon" , "arm" ) ,
1617
- gnu
1618
- )
1610
+ let target = target
1611
+ . replace ( "armv7" , "arm" )
1612
+ . replace ( "armv7neon" , "arm" )
1613
+ . replace ( "thumbv7" , "arm" )
1614
+ . replace ( "thumbv7neon" , "arm" ) ;
1615
+ let gnu_compiler = format ! ( "{}-{}" , target, gnu) ;
1616
+ let clang_compiler = format ! ( "{}-{}" , target, clang) ;
1617
+ // Check if gnu compiler is present
1618
+ // if not, use clang
1619
+ if Command :: new ( & gnu_compiler) . spawn ( ) . is_ok ( ) {
1620
+ gnu_compiler
1621
+ } else {
1622
+ clang_compiler
1623
+ }
1619
1624
} else if target. contains ( "cloudabi" ) {
1620
1625
format ! ( "{}-{}" , target, traditional)
1621
1626
} else if self . get_host ( ) ? != target {
0 commit comments