diff mbox

[2/3] use pkg-config for sdl when cross compiling

Message ID 1262875338-4104-3-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Jan. 7, 2010, 2:42 p.m. UTC
Together with the previous patch this enables using the prefixed
pkg-config, thus picking up the correct flags for SDL.  Since
pkg-config has an awful lot of dependencies, I still use sdl-config
when not cross-compiling since some people may only have the latter.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

Comments

Anthony Liguori Jan. 11, 2010, 7:40 p.m. UTC | #1
On 01/07/2010 08:42 AM, Paolo Bonzini wrote:
> Together with the previous patch this enables using the prefixed
> pkg-config, thus picking up the correct flags for SDL.  Since
> pkg-config has an awful lot of dependencies, I still use sdl-config
> when not cross-compiling since some people may only have the latter.
>    

Wouldn't it make more sense to try to use pkg-config always and if it's 
not available, fall back on sdl-config?

That means we don't have a separate code path for cross compiling which 
means it's less likely to break.

Regards,

Anthony Liguori
Paolo Bonzini Jan. 12, 2010, 8:46 a.m. UTC | #2
On 01/11/2010 08:40 PM, Anthony Liguori wrote:
>
> Wouldn't it make more sense to try to use pkg-config always and if it's
> not available, fall back on sdl-config?
>
> That means we don't have a separate code path for cross compiling which
> means it's less likely to break.

I certainly can make that, I wanted to avoid changing the most 
frequently used path to avoid breaking stuff more than I already did. :-(

It's not frequently-changing code, so it's not so likely to break.

Paolo
Anthony Liguori Jan. 12, 2010, 3:03 p.m. UTC | #3
On 01/12/2010 02:46 AM, Paolo Bonzini wrote:
> On 01/11/2010 08:40 PM, Anthony Liguori wrote:
>>
>> Wouldn't it make more sense to try to use pkg-config always and if it's
>> not available, fall back on sdl-config?
>>
>> That means we don't have a separate code path for cross compiling which
>> means it's less likely to break.
>
> I certainly can make that, I wanted to avoid changing the most 
> frequently used path to avoid breaking stuff more than I already did. :-(
>
> It's not frequently-changing code, so it's not so likely to break.

I'd prefer that we have a single code path instead of different paths 
for cross compiling.

Regards,

Anthony Liguori

> Paolo
diff mbox

Patch

diff --git a/configure b/configure
index a6acff2..9fc3173 100755
--- a/configure
+++ b/configure
@@ -989,18 +989,24 @@  fi
 ##########################################
 # SDL probe
 
-sdl_too_old=no
+if test "$pkgconfig" = pkg-config; then
+  sdlconfig='sdl-config'
+  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
+else
+  sdlconfig="$pkgconfig sdl"
+  _sdlversion=`$sdlconfig --modversion | sed 's/[^0-9]//g'`
+fi
 
+sdl_too_old=no
 if test "$sdl" != "no" ; then
   cat > $TMPC << EOF
 #include <SDL.h>
 #undef main /* We don't want SDL to override our main() */
 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
 EOF
-  sdl_cflags=`sdl-config --cflags 2> /dev/null`
-  sdl_libs=`sdl-config --libs 2> /dev/null`
+  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
+  sdl_libs=`$sdlconfig --libs 2> /dev/null`
   if compile_prog "$sdl_cflags" "$sdl_libs" ; then
-    _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
     if test "$_sdlversion" -lt 121 ; then
       sdl_too_old=yes
     else
@@ -1009,10 +1015,11 @@  EOF
       fi
     fi
 
-    # static link with sdl ?
-    if test "$sdl" = "yes" -a "$static" = "yes" ; then
-      sdl_libs=`sdl-config --static-libs 2>/dev/null`
-      if test `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` ; then
+    # static link with sdl ? sdl.pc is broken here, so if cross-compiling
+    # hope for the best
+    if test "$sdl" = "yes" -a "$static" = "yes" -a "$sdlconfig" = sdl-config; then
+      sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
+      if test `$sdlconfig --static-libs 2>/dev/null | grep \\\-laa > /dev/null`; then
          sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`"
          sdl_cflags="$sd_cflags `aalib-config --cflags >2 /dev/null`"
       fi