[FFmpeg-devel] [PATCH] configure: colorize warnings on Windows
Ganesh Ajjanagadde
gajjanagadde at gmail.com
Tue Sep 8 21:22:04 CEST 2015
On Tue, Sep 8, 2015 at 3:17 PM, Ganesh Ajjanagadde
<gajjanagadde at gmail.com> wrote:
> 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
>
Should add a caveat: according to
https://en.wikipedia.org/wiki/ANSI_escape_code, these color codes are
not supported by the Win32 console. Like I said, I can't test this, so
if this does not work on windows, please ignore the patch.
More information about the ffmpeg-devel
mailing list