]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: check slang headers only when slang library is found
authorKarel Zak <kzak@redhat.com>
Mon, 4 May 2026 12:15:45 +0000 (14:15 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 11 May 2026 09:05:41 +0000 (11:05 +0200)
The slcurses.h and slang*.h headers were detected unconditionally
in the generic header check loop. When the headers existed on the
system but slang was not actually used (ncurses preferred), irqtop
and cfdisk would include slcurses.h instead of ncurses.h, causing
build failures for ncurses-specific functions like vw_printw() and
resizeterm().

Move slang header checks after slang library detection, guarded by
lib_slang.found(), matching the autotools behavior where these
headers are only checked with --with-slang.

Signed-off-by: Karel Zak <kzak@redhat.com>
meson.build

index a3e4abdbfeec6ed178638db1ef30a4498dcfa213..785a9e94eb0256769a8146519a0257c671223e9e 100644 (file)
@@ -176,10 +176,6 @@ headers = '''
         ncursesw/term.h
         ncurses.h
         term.h
-        slang.h
-        slang/slang.h
-        slcurses.h
-        slang/slcurses.h
 '''.split()
 
 foreach header : headers
@@ -321,6 +317,12 @@ lib_slang = dependency(
   'slang',
   required : get_option('slang'))
 conf.set('HAVE_SLANG', lib_slang.found() ? 1 : false)
+if lib_slang.found()
+  foreach h : ['slang.h', 'slang/slang.h', 'slcurses.h', 'slang/slcurses.h']
+    have = cc.has_header(h)
+    conf.set('HAVE_' + h.underscorify().to_upper(), have ? 1 : false)
+  endforeach
+endif
 
 foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses]
   if curses_libs.found()