diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-17 12:12:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-10-17 12:12:15 +0200 |
commit | 9515084cf5282b856c0c55c0a877f2b72748f9f3 (patch) | |
tree | ed1280be7be19cf834269071bc6e24a2c405d794 /libbuild2/cc/pkgconfig.cxx | |
parent | 63b5b6416c6bde16560eb9b83a9e3122599369d5 (diff) |
Tolerate case differences when looking for pkg-config files
Diffstat (limited to 'libbuild2/cc/pkgconfig.cxx')
-rw-r--r-- | libbuild2/cc/pkgconfig.cxx | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/libbuild2/cc/pkgconfig.cxx b/libbuild2/cc/pkgconfig.cxx index 7f667f0..21cb5a5 100644 --- a/libbuild2/cc/pkgconfig.cxx +++ b/libbuild2/cc/pkgconfig.cxx @@ -182,28 +182,36 @@ namespace build2 // then you get something like zlib which calls it zlib.pc. So let's // just do it. // - f = dir; - f /= "lib"; - f += stem; - f += sfx; - f += ".pc"; - if (exists (f)) - return f; + // And as you think you've covered all the bases, someone decides to + // play with the case (libXau.* vs xau.pc). So let's also try the + // lower-case versions of the stem unless we are on a case-insensitive + // filesystem. + // + auto check = [&dir, & sfx, &f] (const string& n) + { + f = dir; + f /= n; + f += sfx; + f += ".pc"; + return exists (f); + }; - f = dir; - f /= stem; - f += sfx; - f += ".pc"; - if (exists (f)) + if (check ("lib" + stem) || check (stem)) return f; +#ifndef _WIN32 + string lstem (lcase (stem)); + + if (lstem != stem) + { + if (check ("lib" + lstem) || check (lstem)) + return f; + } +#endif + if (proj) { - f = dir; - f /= proj->string (); - f += sfx; - f += ".pc"; - if (exists (f)) + if (check (proj->string ())) return f; } @@ -248,7 +256,7 @@ namespace build2 } return r; - }; + } bool common:: pkgconfig_load (optional<action> act, |