From 83b3141178282b11665c4485a33b9bc3e61d7c18 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 22 Jul 2024 00:31:11 +0300 Subject: v4l2: v4l2_compat: Fix ioctl() prototype with musl C library The musl C library, as well as the POSIX standard, define the ioctl() function's request argument as an int. glibc and uclibc, on the other hand, define it as an unsigned long. This difference between the function prototype and the implementation in the V4L2 adaptation layer causes a compilation error with musl. Fix it by detecting the function prototype and declaring the libcamera ioctl() handler accordingly. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder Signed-off-by: Kieran Bingham --- meson.build | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 3133e2b3..495addb2 100644 --- a/meson.build +++ b/meson.build @@ -90,6 +90,15 @@ if cc.has_header_symbol('sys/mman.h', 'memfd_create', prefix : '#define _GNU_SOU config_h.set('HAVE_MEMFD_CREATE', 1) endif +ioctl_posix_test = ''' +#include +int ioctl (int, int, ...); +''' + +if cc.compiles(ioctl_posix_test) + config_h.set('HAVE_POSIX_IOCTL', 1) +endif + if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix : '#define _GNU_SOURCE') config_h.set('HAVE_SECURE_GETENV', 1) endif -- cgit v1.2.1