qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] Fixes for Linux->Win32 cross-compilation
@ 2010-01-07 14:42 Paolo Bonzini
  2010-01-07 14:42 ` [Qemu-devel] [PATCH 1/3] use cross-prefix for pkg-config Paolo Bonzini
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Paolo Bonzini @ 2010-01-07 14:42 UTC (permalink / raw)
  To: qemu-devel

With this series I could test cross-compiled Win32 QEMU under Wine.
The VNC server fails with "inet_parse: ipv4 parse error (0)", so I had
to use SDL; but this patch series is needed to find SDL when cross
compiling.


Paolo Bonzini (3):
  use cross-prefix for pkg-config
  use pkg-config for sdl when cross compiling
  use pkg-config for libcurl when cross compiling

 configure |   52 +++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 37 insertions(+), 15 deletions(-)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH 1/3] use cross-prefix for pkg-config
  2010-01-07 14:42 [Qemu-devel] [PATCH 0/3] Fixes for Linux->Win32 cross-compilation Paolo Bonzini
@ 2010-01-07 14:42 ` Paolo Bonzini
  2010-01-07 14:42 ` [Qemu-devel] [PATCH 2/3] use pkg-config for sdl when cross compiling Paolo Bonzini
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Paolo Bonzini @ 2010-01-07 14:42 UTC (permalink / raw)
  To: qemu-devel

Since pkg-config can give different output for different targets,
it should be tried with the cross-compilation prefix first.
(Note that the autoconf macro for pkg-config uses AC_PATH_TOOL,
which also tries to add the prefix).

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

diff --git a/configure b/configure
index 18aed43..a6acff2 100755
--- a/configure
+++ b/configure
@@ -965,6 +965,15 @@ EOF
 fi
 
 ##########################################
+# pkgconfig probe
+
+pkgconfig="${cross_prefix}pkg-config"
+if ! test -x "$(which $pkgconfig 2>/dev/null)"; then
+  # hosed installation, hope for the best
+  pkgconfig=pkg-config
+fi
+
+##########################################
 # Sparse probe
 if test "$sparse" != "no" ; then
   if test -x "$(which cgcc 2>/dev/null)"; then
@@ -1047,8 +1056,8 @@ if test "$vnc_tls" != "no" ; then
 #include <gnutls/gnutls.h>
 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
 EOF
-  vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
-  vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
+  vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
+  vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
   if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
     vnc_tls=yes
     libs_softmmu="$vnc_tls_libs $libs_softmmu"
@@ -1320,7 +1329,7 @@ if test "$check_utests" != "no" ; then
 #include <check.h>
 int main(void) { suite_create("qemu test"); return 0; }
 EOF
-  check_libs=`pkg-config --libs check`
+  check_libs=`$pkgconfig --libs check`
   if compile_prog "" $check_libs ; then
     check_utests=yes
     libs_tools="$check_libs $libs_tools"
@@ -1339,8 +1348,8 @@ if test "$bluez" != "no" ; then
 #include <bluetooth/bluetooth.h>
 int main(void) { return bt_error(0); }
 EOF
-  bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
-  bluez_libs=`pkg-config --libs bluez 2> /dev/null`
+  bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
+  bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
   if compile_prog "$bluez_cflags" "$bluez_libs" ; then
     bluez=yes
     libs_softmmu="$bluez_libs $libs_softmmu"
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH 2/3] use pkg-config for sdl when cross compiling
  2010-01-07 14:42 [Qemu-devel] [PATCH 0/3] Fixes for Linux->Win32 cross-compilation Paolo Bonzini
  2010-01-07 14:42 ` [Qemu-devel] [PATCH 1/3] use cross-prefix for pkg-config Paolo Bonzini
@ 2010-01-07 14:42 ` Paolo Bonzini
  2010-01-11 19:40   ` Anthony Liguori
  2010-01-07 14:42 ` [Qemu-devel] [PATCH 3/3] use pkg-config for libcurl " Paolo Bonzini
  2010-01-07 15:23 ` [Qemu-devel] [PATCH 0/3] Fixes for Linux->Win32 cross-compilation Stefan Weil
  3 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2010-01-07 14:42 UTC (permalink / raw)
  To: qemu-devel

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(-)

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
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH 3/3] use pkg-config for libcurl when cross compiling
  2010-01-07 14:42 [Qemu-devel] [PATCH 0/3] Fixes for Linux->Win32 cross-compilation Paolo Bonzini
  2010-01-07 14:42 ` [Qemu-devel] [PATCH 1/3] use cross-prefix for pkg-config Paolo Bonzini
  2010-01-07 14:42 ` [Qemu-devel] [PATCH 2/3] use pkg-config for sdl when cross compiling Paolo Bonzini
@ 2010-01-07 14:42 ` Paolo Bonzini
  2010-01-07 15:23 ` [Qemu-devel] [PATCH 0/3] Fixes for Linux->Win32 cross-compilation Stefan Weil
  3 siblings, 0 replies; 11+ messages in thread
From: Paolo Bonzini @ 2010-01-07 14:42 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index 9fc3173..92a0d21 100755
--- a/configure
+++ b/configure
@@ -1309,13 +1309,19 @@ fi
 ##########################################
 # curl probe
 
+if test "$pkgconfig" = pkg-config; then
+  curlconfig=curl-config
+else
+  curlconfig='$pkgconfig libcurl'
+fi
+
 if test "$curl" != "no" ; then
   cat > $TMPC << EOF
 #include <curl/curl.h>
 int main(void) { return curl_easy_init(); }
 EOF
-  curl_cflags=`curl-config --cflags 2>/dev/null`
-  curl_libs=`curl-config --libs 2>/dev/null`
+  curl_cflags=`$curlconfig --cflags 2>/dev/null`
+  curl_libs=`$curlconfig --libs 2>/dev/null`
   if compile_prog "$curl_cflags" "$curl_libs" ; then
     curl=yes
     libs_tools="$curl_libs $libs_tools"
-- 
1.6.5.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 0/3] Fixes for Linux->Win32 cross-compilation
  2010-01-07 14:42 [Qemu-devel] [PATCH 0/3] Fixes for Linux->Win32 cross-compilation Paolo Bonzini
                   ` (2 preceding siblings ...)
  2010-01-07 14:42 ` [Qemu-devel] [PATCH 3/3] use pkg-config for libcurl " Paolo Bonzini
@ 2010-01-07 15:23 ` Stefan Weil
  2010-01-07 18:28   ` [Qemu-devel] " Paolo Bonzini
  3 siblings, 1 reply; 11+ messages in thread
From: Stefan Weil @ 2010-01-07 15:23 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

Paolo Bonzini schrieb:
> With this series I could test cross-compiled Win32 QEMU under Wine.
> The VNC server fails with "inet_parse: ipv4 parse error (0)", so I had
> to use SDL; but this patch series is needed to find SDL when cross
> compiling.
>
>
> Paolo Bonzini (3):
>   use cross-prefix for pkg-config
>   use pkg-config for sdl when cross compiling
>   use pkg-config for libcurl when cross compiling
>
>  configure |   52 +++++++++++++++++++++++++++++++++++++---------------
>  1 files changed, 37 insertions(+), 15 deletions(-)
>   

Hi,

VNC server works here (tested with
wine i386-softmmu/qemu.exe -L pc-bios -vnc :0).

Cross compilation works without patches when
PATH is modified so it finds the correct sdl-config
(but my configuration did not include a cross libcurl).

Regards,

Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] Re: [PATCH 0/3] Fixes for Linux->Win32 cross-compilation
  2010-01-07 15:23 ` [Qemu-devel] [PATCH 0/3] Fixes for Linux->Win32 cross-compilation Stefan Weil
@ 2010-01-07 18:28   ` Paolo Bonzini
  2010-01-07 19:46     ` Anthony Liguori
  0 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2010-01-07 18:28 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel


> Cross compilation works without patches when PATH is modified so it
> finds the correct sdl-config

True, but anything beyond "./configure --cross-prefix=cpu-vendor-os-" 
(or --host for autoconf) is a bug in either your setup or your package 
or both.

Paolo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] Re: [PATCH 0/3] Fixes for Linux->Win32 cross-compilation
  2010-01-07 18:28   ` [Qemu-devel] " Paolo Bonzini
@ 2010-01-07 19:46     ` Anthony Liguori
  2010-01-08  7:27       ` Paolo Bonzini
  0 siblings, 1 reply; 11+ messages in thread
From: Anthony Liguori @ 2010-01-07 19:46 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On 01/07/2010 12:28 PM, Paolo Bonzini wrote:
>
>> Cross compilation works without patches when PATH is modified so it
>> finds the correct sdl-config
>
> True, but anything beyond "./configure --cross-prefix=cpu-vendor-os-" 
> (or --host for autoconf) is a bug in either your setup or your package 
> or both.

Last I tried, sdl-config didn't actually install sdl-config with a cross 
prefix when cross compiled..

Regards,

Anthony Liguori

> Paolo
>
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] Re: [PATCH 0/3] Fixes for Linux->Win32 cross-compilation
  2010-01-07 19:46     ` Anthony Liguori
@ 2010-01-08  7:27       ` Paolo Bonzini
  0 siblings, 0 replies; 11+ messages in thread
From: Paolo Bonzini @ 2010-01-08  7:27 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

On 01/07/2010 08:46 PM, Anthony Liguori wrote:
> On 01/07/2010 12:28 PM, Paolo Bonzini wrote:
>>
>>> Cross compilation works without patches when PATH is modified so it
>>> finds the correct sdl-config
>>
>> True, but anything beyond "./configure --cross-prefix=cpu-vendor-os-"
>> (or --host for autoconf) is a bug in either your setup or your package
>> or both.
>
> Last I tried, sdl-config didn't actually install sdl-config with a cross
> prefix when cross compiled..

Yes, that's why I'm trying to use pkg-config when cross compiling in 
patches 2/3 and 3/3.

Paolo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] use pkg-config for sdl when cross compiling
  2010-01-07 14:42 ` [Qemu-devel] [PATCH 2/3] use pkg-config for sdl when cross compiling Paolo Bonzini
@ 2010-01-11 19:40   ` Anthony Liguori
  2010-01-12  8:46     ` Paolo Bonzini
  0 siblings, 1 reply; 11+ messages in thread
From: Anthony Liguori @ 2010-01-11 19:40 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] use pkg-config for sdl when cross compiling
  2010-01-11 19:40   ` Anthony Liguori
@ 2010-01-12  8:46     ` Paolo Bonzini
  2010-01-12 15:03       ` Anthony Liguori
  0 siblings, 1 reply; 11+ messages in thread
From: Paolo Bonzini @ 2010-01-12  8:46 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] use pkg-config for sdl when cross compiling
  2010-01-12  8:46     ` Paolo Bonzini
@ 2010-01-12 15:03       ` Anthony Liguori
  0 siblings, 0 replies; 11+ messages in thread
From: Anthony Liguori @ 2010-01-12 15:03 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-01-12 15:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-07 14:42 [Qemu-devel] [PATCH 0/3] Fixes for Linux->Win32 cross-compilation Paolo Bonzini
2010-01-07 14:42 ` [Qemu-devel] [PATCH 1/3] use cross-prefix for pkg-config Paolo Bonzini
2010-01-07 14:42 ` [Qemu-devel] [PATCH 2/3] use pkg-config for sdl when cross compiling Paolo Bonzini
2010-01-11 19:40   ` Anthony Liguori
2010-01-12  8:46     ` Paolo Bonzini
2010-01-12 15:03       ` Anthony Liguori
2010-01-07 14:42 ` [Qemu-devel] [PATCH 3/3] use pkg-config for libcurl " Paolo Bonzini
2010-01-07 15:23 ` [Qemu-devel] [PATCH 0/3] Fixes for Linux->Win32 cross-compilation Stefan Weil
2010-01-07 18:28   ` [Qemu-devel] " Paolo Bonzini
2010-01-07 19:46     ` Anthony Liguori
2010-01-08  7:27       ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).