diff mbox

[FFmpeg-devel] Added require fallback for libmfx in the case that pkg-config cannot find libmfx

Message ID 39dd74f3-28fc-4b59-ada3-77ac7f645cfc@aracnet.com
State Superseded
Headers show

Commit Message

Aaron Levinson April 15, 2017, 1:51 a.m. UTC
From e0c73c054add0137901d0bf7a7893e42e7e566c8 Mon Sep 17 00:00:00 2001
From: Aaron Levinson <alevinsn@aracnet.com>
Date: Fri, 14 Apr 2017 18:38:37 -0700
Subject: [PATCH] Added require fallback for libmfx in the case that
 pkg-config cannot find libmfx

Purpose: Added require fallback for libmfx in the case that pkg-config
cannot find libmfx.  On Linux, most people likely get libmfx via
https://github.com/lu-zero/mfx_dispatch , but on Windows, the most
well-known way to get libmfx is via the Intel Media SDK, which
provides a static build of libmfx.lib and also provides the source
code for building libmfx yourself.  If built this way, there are no
pkg-config files to be found.  The changes utilize a similar approach
to that already done for libx264 in configure.

Comments:

-- configure: Altered enabled libmfx step to use use_pkg_config()
   instead of require_pkg_config(), and, if use_pkg_config() fails, it
   falls back to require().  Note that the reason that require() is
   passed -llibmfx as the last argument, instead of -lmfx, is the file
   name for the library produced from the Intel Media SDK starts with
   "libmfx".  Apparently, the filename for the library produced via
   https://github.com/lu-zero/mfx_dispatch starts with "mfx".
---
 configure | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ricardo Constantino April 15, 2017, 11:25 a.m. UTC | #1
On 15 April 2017 at 02:51, Aaron Levinson <alevinsn@aracnet.com> wrote:

> From e0c73c054add0137901d0bf7a7893e42e7e566c8 Mon Sep 17 00:00:00 2001
> From: Aaron Levinson <alevinsn@aracnet.com>
> Date: Fri, 14 Apr 2017 18:38:37 -0700
> Subject: [PATCH] Added require fallback for libmfx in the case that
>  pkg-config cannot find libmfx
>
> Purpose: Added require fallback for libmfx in the case that pkg-config
> cannot find libmfx.  On Linux, most people likely get libmfx via
> https://github.com/lu-zero/mfx_dispatch , but on Windows, the most
> well-known way to get libmfx is via the Intel Media SDK, which
> provides a static build of libmfx.lib and also provides the source
> code for building libmfx yourself.  If built this way, there are no
> pkg-config files to be found.  The changes utilize a similar approach
> to that already done for libx264 in configure.
>
> Comments:
>
> -- configure: Altered enabled libmfx step to use use_pkg_config()
>    instead of require_pkg_config(), and, if use_pkg_config() fails, it
>    falls back to require().  Note that the reason that require() is
>    passed -llibmfx as the last argument, instead of -lmfx, is the file
>    name for the library produced from the Intel Media SDK starts with
>    "libmfx".  Apparently, the filename for the library produced via
>    https://github.com/lu-zero/mfx_dispatch starts with "mfx".
> ---
>  configure | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 3bea057..b20a0b4 100755
> --- a/configure
> +++ b/configure
> @@ -5819,7 +5819,8 @@ enabled libgsm            && { for gsm_hdr in
> "gsm.h" "gsm/gsm.h"; do
>                                 done || die "ERROR: libgsm not found"; }
>  enabled libilbc           && require libilbc ilbc.h
> WebRtcIlbcfix_InitDecode -lilbc
>  enabled libkvazaar        && require_pkg_config "kvazaar >= 0.8.1"
> kvazaar.h kvz_api_get
> -enabled libmfx            && require_pkg_config libmfx "mfx/mfxvideo.h"
> MFXInit
> +enabled libmfx            && { use_pkg_config libmfx "mfx/mfxvideo.h"
> MFXInit ||
> +                               { require libmfx "mfx/mfxvideo.h" MFXInit
> -llibmfx && warn "using libmfx without pkg-config"; } }
>
Needs a '|| die "ERROR: libmfx not found";' before the last curly bracket
or it won't complain about not finding libmfx if enabled.


>  enabled libmodplug        && require_pkg_config libmodplug
> libmodplug/modplug.h ModPlug_Load
>  enabled libmp3lame        && require "libmp3lame >= 3.98.3" lame/lame.h
> lame_set_VBR_quality -lmp3lame
>  enabled libnut            && require libnut libnut.h nut_demuxer_init
> -lnut
> --
> 2.10.1.windows.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Aaron Levinson April 15, 2017, 12:41 p.m. UTC | #2
On 4/15/2017 4:25 AM, Ricardo Constantino wrote:
> On 15 April 2017 at 02:51, Aaron Levinson <alevinsn@aracnet.com> wrote:
> 
>> From e0c73c054add0137901d0bf7a7893e42e7e566c8 Mon Sep 17 00:00:00 2001
>> From: Aaron Levinson <alevinsn@aracnet.com>
>> Date: Fri, 14 Apr 2017 18:38:37 -0700
>> Subject: [PATCH] Added require fallback for libmfx in the case that
>>  pkg-config cannot find libmfx
>>
>> Purpose: Added require fallback for libmfx in the case that pkg-config
>> cannot find libmfx.  On Linux, most people likely get libmfx via
>> https://github.com/lu-zero/mfx_dispatch , but on Windows, the most
>> well-known way to get libmfx is via the Intel Media SDK, which
>> provides a static build of libmfx.lib and also provides the source
>> code for building libmfx yourself.  If built this way, there are no
>> pkg-config files to be found.  The changes utilize a similar approach
>> to that already done for libx264 in configure.
>>
>> Comments:
>>
>> -- configure: Altered enabled libmfx step to use use_pkg_config()
>>    instead of require_pkg_config(), and, if use_pkg_config() fails, it
>>    falls back to require().  Note that the reason that require() is
>>    passed -llibmfx as the last argument, instead of -lmfx, is the file
>>    name for the library produced from the Intel Media SDK starts with
>>    "libmfx".  Apparently, the filename for the library produced via
>>    https://github.com/lu-zero/mfx_dispatch starts with "mfx".
>> ---
>>  configure | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 3bea057..b20a0b4 100755
>> --- a/configure
>> +++ b/configure
>> @@ -5819,7 +5819,8 @@ enabled libgsm            && { for gsm_hdr in
>> "gsm.h" "gsm/gsm.h"; do
>>                                 done || die "ERROR: libgsm not found"; }
>>  enabled libilbc           && require libilbc ilbc.h
>> WebRtcIlbcfix_InitDecode -lilbc
>>  enabled libkvazaar        && require_pkg_config "kvazaar >= 0.8.1"
>> kvazaar.h kvz_api_get
>> -enabled libmfx            && require_pkg_config libmfx "mfx/mfxvideo.h"
>> MFXInit
>> +enabled libmfx            && { use_pkg_config libmfx "mfx/mfxvideo.h"
>> MFXInit ||
>> +                               { require libmfx "mfx/mfxvideo.h" MFXInit
>> -llibmfx && warn "using libmfx without pkg-config"; } }
>>
> Needs a '|| die "ERROR: libmfx not found";' before the last curly bracket
> or it won't complain about not finding libmfx if enabled.

Doesn't require() already do that?  Here is the contents of require():

require(){
    log require "$@"
    name_version="$1"
    headers="$2"
    func="$3"
    shift 3
    check_lib "$headers" $func "$@" || die "ERROR: $name_version not found"
}

Aaron
Ricardo Constantino April 15, 2017, 2 p.m. UTC | #3
On 15 April 2017 at 13:41, Aaron Levinson <alevinsn@aracnet.com> wrote:

> Doesn't require() already do that?  Here is the contents of require():
>
> require(){
>     log require "$@"
>     name_version="$1"
>     headers="$2"
>     func="$3"
>     shift 3
>     check_lib "$headers" $func "$@" || die "ERROR: $name_version not found"
> }


Right. Desregard my comment.
Aaron Levinson April 19, 2017, 5:43 p.m. UTC | #4
On 4/14/2017 6:51 PM, Aaron Levinson wrote:
> From e0c73c054add0137901d0bf7a7893e42e7e566c8 Mon Sep 17 00:00:00 2001
> From: Aaron Levinson <alevinsn@aracnet.com>
> Date: Fri, 14 Apr 2017 18:38:37 -0700
> Subject: [PATCH] Added require fallback for libmfx in the case that
>  pkg-config cannot find libmfx
>
> Purpose: Added require fallback for libmfx in the case that pkg-config
> cannot find libmfx.  On Linux, most people likely get libmfx via
> https://github.com/lu-zero/mfx_dispatch , but on Windows, the most
> well-known way to get libmfx is via the Intel Media SDK, which
> provides a static build of libmfx.lib and also provides the source
> code for building libmfx yourself.  If built this way, there are no
> pkg-config files to be found.  The changes utilize a similar approach
> to that already done for libx264 in configure.
>
> Comments:
>
> -- configure: Altered enabled libmfx step to use use_pkg_config()
>    instead of require_pkg_config(), and, if use_pkg_config() fails, it
>    falls back to require().  Note that the reason that require() is
>    passed -llibmfx as the last argument, instead of -lmfx, is the file
>    name for the library produced from the Intel Media SDK starts with
>    "libmfx".  Apparently, the filename for the library produced via
>    https://github.com/lu-zero/mfx_dispatch starts with "mfx".
> ---
>  configure | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 3bea057..b20a0b4 100755
> --- a/configure
> +++ b/configure
> @@ -5819,7 +5819,8 @@ enabled libgsm            && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
>                                 done || die "ERROR: libgsm not found"; }
>  enabled libilbc           && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
>  enabled libkvazaar        && require_pkg_config "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
> -enabled libmfx            && require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit
> +enabled libmfx            && { use_pkg_config libmfx "mfx/mfxvideo.h" MFXInit ||
> +                               { require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx && warn "using libmfx without pkg-config"; } }
>  enabled libmodplug        && require_pkg_config libmodplug libmodplug/modplug.h ModPlug_Load
>  enabled libmp3lame        && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
>  enabled libnut            && require libnut libnut.h nut_demuxer_init -lnut
>

Pinging this patch submission again.

Thanks,
Aaron Levinson
diff mbox

Patch

diff --git a/configure b/configure
index 3bea057..b20a0b4 100755
--- a/configure
+++ b/configure
@@ -5819,7 +5819,8 @@  enabled libgsm            && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
                                done || die "ERROR: libgsm not found"; }
 enabled libilbc           && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
 enabled libkvazaar        && require_pkg_config "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
-enabled libmfx            && require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit
+enabled libmfx            && { use_pkg_config libmfx "mfx/mfxvideo.h" MFXInit ||
+                               { require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx && warn "using libmfx without pkg-config"; } }
 enabled libmodplug        && require_pkg_config libmodplug libmodplug/modplug.h ModPlug_Load
 enabled libmp3lame        && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
 enabled libnut            && require libnut libnut.h nut_demuxer_init -lnut