mirror of https://github.com/mgba-emu/mgba.git
NetBSD build fixes (#2366)
This commit is contained in:
parent
c3746d629f
commit
eeeefa4532
|
@ -320,6 +320,8 @@ find_function(setlocale)
|
|||
find_function(snprintf_l)
|
||||
find_function(uselocale)
|
||||
|
||||
find_function(popcount32)
|
||||
|
||||
find_function(futimens)
|
||||
find_function(futimes)
|
||||
|
||||
|
@ -368,7 +370,7 @@ if(USE_PTHREADS)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_NEWLOCALE AND HAVE_FREELOCALE AND HAVE_USELOCALE OR APPLE)
|
||||
if(HAVE_NEWLOCALE AND HAVE_FREELOCALE OR APPLE)
|
||||
list(APPEND FUNCTION_DEFINES HAVE_LOCALE)
|
||||
if (HAVE_SNPRINTF_L)
|
||||
list(APPEND FUNCTION_DEFINES HAVE_SNPRINTF_L)
|
||||
|
|
|
@ -10,11 +10,13 @@
|
|||
|
||||
CXX_GUARD_START
|
||||
|
||||
#ifndef HAVE_POPCOUNT32
|
||||
static inline uint32_t popcount32(unsigned bits) {
|
||||
bits = bits - ((bits >> 1) & 0x55555555);
|
||||
bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
|
||||
return (((bits + (bits >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline unsigned clz32(uint32_t bits) {
|
||||
#if defined(__GNUC__) || __clang__
|
||||
|
|
|
@ -94,6 +94,8 @@ static inline int ThreadSetName(const char* name) {
|
|||
#elif defined(__HAIKU__)
|
||||
rename_thread(find_thread(NULL), name);
|
||||
return 0;
|
||||
#elif defined(__NetBSD__)
|
||||
return pthread_setname_np(pthread_self(), "%s", (void *) name);
|
||||
#elif defined(HAVE_PTHREAD_SETNAME_NP)
|
||||
return pthread_setname_np(pthread_self(), name);
|
||||
#else
|
||||
|
|
|
@ -119,4 +119,10 @@
|
|||
#cmakedefine USE_ZLIB
|
||||
#endif
|
||||
|
||||
// HAVE flags
|
||||
|
||||
#ifndef HAVE_POPCOUNT32
|
||||
#cmakedefine HAVE_POPCOUNT32
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
int ftostr_l(char* restrict str, size_t size, float f, locale_t locale) {
|
||||
#ifdef HAVE_SNPRINTF_L
|
||||
return snprintf_l(str, size, locale, "%.*g", FLT_DIG, f);
|
||||
#elif defined(HAVE_LOCALE)
|
||||
#elif defined(HAVE_USELOCALE)
|
||||
locale_t old = uselocale(locale);
|
||||
int res = snprintf(str, size, "%.*g", FLT_DIG, f);
|
||||
uselocale(old);
|
||||
|
@ -28,7 +28,7 @@ int ftostr_l(char* restrict str, size_t size, float f, locale_t locale) {
|
|||
|
||||
#ifndef HAVE_STRTOF_L
|
||||
float strtof_l(const char* restrict str, char** restrict end, locale_t locale) {
|
||||
#ifdef HAVE_LOCALE
|
||||
#ifdef HAVE_USELOCALE
|
||||
locale_t old = uselocale(locale);
|
||||
float res = strtof(str, end);
|
||||
uselocale(old);
|
||||
|
|
Loading…
Reference in New Issue