Message ID | 1262875338-4104-3-git-send-email-pbonzini@redhat.com |
---|---|
State | New |
Headers | show |
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
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
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 --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
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(-)