[FFmpeg-devel] configure: Prioritize 'sdl2-config'-check

Submitted by Reino Wijnsma on May 11, 2017, 10:53 a.m.

Details

Message ID 591442AD.1010800@xs4all.nl
State New
Headers show

Commit Message

Reino Wijnsma May 11, 2017, 10:53 a.m.
See https://trac.ffmpeg.org/ticket/6377.
By prioritizing the 'sdl2-config'-check the librarylist that's needed to
build FFPlay is setup automatically and one doesn't have to patch
'sdl2.pc' anymore.
From 3f9c065f96815ffefaa39cda7bacd8132bfdf66c Mon Sep 17 00:00:00 2001
From: Reino Wijnsma <rwijnsma@xs4all.nl>
Date: Wed, 10 May 2017 00:50:30 +0200
Subject: [PATCH] Check 'sdl2-config' first, then 'sdl2.pc'.

---
 configure | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

wm4 May 11, 2017, 11:03 a.m.
On Thu, 11 May 2017 12:53:33 +0200
Reino Wijnsma <rwijnsma@xs4all.nl> wrote:

> See https://trac.ffmpeg.org/ticket/6377.
> By prioritizing the 'sdl2-config'-check the librarylist that's needed to
> build FFPlay is setup automatically and one doesn't have to patch
> 'sdl2.pc' anymore.

Wouldn't it be more appropriate to ask the upstream project or your
distro to fix the .pc file?
Reino Wijnsma May 11, 2017, 11:43 a.m.
https://trac.ffmpeg.org/ticket/6377#comment:2:
> Inadequate for building FFPlay, yes. But perhaps not for other software.
> Are there any downsides to my proposition?

I could of course contact the sdl2 developers, but when 'sdl2-config'
already has the librarylist setup right to build FFPlay, why not just do
the 'sdl2-config'-check first? Is there are reason why FFMpeg's
'configure' does the 'check_pkg_config sdl2'-check first?
Stephen Hutchinson May 11, 2017, 11:56 a.m.
On 5/11/2017 7:43 AM, Reino Wijnsma wrote:
> https://trac.ffmpeg.org/ticket/6377#comment:2:
>> Inadequate for building FFPlay, yes. But perhaps not for other software.
>> Are there any downsides to my proposition?
> 
> I could of course contact the sdl2 developers, but when 'sdl2-config'
> already has the librarylist setup right to build FFPlay, why not just do
> the 'sdl2-config'-check first? Is there are reason why FFMpeg's
> 'configure' does the 'check_pkg_config sdl2'-check first?
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

Those libs mentioned as 'missing' in the ticket are not
supposed to be public, since they're MinGW-w64 system libs;
at least here, they *are* in sdl2.pc, under Libs.private.
And the proper way to get pkg-config to recognize that is
to set the --static flag.

IIRC, this should only be a problem when building as static,
and as mentioned above, that means you should be setting
--pkg-config-flags="--static" when configuring FFmpeg.
Reino Wijnsma May 11, 2017, 2:45 p.m.
On 11-5-2017 13:56, Stephen Hutchinson <qyot27@gmail.com> wrote:
> On 5/11/2017 7:43 AM, Reino Wijnsma wrote:
>> https://trac.ffmpeg.org/ticket/6377#comment:2:
>>> Inadequate for building FFPlay, yes. But perhaps not for other
>>> software.
>>> Are there any downsides to my proposition?
>> I could of course contact the sdl2 developers, but when 'sdl2-config'
>> already has the librarylist setup right to build FFPlay, why not just do
>> the 'sdl2-config'-check first? Is there are reason why FFMpeg's
>> 'configure' does the 'check_pkg_config sdl2'-check first?
> Those libs mentioned as 'missing' in the ticket are not
> supposed to be public, since they're MinGW-w64 system libs;
> at least here, they *are* in sdl2.pc, under Libs.private.
> And the proper way to get pkg-config to recognize that is
> to set the --static flag.
>
> IIRC, this should only be a problem when building as static,
> and as mentioned above, that means you should be setting
> --pkg-config-flags="--static" when configuring FFmpeg.
Hmm, I didn't know about --pkg-config-flags="--static". I've just done a
./configure [...] --pkg-config-flags=--static and in 'config.log' I can
see "ffplay=yes". I haven't done a make install yet, but I assume FFPlay
will be build without problems. If not, I'll report back at you.
Thanks, qyot27!

Patch hide | download patch | download mbox

diff --git a/configure b/configure
index 5ae5227..275a1c1 100755
--- a/configure
+++ b/configure
@@ -5947,14 +5947,14 @@  fi
 disabled sdl && disable sdl2
 if ! disabled sdl2; then
     SDL2_CONFIG="${cross_prefix}sdl2-config"
-    if check_pkg_config sdl2 SDL_events.h SDL_PollEvent; then
+    if "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
+        sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
+        sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
         check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
         check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
         check_func SDL_Init $sdl2_extralibs $sdl2_cflags && enable sdl2
     else
-      if "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
-        sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
-        sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
+      if check_pkg_config sdl2 SDL_events.h SDL_PollEvent; then
         check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
         check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
         check_func SDL_Init $sdl2_extralibs $sdl2_cflags && enable sdl2