From 21ae4c37b7112cafbd3f56f3d3511189bedc3f7b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 11 Mar 2025 21:04:20 +0000 Subject: [PATCH] build: Only use ANSI colour sequences if stdout is a terminal https://stackoverflow.com/a/10022396 --- configure.ac | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 9acab68f8..d0b659b56 100644 --- a/configure.ac +++ b/configure.ac @@ -31,12 +31,14 @@ term_bold="" term_red="" term_green="" term_restore="" -AS_CASE(["$TERM"], - [xterm*|vt220*], [ - term_bold="$(printf "\e@<:@1m")" - term_red="$(printf "\e@<:@22;31m")" - term_green="$(printf "\e@<:@22;32m")" - term_restore="$(printf "\e@<:@0m")" +AS_IF([test -t 1], [ + AS_CASE(["$TERM"], + [xterm*|vt220*], [ + term_bold="$(printf "\e@<:@1m")" + term_red="$(printf "\e@<:@22;31m")" + term_green="$(printf "\e@<:@22;32m")" + term_restore="$(printf "\e@<:@0m")" + ]) ]) m4_define([HEADING], [AS_ECHO