[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 04:54:20 EEST 2017
On 4/14/2017 6:04 PM, James Almer wrote:
> On 4/13/2017 9:56 PM, Aaron Levinson 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
>
> This will fail in a thousand ways with packages that require other
> packages, specific cflags, specific ldflags, or that state specific
> versions.
> As Hendrik said, pkg-config is not just a fancy way to add -I and -L
> options to the compiler and linker.
I responded earlier today to Hendrik's response and indicated that I was
abandoning the patch. I just submitted a new patch that does something
more specific for libmfx.
Thanks,
Aaron Levinson
More information about the ffmpeg-devel
mailing list