From cddc7ca96ddefe7acabac845b4ec99cf72b3e6fc Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sat, 11 Feb 2023 14:47:30 +0000 Subject: [PATCH] Support compiling without posix_memalign() function Add NO_POSIX_MEMALIGN option in Makefile.libretro to support platform that don't provide the posix_memalign() function. Signed-off-by: Paul Cercueil --- Makefile | 3 ++- frontend/libretro.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6e9d10ca..3d33b8c8 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,8 @@ ifndef DEBUG CFLAGS += -O2 -DNDEBUG endif CFLAGS += -DHAVE_MMAP=$(if $(NO_MMAP),0,1) \ - -DHAVE_PTHREAD=$(if $(NO_PTHREAD),0,1) + -DHAVE_PTHREAD=$(if $(NO_PTHREAD),0,1) \ + -DHAVE_POSIX_MEMALIGN=$(if $(NO_POSIX_MEMALIGN),0,1) CXXFLAGS += $(CFLAGS) #DRC_DBG = 1 #PCNT = 1 diff --git a/frontend/libretro.c b/frontend/libretro.c index e5b21d52..64df7034 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -3037,7 +3037,7 @@ void retro_init(void) #ifdef _3DS vout_buf = linearMemAlign(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2, 0x80); -#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && !defined(VITA) && !defined(__SWITCH__) +#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && HAVE_POSIX_MEMALIGN if (posix_memalign(&vout_buf, 16, VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2) != 0) vout_buf = (void *) 0; #else -- 2.39.2