@@ -122,9 +122,9 @@ fn metadata_matches(&vec[u8] crate_data,
122
122
ret true;
123
123
}
124
124
125
- fn default_native_lib_naming( session:: session sess) ->
125
+ fn default_native_lib_naming( session:: session sess, bool static ) ->
126
126
rec( str prefix, str suffix) {
127
- if ( sess . get_opts ( ) . static ) {
127
+ if ( static ) {
128
128
ret rec( prefix="lib", suffix=". rlib") ;
129
129
}
130
130
alt ( sess. get_targ_cfg( ) . os) {
@@ -158,7 +158,20 @@ fn find_library_crate(&session::session sess, &ast::ident ident,
158
158
}
159
159
} ;
160
160
161
- auto nn = default_native_lib_naming( sess) ;
161
+ auto nn = default_native_lib_naming( sess, sess. get_opts( ) . static ) ;
162
+ auto x = find_library_crate_aux( nn, crate_name, metas,
163
+ library_search_paths) ;
164
+ if ( x != none || sess. get_opts( ) . static ) {
165
+ ret x;
166
+ }
167
+ auto nn2 = default_native_lib_naming( sess, true ) ;
168
+ ret find_library_crate_aux( nn2, crate_name, metas, library_search_paths) ;
169
+ }
170
+
171
+ fn find_library_crate_aux( & rec( str prefix, str suffix) nn, str crate_name,
172
+ & ( @ast:: meta_item) [ ] metas,
173
+ & vec[ str] library_search_paths) ->
174
+ option:: t[ tup( str, vec[ u8] ) ] {
162
175
let str prefix = nn. prefix + crate_name;
163
176
// FIXME: we could probably use a 'glob' function in std::fs but it will
164
177
// be much easier to write once the unsafe module knows more about FFI
0 commit comments