@@ -723,16 +723,39 @@ pub fn get_cc_prog(sess: Session) -> ~str {
723723 // It would be flexible to use cc (system's default C compiler)
724724 // instead of hard-coded gcc.
725725 // For win32, there is no cc command, so we add a condition to make it use gcc.
726+ match sess. targ_cfg . os {
727+ abi:: OsWin32 => return ~"gcc",
728+ _ => { } ,
729+ }
730+
731+ get_system_tool ( sess, "cc" )
732+ }
733+
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 {
726744 match sess. targ_cfg . os {
727745 abi:: OsAndroid => match sess. opts . android_cross_path {
728- Some ( ref path) => format ! ( "{}/bin/arm-linux-androideabi-gcc" , * 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+ }
729753 None => {
730- sess. fatal ( "need Android NDK path for linking \
731- (--android-cross-path)")
754+ sess. fatal ( format ! ( "need Android NDK path for the '{}' tool \
755+ (--android-cross-path)", tool ) )
732756 }
733757 } ,
734- abi:: OsWin32 => ~"gcc",
735- _ => ~"cc",
758+ _ => tool. to_owned ( ) ,
736759 }
737760}
738761
0 commit comments