From 4632fe8cd90433c50fe74c613d982b676feb1993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 26 Sep 2022 23:23:54 +0800 Subject: [PATCH] Android: fix compiling --- CMakeLists.txt | 5 +++++ src/detection/font/font_android.c | 1 + src/modules/users.c | 10 +++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f28620b3c..6e98032b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,6 +338,11 @@ if(HAVE_SYSINFO_H) target_compile_definitions(libfastfetch PUBLIC FF_HAVE_SYSINFO_H) endif() +CHECK_INCLUDE_FILE("utmpx.h" HAVE_UTMPX_H) +if(HAVE_UTMPX_H) + target_compile_definitions(libfastfetch PRIVATE FF_HAVE_UTMPX_H) +endif() + function(ff_lib_enable VARNAME) if(NOT ENABLE_${VARNAME}) return() diff --git a/src/detection/font/font_android.c b/src/detection/font/font_android.c index 1719c7511..3f8578b81 100644 --- a/src/detection/font/font_android.c +++ b/src/detection/font/font_android.c @@ -1,3 +1,4 @@ +#include "fastfetch.h" #include "common/font.h" const char* ffDetectFontImpl(FFinstance* instance, FFlist* result) diff --git a/src/modules/users.c b/src/modules/users.c index 880b14c35..ec1265338 100644 --- a/src/modules/users.c +++ b/src/modules/users.c @@ -1,7 +1,15 @@ #include "fastfetch.h" #include "common/printing.h" -#include +#if FF_HAVE_UTMPX_H + #include +#else + //for Android compatibility + #include + #define utmpx utmp + #define setutxent setutent + #define getutxent getutent +#endif #define FF_USERS_MODULE_NAME "Users" #define FF_USERS_NUM_FORMAT_ARGS 1