Add support for musl
musl provides program_invocation_short_name like glibc, but does not
provide any #define __MUSL__. Assume program_invocation_short_name
exists for anything that is not darwin, bionic or windows.
Bug: 190084016
Test: m checkbuild
Change-Id: Ie2761fb7e1b3a5bf50b4a022ac97a4347719f8f2
diff --git a/logging.cpp b/logging.cpp
index 4942e2f..d36126a 100644
--- a/logging.cpp
+++ b/logging.cpp
@@ -62,11 +62,9 @@
namespace base {
// BSD-based systems like Android/macOS have getprogname(). Others need us to provide one.
-#if defined(__GLIBC__) || defined(_WIN32)
+#if !defined(__APPLE__) && !defined(__BIONIC__)
static const char* getprogname() {
-#if defined(__GLIBC__)
- return program_invocation_short_name;
-#elif defined(_WIN32)
+#ifdef _WIN32
static bool first = true;
static char progname[MAX_PATH] = {};
@@ -77,6 +75,8 @@
}
return progname;
+#else
+ return program_invocation_short_name;
#endif
}
#endif