]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: implement HAVE_PTY
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 13 Jun 2023 07:55:22 +0000 (09:55 +0200)
committerChristian Hesse <mail@eworm.de>
Wed, 14 Jun 2023 08:29:47 +0000 (10:29 +0200)
This conditional was never implemented in the meson config. Under
autotools, it is guarded by availability of headers and an option. I
didn't implement the option here.

Fixes #2310.

'!= false' is used because 'x == 1' is rejected by meson if 'x' is
false. OTOH, 'x != false' seems to work if 'x' is 1.

(cherry picked from commit 444753601c4c367ca395359ea74fe5c7b86ce56d)

meson.build

index 63d8fd67dd173e32882cb0846c40ca9414e1e2ef..6097088d81ff3a2425d58432ca1f818238bf2d55 100644 (file)
@@ -708,6 +708,9 @@ int main(void) {
 have = cc.compiles(code, name : 'using __progname')
 conf.set('HAVE___PROGNAME', have ? 1 : false)
 
+have = conf.get('HAVE_PTY_H') != false and conf.get('HAVE_SYS_SIGNALFD_H') != false
+conf.set('HAVE_PTY', have ? 1 : false)
+
 have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS')
 conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false)
 
@@ -2996,18 +2999,19 @@ exe = executable(
   link_with : lib_common)
 exes += exe
 
-# XXX: HAVE_PTY
-exe = executable(
-  'test_pty',
-  pty_session_c,
-  monotonic_c,
-  c_args : ['-DTEST_PROGRAM_PTY'],
-  include_directories : dir_include,
-  link_with : [lib_common],
-  dependencies : [lib_m,
-                  realtime_libs,
-                  lib_util])
-exes += exe
+if conf.get('HAVE_PTY') != false
+  exe = executable(
+    'test_pty',
+    pty_session_c,
+    monotonic_c,
+    c_args : ['-DTEST_PROGRAM_PTY'],
+    include_directories : dir_include,
+    link_with : [lib_common],
+    dependencies : [lib_m,
+                    realtime_libs,
+                    lib_util])
+  exes += exe
+endif
 
 # XXX: LINUX
 exe = executable(