From 8886d84e25a457702b45194d69a47313f76dc6bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Wed, 27 Sep 2023 19:53:55 +0200 Subject: [PATCH] build-sys: only build col on glibc MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit col expects an EILSEQ failure of getwchar() to leave the undecoded data in the buffer to be read by a subsequent getchar(). This is not guaranteed by the standard and for example musl libc does not conform to this expectation. As col is deprecated anyways just disable it on non-glibc instead of fixing it. Signed-off-by: Thomas Weißschuh --- configure.ac | 3 ++- meson.build | 24 ++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 1c2cb4f0d3..615639c1cd 100644 --- a/configure.ac +++ b/configure.ac @@ -2160,7 +2160,8 @@ UL_REQUIRES_HAVE([scriptlive], [pty], [openpty function (libutil)]) AM_CONDITIONAL([BUILD_SCRIPTLIVE], [test "x$build_scriptlive" = xyes]) -UL_BUILD_INIT([col], [yes]) +UL_BUILD_INIT([col], [check]) +UL_REQUIRES_COMPILE([col], [#include ], [__GLIBC__], [building for glibc]) AM_CONDITIONAL([BUILD_COL], [test "x$build_col" = xyes]) UL_BUILD_INIT([colcrt], [yes]) diff --git a/meson.build b/meson.build index b1e4fcd108..281bda19e0 100644 --- a/meson.build +++ b/meson.build @@ -803,6 +803,8 @@ conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false) conf.set('PG_BELL', get_option('pg-bell') ? 1 : false) conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false) +is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__') + ############################################################ @@ -1120,16 +1122,18 @@ endif ############################################################ -exe = executable( - 'col', - col_sources, - include_directories : includes, - link_with : lib_common, - install_dir : usrbin_exec_dir, - install : true) -exes += exe -manadocs += ['text-utils/col.1.adoc'] -bashcompletions += ['col'] +if is_glibc + exe = executable( + 'col', + col_sources, + include_directories : includes, + link_with : lib_common, + install_dir : usrbin_exec_dir, + install : true) + exes += exe + manadocs += ['text-utils/col.1.adoc'] + bashcompletions += ['col'] +endif exe = executable( 'colcrt', -- 2.47.2