Hi,

On Wed, Jul 4, 2012 at 10:35 AM, Måns Rullgård <[email protected]> wrote:
> "Ronald S. Bultje" <[email protected]> writes:
>
>> From: "Ronald S. Bultje" <[email protected]>
>>
>> ---
>>  configure           |    9 +++++++++
>>  libavutil/x86/cpu.c |   14 ++++++++++++++
>>  2 files changed, 23 insertions(+)
>>
>> diff --git a/configure b/configure
>> index 35d4406..976b59d 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1062,6 +1062,7 @@ HAVE_LIST="
>>      cbrtf
>>      closesocket
>>      cmov
>> +    cpuid
>>      dcbzl
>>      dev_bktr_ioctl_bt848_h
>>      dev_bktr_ioctl_meteor_h
>> @@ -1095,6 +1096,7 @@ HAVE_LIST="
>>      immintrin_h
>>      inet_aton
>>      inline_asm
>> +    intrin_h
>>      io_h
>>      isatty
>>      isinf
>> @@ -2664,6 +2666,13 @@ int main (void) { _xgetbv(0); return 0; }
>>  EOF
>>  fi
>>
>> +if check_header intrin.h; then
>> +    check_cc <<EOF && enable cpuid
>> +#include <intrin.h>
>> +int main (void) { int info[4]; _cpuid(info, 0); return 0; }
>> +EOF
>> +fi
>
> What I said before about check_header applies here too.
>
> Seeing this rather repetitive code, I'm thinking perhaps we should add a
> new helper function:
>
> check_code(){
>     headers=$1
>     code=$2
>     shift 2
>     {
>         for hdr in $headers; do
>             echo "#include <$hdr>"
>         done
>         echo "int main(void) { $code; return 0; }"
>     } | check_ld "$@" && enable $funcs && enable_safe $headers
> }
>
> Then use it like this:
>
> check_code intrin.h "int info[4]; _cpuid(info, 0)" && enable cpuid

Go for it, sgtm.

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to