diff --git a/CMakeLists.txt b/CMakeLists.txt index d461a209e..a4e49c373 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -630,11 +630,6 @@ if(WIN32) target_compile_definitions(libfastfetch PUBLIC WIN32_LEAN_AND_MEAN=1) endif() -CHECK_INCLUDE_FILE("utmpx.h" HAVE_UTMPX_H) -if(HAVE_UTMPX_H) - target_compile_definitions(libfastfetch PRIVATE FF_HAVE_UTMPX_H) -endif() - if(HAVE_WCWIDTH) target_compile_definitions(libfastfetch PRIVATE FF_HAVE_WCWIDTH) endif() @@ -829,6 +824,20 @@ elseif(BSD) target_link_libraries(libfastfetch PRIVATE "usbhid" ) +elseif(ANDROID) + CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC) + if(HAVE_LIBANDROID_WORDEXP_STATIC) + target_link_libraries(libfastfetch + PRIVATE -l:libandroid-wordexp.a + ) + else() + CHECK_LIBRARY_EXISTS(android-wordexp wordexp "" HAVE_LIBANDROID_WORDEXP) + if(HAVE_LIBANDROID_WORDEXP) + target_link_libraries(libfastfetch + PRIVATE android-wordexp + ) + endif() + endif() endif() target_include_directories(libfastfetch diff --git a/src/common/io/io_unix.c b/src/common/io/io_unix.c index d1e635e11..1941e6637 100644 --- a/src/common/io/io_unix.c +++ b/src/common/io/io_unix.c @@ -1,12 +1,16 @@ #include "io.h" #include "util/stringUtils.h" +#include "util/unused.h" #include #include #include #include #include + +#if __has_include() #include +#endif static void createSubfolders(const char* fileName) { @@ -108,9 +112,12 @@ bool ffPathExists(const char* path, FFPathType type) return false; } -bool ffPathExpandEnv(const char* in, FFstrbuf* out) +bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* out) { bool result = false; + + #if __has_include() // https://github.com/termux/termux-packages/pull/7056 + wordexp_t exp; if(wordexp(in, &exp, WRDE_NOCMD) != 0) return false; @@ -123,6 +130,8 @@ bool ffPathExpandEnv(const char* in, FFstrbuf* out) wordfree(&exp); + #endif + return result; } diff --git a/src/detection/users/users_linux.c b/src/detection/users/users_linux.c index 3b4963a14..c17bf139c 100644 --- a/src/detection/users/users_linux.c +++ b/src/detection/users/users_linux.c @@ -1,7 +1,7 @@ #include "fastfetch.h" #include "users.h" -#if FF_HAVE_UTMPX_H +#if __has_include() #include #else //for Android compatibility