+ list<FS::Path> bases;
+
+ /* If we have any relative paths that need resolving, or we have no paths at
+ all and are not using pkg-config, look for files in prefix */
+ if(has_relative_paths || (!use_pkgconfig && export_binfo.libpath.empty() && export_binfo.incpath.empty()))
+ bases.push_back(builder.get_prefix());
+
+ // Always look in system locations
+ bases.push_back(FS::Path());
+
+ bool system = false;
+ for(list<FS::Path>::const_iterator i=bases.begin(); i!=bases.end(); ++i)
+ {
+ FS::Path prefix = *i;
+ system = prefix.empty();
+ if(system)
+ {
+ prefix = "/usr";
+ const Architecture &arch = builder.get_current_arch();
+ if(arch.is_cross())
+ prefix /= arch.get_cross_prefix();
+ }
+
+ BuildInfo::PathList libpath = export_binfo.libpath;
+ if(!system && libpath.empty())
+ libpath.push_back("lib");
+ for(BuildInfo::PathList::iterator j=libpath.begin(); j!=libpath.end(); ++j)
+ *j = prefix/ *j;
+
+ bool all_found = true;
+ for(BuildInfo::WordList::const_iterator j=export_binfo.libs.begin(); j!=export_binfo.libs.end(); ++j)
+ all_found &= (builder.get_vfs().find_library(*j, libpath, export_binfo.libmode, system)!=0);
+
+ BuildInfo::PathList incpath = export_binfo.incpath;
+ if(!system && incpath.empty())
+ incpath.push_back("include");
+ for(BuildInfo::PathList::iterator j=incpath.begin(); j!=incpath.end(); ++j)
+ *j = prefix/ *j;
+
+ for(HeaderList::const_iterator j=headers.begin(); j!=headers.end(); ++j)
+ all_found &= (builder.get_vfs().find_header(*j, incpath, system)!=0);