[FFmpeg-devel] [PATCH] configure: colorize warnings on Windows

Ganesh Ajjanagadde gajjanagadde at gmail.com
Tue Sep 8 21:17:30 CEST 2015


Previous color support relies on existence of tput.
Unfortunately, tput is not available on windows.
According to
https://stackoverflow.com/questions/19710074/tput-color-definitions-for-windows-git-shell,
using ANSI color codes for Windows should be safe.
Thus, tput is used whenever possible; and falls back to ANSI codes when it is unavailable.

Untested on Windows.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 configure | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index cd0c22a..99e1cc4 100755
--- a/configure
+++ b/configure
@@ -416,12 +416,18 @@ EOF
 }
 
 quotes='""'
-if test -t 1 && which tput >/dev/null; then
-    ncolors=$(tput colors)
-    if test -n "$ncolors" && test $ncolors -ge 8; then
-        bold_color=$(tput bold)
-        warn_color=$(tput setaf 3)
-        reset_color=$(tput sgr0)
+if test -t 1; then
+    if which tput >/dev/null; then
+        ncolors=$(tput colors)
+        if test -n "$ncolors" && test $ncolors -ge 8; then
+            bold_color=$(tput bold)
+            warn_color=$(tput setaf 3)
+            reset_color=$(tput sgr0)
+        fi
+    else
+        bold_color=""
+        warn_color=$'\033[33;1m'
+        reset_color=$'\033[0m'
     fi
 fi
 
-- 
2.5.1



More information about the ffmpeg-devel mailing list