* [Qemu-devel] [PATCH v3 0/4] pkg-config related fixes for cross compilation
@ 2010-01-13 8:52 Paolo Bonzini
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 1/4] use cross-prefix for pkgconfig Paolo Bonzini
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Paolo Bonzini @ 2010-01-13 8:52 UTC (permalink / raw)
To: qemu-devel
This is v3 of the series to simplify cross-compiling, by using
a cross pkg-config tool whenever possible.
I'm now using pkg-config also in the native compilation case
whenever possible. I also found and fixed a typo in the static
SDL case.
v2->v3: fix typo
v1->v2: always use pkg-config when available
Paolo Bonzini (4):
use cross-prefix for pkgconfig
fixes to the static compilation case for sdl
use pkg-config for sdl whenever available
use pkg-config for libcurl whenever available
configure | 50 +++++++++++++++++++++++++++++++++++--------------
1 files changed, 36 insertions(+), 14 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v3 1/4] use cross-prefix for pkgconfig
2010-01-13 8:52 [Qemu-devel] [PATCH v3 0/4] pkg-config related fixes for cross compilation Paolo Bonzini
@ 2010-01-13 8:52 ` Paolo Bonzini
2010-01-13 23:27 ` Anthony Liguori
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 2/4] fixes to the static compilation case for sdl Paolo Bonzini
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2010-01-13 8:52 UTC (permalink / raw)
To: qemu-devel
Since pkgconfig can give different output for different targets,
it should be tried with the cross-compilation prefix first.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/configure b/configure
index 5c056f5..f3584db 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
+ # likely not cross compiling, or 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] 6+ messages in thread
* [Qemu-devel] [PATCH v3 2/4] fixes to the static compilation case for sdl
2010-01-13 8:52 [Qemu-devel] [PATCH v3 0/4] pkg-config related fixes for cross compilation Paolo Bonzini
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 1/4] use cross-prefix for pkgconfig Paolo Bonzini
@ 2010-01-13 8:52 ` Paolo Bonzini
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 3/4] use pkg-config for sdl whenever available Paolo Bonzini
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 4/4] use pkg-config for libcurl " Paolo Bonzini
3 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2010-01-13 8:52 UTC (permalink / raw)
To: qemu-devel
After the next commit, pkg-config could be used for the shared library
configuration case and sdl-config for static libraries. So I prepare
the test here by doing two changes:
at the same time I remove useless backslashes from the invocation of
grep;
1) fixing a typo ($sd_cflags). The typo has been there since commit
1ac88f2 (remove sdl_static. Just do the right thing if static is yes,
2009-07-27).
2) fixing an erroneous "test `... | grep > /dev/null`" idiom that would
never succeed since grep's output would be empty;
3) checking the status code after executing sdl-config --static --libs;
this is needed for the next patch only.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
1 and 2 above show that the aalib-config case is not very
much used. In addition to this, on my system aalib-config
does not support --static-libs at all. So I was very much
tempted to nuke the aalib-config handling completely.
configure | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index f3584db..b8641b8 100755
--- a/configure
+++ b/configure
@@ -1009,12 +1009,12 @@ EOF
fi
fi
- # static link with sdl ?
+ # static link with sdl ? (note: sdl.pc's --static --libs is broken)
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
+ if test $? = 0 && echo $sdl_libs | 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`"
+ sdl_cflags="$sdl_cflags `aalib-config --cflags >2 /dev/null`"
fi
if compile_prog "$sdl_cflags" "$sdl_libs" ; then
:
--
1.6.5.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v3 3/4] use pkg-config for sdl whenever available
2010-01-13 8:52 [Qemu-devel] [PATCH v3 0/4] pkg-config related fixes for cross compilation Paolo Bonzini
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 1/4] use cross-prefix for pkgconfig Paolo Bonzini
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 2/4] fixes to the static compilation case for sdl Paolo Bonzini
@ 2010-01-13 8:52 ` Paolo Bonzini
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 4/4] use pkg-config for libcurl " Paolo Bonzini
3 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2010-01-13 8:52 UTC (permalink / raw)
To: qemu-devel
Together with the first patch this enables using the prefixed
pkg-config, thus picking up the correct flags for SDL.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index b8641b8..2553724 100755
--- a/configure
+++ b/configure
@@ -989,18 +989,24 @@ fi
##########################################
# SDL probe
-sdl_too_old=no
+if $pkgconfig sdl --modversion >/dev/null 2>&1; then
+ sdlconfig="$pkgconfig sdl"
+ _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
+else
+ sdlconfig='sdl-config'
+ _sdlversion=`$sdlconfig --version | 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
--
1.6.5.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v3 4/4] use pkg-config for libcurl whenever available
2010-01-13 8:52 [Qemu-devel] [PATCH v3 0/4] pkg-config related fixes for cross compilation Paolo Bonzini
` (2 preceding siblings ...)
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 3/4] use pkg-config for sdl whenever available Paolo Bonzini
@ 2010-01-13 8:52 ` Paolo Bonzini
3 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2010-01-13 8:52 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 2553724..b3d4640 100755
--- a/configure
+++ b/configure
@@ -1309,13 +1309,19 @@ fi
##########################################
# curl probe
+if $pkgconfig libcurl --modversion >/dev/null 2>&1; then
+ curlconfig="$pkgconfig libcurl"
+else
+ curlconfig=curl-config
+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] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v3 1/4] use cross-prefix for pkgconfig
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 1/4] use cross-prefix for pkgconfig Paolo Bonzini
@ 2010-01-13 23:27 ` Anthony Liguori
0 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2010-01-13 23:27 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On 01/13/2010 02:52 AM, Paolo Bonzini wrote:
> Since pkgconfig can give different output for different targets,
> it should be tried with the cross-compilation prefix first.
>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
>
Applied all. Thanks.
Regards,
Anthony Liguori
> ---
> configure | 19 ++++++++++++++-----
> 1 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/configure b/configure
> index 5c056f5..f3584db 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
> + # likely not cross compiling, or 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"
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-01-13 23:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13 8:52 [Qemu-devel] [PATCH v3 0/4] pkg-config related fixes for cross compilation Paolo Bonzini
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 1/4] use cross-prefix for pkgconfig Paolo Bonzini
2010-01-13 23:27 ` Anthony Liguori
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 2/4] fixes to the static compilation case for sdl Paolo Bonzini
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 3/4] use pkg-config for sdl whenever available Paolo Bonzini
2010-01-13 8:52 ` [Qemu-devel] [PATCH v3 4/4] use pkg-config for libcurl " 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).