+ for(HeaderList::const_iterator j=headers.begin(); j!=headers.end(); ++j)
+ all_found &= (builder.get_vfs().find_header(*j, 0, incpath, system)!=0);
+
+ if(all_found)
+ {
+ base_path = prefix;
+ builder.get_logger().log("configure", format("%s found in %s", name, ((system && use_pkgconfig) ? "system" : base_path.str())));
+ break;
+ }
+ }
+
+ if(base_path.empty())
+ {
+ // TODO report which files were not found
+ problems.push_back("Cannot locate files");
+ return;
+ }
+
+ /* Add default entries to paths if they're empty and the package was found
+ in a non-system location */
+ if(!system && export_binfo.incpath.empty())
+ export_binfo.incpath.push_back(base_path/"include");
+ if(!system && export_binfo.libpath.empty())
+ export_binfo.libpath.push_back(base_path/"lib");
+
+ if(has_relative_paths)
+ {
+ for(BuildInfo::PathList::iterator i=export_binfo.incpath.begin(); i!=export_binfo.incpath.end(); ++i)
+ *i = base_path/ *i;
+ for(BuildInfo::PathList::iterator i=export_binfo.libpath.begin(); i!=export_binfo.libpath.end(); ++i)
+ *i = base_path/ *i;
+ }
+
+ if(!static_binfo.libs.empty())
+ {
+ BuildInfo::PathList combined_libpath = static_binfo.libpath;
+ combined_libpath.insert(combined_libpath.end(), export_binfo.libpath.begin(), export_binfo.libpath.end());
+
+ Target::Dependencies static_dep_libs;
+ for(BuildInfo::WordList::const_iterator i=static_binfo.libs.begin(); i!=static_binfo.libs.end(); ++i)
+ if(Target *lib = builder.get_vfs().find_library(*i, combined_libpath, BuildInfo::STATIC, system))
+ static_dep_libs.push_back(lib);
+
+ for(BuildInfo::WordList::const_iterator i=export_binfo.libs.begin(); i!=export_binfo.libs.end(); ++i)
+ if(Target *lib = builder.get_vfs().find_library(*i, export_binfo.libpath, BuildInfo::FORCE_STATIC, system))
+ {
+ for(Target::Dependencies::const_iterator j=static_dep_libs.begin(); j!=static_dep_libs.end(); ++j)
+ lib->add_transitive_dependency(**j);
+ }
+ }