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

Ganesh Ajjanagadde gajjanagadde at gmail.com
Tue Sep 8 21:45:41 CEST 2015


On Tue, Sep 8, 2015 at 3:34 PM, Timothy Gu <timothygu99 at gmail.com> wrote:
> On Tue, Sep 8, 2015 at 12:18 PM Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> wrote:
>>
>>  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
>
>
> 1. This doesn't check for Windows.

This is not really the point; it is existence of tput that matters.
Windows is the best illustration of this, and hence I worded it that
way.

> 2. Not all Windows terminals support ANSI color codes.

This is what I could not test and was the subject of my caveat. Your
statement essentially shows that there is no easy way out. Yes; we
could check for the environments that do support these color codes;
but at this point I do not want to complicate configure further. If
anyone else is interested in expanding color stuff to such weird
platforms (tput is actually POSIX), feel free to work on it.

Meanwhile, I will create a patch for error message coloring in the
next few days.

Also, is there anything else people would like to see
colored/highlighted? Personally, I think coloring warnings and errors
is definitely an improvement; and is actually a sweet spot - more
highlighting can be distracting.

>
>>
>> +        bold_color=""
>> +        warn_color=$'\033[33;1m'
>> +        reset_color=$'\033[0m'
>>      fi
>>  fi
>
>
> Timtohy


More information about the ffmpeg-devel mailing list