aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/bin/guess.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-06-30 15:19:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-06-30 15:19:32 +0200
commit7bd4abd1a7f0a3d66cb1421ddf31200dc85ebb45 (patch)
tree578ba86b6569905383161598f7a35c60484870eb /libbuild2/bin/guess.cxx
parent0a52676ff3de5b302eb4fa85ed8440ae14281318 (diff)
Complete nm detection
Diffstat (limited to 'libbuild2/bin/guess.cxx')
-rw-r--r--libbuild2/bin/guess.cxx20
1 files changed, 17 insertions, 3 deletions
diff --git a/libbuild2/bin/guess.cxx b/libbuild2/bin/guess.cxx
index 92fc682..905bd0a 100644
--- a/libbuild2/bin/guess.cxx
+++ b/libbuild2/bin/guess.cxx
@@ -745,6 +745,12 @@ namespace build2
// Microsoft dumpbin.exe does not recogize --version but will still
// issue its standard banner (and even exit with zero status).
//
+ // FreeBSD uses nm from ELF Toolchain which recognizes --version.
+ //
+ // Mac OS X nm doesn't have an option to display version or help. If we
+ // run it without any arguments, then it looks for a.out. So there
+ // doesn't seem to be a way to detect it.
+ //
// Version extraction is a @@ TODO.
{
auto f = [] (string& l, bool) -> guess_result
@@ -764,6 +770,13 @@ namespace build2
if (l.compare (0, 14, "Microsoft (R) ") == 0)
return guess_result ("msvc", move (l), semantic_version ());
+ // nm --version from ELF Toolchain prints:
+ //
+ // nm (elftoolchain r3477M)
+ //
+ if (l.find ("elftoolchain") != string::npos)
+ return guess_result ("elftoolchain", move (l), semantic_version ());
+
return guess_result ();
};
@@ -777,10 +790,11 @@ namespace build2
r.checksum = cs.string ();
}
- //@@ TODO: BSD, Mac OS.
-
+ // Since there are some unrecognizable nm's (e.g., on Mac OS X), we will
+ // have to assume generic if we managed to find the executable.
+ //
if (r.empty ())
- fail << "unable to guess " << nm << " signature";
+ r = guess_result ("generic", "", semantic_version ());
return nm_cache.insert (move (key),
nm_info {