From f08d673b019ff6efebbbdbee1adcdd54a3b821ea Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Sun, 5 Jul 2026 17:46:35 +0000 Subject: [PATCH] meson: fix forkpty dependency detection The forkpty check was compiled without including , which is the header that declares the function. On stricter toolchains, and in some cross builds, that can make Meson conclude that forkpty is not available from libc even when the target provides it there. The fallback then looked for a separate libutil as a required library. That breaks modern glibc targets where forkpty moved into libc and no separate libutil is available for Meson to find. Include in the function probe so libc implementations are detected correctly. Keep libutil as an optional compatibility fallback for older targets that still need it, without failing configuration when the separate library is absent. Signed-off-by: Bjorn Andersson --- meson.build | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index cd9c7ad..06e532f 100644 --- a/meson.build +++ b/meson.build @@ -59,10 +59,12 @@ cdbalib_deps = [dependency('libudev', required: server_opt), gpiod_dep, ftdi_dep] -# E.g. Debian reuires -lutil for forkpty -if not compiler.has_function('forkpty') - util_dep = compiler.find_library('util') - cdbalib_deps += util_dep +# E.g. Debian requires -lutil for forkpty +if not compiler.has_function('forkpty', prefix: '#include ') + util_dep = compiler.find_library('util', required: false) + if util_dep.found() + cdbalib_deps += util_dep + endif endif drivers_srcs = ['drivers/alpaca.c',