[FFmpeg-devel] [PATCH] Enhanced require_pkg_config() in configure to fallback to require() if pkg-config is missing
Aaron Levinson
alevinsn at aracnet.com
Sat Apr 15 03:03:47 EEST 2017
On 4/14/2017 1:09 AM, Hendrik Leppkes wrote:
> On Fri, Apr 14, 2017 at 2:56 AM, Aaron Levinson <alevinsn at aracnet.com> wrote:
>> From 48f7daba16e0fcdb83d9abd254800c7b9f4ab684 Mon Sep 17 00:00:00 2001
>> From: Aaron Levinson <alevinsn at aracnet.com>
>> Date: Thu, 13 Apr 2017 17:30:47 -0700
>> Subject: [PATCH] Enhanced require_pkg_config() in configure to fallback to require() if pkg-config is missing
>>
>> Purpose: Enhanced require_pkg_config() in configure to
>> fallback to require() if pkg-config is missing
>>
>> Notes: This is likely mainly of relevance when building with MSVC on
>> Windows. In my case, I used this approach to get libmfx when invoking
>> configure with --enable-libmfx, which is used for QuickSync (QSV).
>>
>> Comments:
>>
>> -- configure: Enhanced require_pkg_config() function to first check if
>> $pkg_config is not false. If not false, it goes through the
>> standard steps of calling use_pkg_config(), but if false, it issues
>> a log message and then calls require() with all the inputted
>> arguments and an additional argument: -l$1. So, for something like
>> "require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit", this becomes
>> "require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx". This is not a
>> perfect solution, but the previous approach didn't work at all
>> before when require_pkg_config() is used.
>> ---
>> configure | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 7f2b653..ad08b82 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1347,7 +1347,12 @@ use_pkg_config(){
>> }
>>
>> require_pkg_config(){
>> - use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message"
>> + if test $pkg_config != false; then
>> + use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message"
>> + else
>> + log require_pkg_config "No pkg-config, using require for $@"
>> + require "$@ -l$1"
>> + fi
>> }
>>
>
> pkg-config typically provides more then just a location of the files,
> and while it happens to work for mfx in your case, I don't think this
> generic fallback is a good idea.
> We already require a linux-esque build environment, even for MSVC
> builds (ie. msys or cygwin, etc), having pkg-config on top of the
> other required tools isn't that hard of a dependency to fullfill - I
> do that all the time.
>
> - Hendrik
OK. Please disregard this patch, and I will submit a different one that
does something more specific for libmfx.
Thanks,
Aaron Levinson
More information about the ffmpeg-devel
mailing list