diff --git a/meson.build b/meson.build index c182bad653..5c6439d2f7 100644 --- a/meson.build +++ b/meson.build @@ -962,6 +962,11 @@ if features['sixel'] sources += files('video/out/vo_sixel.c') endif +features += {'posix_shm': false} +if features['posix'] + features += {'posix_shm': cc.has_function('shm_open', prefix: '#include ')} +endif + spirv_cross = dependency('spirv-cross-c-shared', required: get_option('spirv-cross')) features += {'spirv-cross': spirv_cross.found()} if features['spirv-cross'] diff --git a/video/out/vo_kitty.c b/video/out/vo_kitty.c index 99bbc7092f..6a511c8c8e 100644 --- a/video/out/vo_kitty.c +++ b/video/out/vo_kitty.c @@ -22,7 +22,7 @@ #include #include -#include +#include "config.h" #if HAVE_POSIX #include @@ -34,7 +34,6 @@ #include #include -#include "config.h" #include "options/m_config.h" #include "osdep/terminal.h" #include "sub/osd.h" @@ -109,7 +108,7 @@ static bool resized; static void close_shm(struct priv *p) { -#if HAVE_POSIX +#if HAVE_POSIX_SHM if (p->buffer != NULL) { munmap(p->buffer, p->buffer_size); p->buffer = NULL; @@ -210,7 +209,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params) static int create_shm(struct vo *vo) { -#if HAVE_POSIX +#if HAVE_POSIX_SHM struct priv *p = vo->priv; p->shm_fd = shm_open(p->shm_path, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); if (p->shm_fd == -1) { @@ -344,7 +343,9 @@ static int preinit(struct vo *vo) struct sigaction sa; sa.sa_handler = handle_winch; sigaction(SIGWINCH, &sa, &saved_sigaction); +#endif +#if HAVE_POSIX_SHM if (p->opts.use_shm) { p->shm_path = talloc_asprintf(vo, "/mpv-kitty-%p", vo); int p_size = strlen(p->shm_path) - 1; diff --git a/wscript b/wscript index 1acba8a756..ab7ded7f8b 100644 --- a/wscript +++ b/wscript @@ -814,6 +814,11 @@ video_output_features = [ 'desc': 'drmIsKMS() function', 'deps': 'drm', 'func': check_pkg_config('libdrm', '>= 2.4.105'), + }, { + 'name': 'posix-shm', + 'desc': "POSIX shared memory API", + 'deps': 'posix', + 'func': check_statement('sys/mman.h', 'shm_open("",0,0)') } ]