From: Paul Cercueil Date: Sat, 11 Feb 2023 14:47:30 +0000 (+0000) Subject: Support compiling without posix_memalign() function X-Git-Tag: r24~235 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cddc7ca96ddefe7acabac845b4ec99cf72b3e6fc;p=pcsx_rearmed.git 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 --- 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