@@ -724,32 +724,39 @@ pub fn get_cc_prog(sess: Session) -> ~str {
724
724
// instead of hard-coded gcc.
725
725
// For win32, there is no cc command, so we add a condition to make it use gcc.
726
726
match sess. targ_cfg . os {
727
- abi:: OsAndroid => match sess. opts . android_cross_path {
728
- Some ( ref path) => format ! ( "{}/bin/arm-linux-androideabi-gcc" , * path) ,
729
- None => {
730
- sess. fatal ( "need Android NDK path for linking \
731
- (--android-cross-path)")
732
- }
733
- } ,
734
- abi:: OsWin32 => ~"gcc",
735
- _ => ~"cc",
727
+ abi:: OsWin32 => return ~"gcc",
728
+ _ => { } ,
736
729
}
730
+
731
+ get_system_tool ( sess, "cc" )
737
732
}
738
733
739
734
pub fn get_ar_prog ( sess : Session ) -> ~str {
735
+ match sess. opts . ar {
736
+ Some ( ref ar) => return ar. to_owned ( ) ,
737
+ None => { }
738
+ }
739
+
740
+ get_system_tool ( sess, "ar" )
741
+ }
742
+
743
+ fn get_system_tool ( sess : Session , tool : & str ) -> ~str {
740
744
match sess. targ_cfg . os {
741
745
abi:: OsAndroid => match sess. opts . android_cross_path {
742
- Some ( ref path) => format ! ( "{}/bin/arm-linux-androideabi-ar" , * path) ,
746
+ Some ( ref path) => {
747
+ let tool_str = match tool {
748
+ "cc" => "gcc" ,
749
+ _ => tool
750
+ } ;
751
+ format ! ( "{}/bin/arm-linux-androideabi-{}" , * path, tool_str)
752
+ }
743
753
None => {
744
- sess. fatal ( "need Android NDK path for linking \
745
- (--android-cross-path)")
754
+ sess. fatal ( format ! ( "need Android NDK path for the '{}' tool \
755
+ (--android-cross-path)", tool ) )
746
756
}
747
757
} ,
748
- _ => match sess. opts . ar {
749
- Some ( ref ar) => format ! ( "{}" , * ar) ,
750
- None => ~"ar"
751
- } ,
752
- }
758
+ _ => tool. to_owned ( ) ,
759
+ }
753
760
}
754
761
755
762
/// Perform the linkage portion of the compilation phase. This will generate all
0 commit comments