[FFmpeg-devel] [PATCH] configure: fix clang-cl detection

Hendrik Leppkes h.leppkes at gmail.com
Thu Apr 19 12:13:17 EEST 2018


On Wed, Apr 18, 2018 at 11:08 AM, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
> On Thu, Feb 1, 2018 at 11:52 AM, Alexander Bilyak
> <bilyak.alexander at gmail.com> wrote:
>> When using clang-cl it expects parameters passed in MSVC-style, so appropriate toolchain should be selected.
>> As soon as both clang and clang-cl report themselfs as "clang" with -v option the only chance to detect
>> clang-cl is passing -? option to both which is valid for clang-cl.exe and not for clang.exe.
>> ---
>>  configure | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/configure b/configure
>> index fcfa7aa442..f8c55876e5 100755
>> --- a/configure
>> +++ b/configure
>> @@ -4216,7 +4216,7 @@ probe_cc(){
>>          _depflags='-MMD'
>>          _cflags_speed='-O3'
>>          _cflags_size='-Os'
>> -    elif $_cc -v 2>&1 | grep -q clang; then
>> +    elif $_cc -v 2>&1 | grep -q clang && ! $_cc -? > /dev/null 2>&1; then
>>          _type=clang
>>          _ident=$($_cc --version 2>/dev/null | head -n1)
>>          _depflags='-MMD -MF $(@:.o=.d) -MT $@'
>> @@ -4287,7 +4287,7 @@ probe_cc(){
>>          _flags_filter=msvc_flags
>>          _ld_lib='lib%.a'
>>          _ld_path='-libpath:'
>> -    elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
>> +    elif $_cc -nologo- 2>&1 | grep -q Microsoft || $_cc -v 2>&1 | grep -q clang && $_cc -? > /dev/null 2>&1; then
>>          _type=msvc
>>          _ident=$($_cc 2>&1 | head -n1)
>>          _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
>
>
> This patch entirely broke building with MSVC on Windows. The reason
> for that is that "cl.exe -?" outputs paginated help output that
> requires user input to continue.
> I'm going to revert this soon, unless a fix is submitted before that.
>

For the record, I pushed a patch to fix this instead, after I figured
out why this was happening.

- Hendrik


More information about the ffmpeg-devel mailing list