+#include <limits>
#include <msp/core/algorithm.h>
#include <msp/io/print.h>
#include <msp/strings/utils.h>
bases.push_back(FS::Path());
bool system = false;
+ unsigned least_missing = numeric_limits<unsigned>::max();
+ string missing_name;
for(const FS::Path &b: bases)
{
FS::Path prefix = b;
for(FS::Path &p: libpath)
p = prefix/p;
- bool all_found = true;
+ unsigned missing_count = 0;
+ string first_missing;
for(const string &l: export_binfo.libs)
- all_found &= (builder.get_vfs().find_library(l, libpath, export_binfo.libmode, system)!=0);
+ if(!builder.get_vfs().find_library(l, libpath, export_binfo.libmode, system))
+ if(!missing_count++)
+ first_missing = format("library %s", l);
VirtualFileSystem::SearchPath incpath = export_binfo.incpath;
if(!system && incpath.empty())
p = prefix/p;
for(const string &h: headers)
- all_found &= (builder.get_vfs().find_header(h, 0, incpath, system)!=0);
+ if(!builder.get_vfs().find_header(h, 0, incpath, system))
+ if(!missing_count++)
+ first_missing = h;
- if(all_found)
+ if(!missing_count)
{
base_path = prefix;
builder.get_logger().log("configure", "%s found in %s", name, ((system && use_pkgconfig) ? "system" : base_path.str()));
break;
}
+ else if(missing_count<least_missing)
+ {
+ least_missing = missing_count;
+ missing_name = first_missing;
+ }
}
if(base_path.empty())
{
- // TODO report which files were not found
- builder.get_logger().log("problems", "Cannot locate files for %s", name);
- problems.push_back("Cannot locate files");
+ string missing_descr = (least_missing>1 ? format("%s and %d other files", missing_name, least_missing-1) : missing_name);
+ builder.get_logger().log("problems", "Cannot locate %s for %s", missing_descr, name);
+ problems.push_back(format("Cannot locate %s", missing_descr));
return;
}