meson: fix forkpty dependency detection

The forkpty check was compiled without including <pty.h>, 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 <pty.h> 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 <bjorn.andersson@oss.qualcomm.com>
This commit is contained in:
Bjorn Andersson
2026-07-05 18:29:05 +00:00
parent 1bead0f004
commit f08d673b01
+6 -4
View File
@@ -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 <pty.h>')
util_dep = compiler.find_library('util', required: false)
if util_dep.found()
cdbalib_deps += util_dep
endif
endif
drivers_srcs = ['drivers/alpaca.c',