Fix cross compilation
PATCH 1/1 Fix cross compilation
This patch enhances the algorithm which finds the correct settings for SDL. For cross compilations (when cross_prefix is set), it looks for sdl-config with cross prefix. Here is the complete search order:
${cross_prefix}sdl_config (new, only used for cross compilation)
$(cross_prefix}pkg-config (old)
pkg-config (old, needs PATH)
sdl-config (old, needs PATH)Cross SDL packages (or the user) now can simply set a link (for example /usr/bin/i586-mingw32msvc-sdl-config -> /usr/i586-mingw32msvc/bin/sdl-config) which allows cross compilations without PATH modifications.
Without the patch, configure and make (which calls configure) typically need a non-standard PATH. Failing to set this special PATH results in broken builds.
--- configure | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
configure +4 -1
@@ -1047,7 +1047,10 @@ fi ########################################## # SDL probe -if $pkgconfig sdl --modversion >/dev/null 2>&1; then +if test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then + sdlconfig="${cross_prefix}sdl-config" + _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` +elif $pkgconfig sdl --modversion >/dev/null 2>&1; then sdlconfig="$pkgconfig sdl" _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` elif has sdl-config; then
Signature · 1 line
1.7.0
Quoted 8 lines · Stefan Weil
This patch enhances the algorithm which finds the correct settings for SDL. For cross compilations (when
cross_prefixis set), it looks for sdl-config with cross prefix. Here is the complete search order:${cross_prefix}sdl_config (new, only used for cross compilation) $(cross_prefix}pkg-config (old) pkg-config (old, needs PATH) sdl-config (old, needs PATH)
Why a different order for cross-compilation than for native compilation? I would expect the same order in both case, that is pkg-config first, and then sdl_config. The general rule, not specific to QEMU, is to prefer pkg-config over *config programs.
Quoted 35 lines
Cross SDL packages (or the user) now can simply set a link (for example
/usr/bin/i586-mingw32msvc-sdl-config->/usr/i586-mingw32msvc/bin/sdl-config) which allows cross compilations without PATH modifications.Without the patch, configure and make (which calls configure) typically need a non-standard PATH. Failing to set this special PATH results in broken builds.
Signed-off-by Stefan Weil <[email protected]>--- configure | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)configure +4
-1@@ -1047,7 +1047,10 @@ fi ########################################## # SDL probe -if $pkgconfig sdl --modversion >/dev/null 2>&1; then +if test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then + sdlconfig="${cross_prefix}sdl-config" + _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` +elif $pkgconfig sdl --modversion >/dev/null 2>&1; then sdlconfig="$pkgconfig sdl" _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` elif has sdl-config; thenSignature · 1 line
1.7.0
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 12 lines · Aurelien Jarno
Quoted 10 lines · Stefan Weil
This patch enhances the algorithm which finds the correct settings for SDL.
For cross compilations (whencross_prefixis set), it looks for sdl-config
with cross prefix. Here is the complete search order:${cross_prefix}sdl_config (new, only used for cross compilation) $(cross_prefix}pkg-config (old)
pkg-config (old, needs PATH)
sdl-config (old, needs PATH)
Quoted 5 lines
Why a different order for cross-compilation than for native compilation? I would expect the same order in both case, that is pkg-config first, and then
sdl_config. The general rule, not specific to QEMU, is to prefer pkg-config over *config programs.
Maybe the correct solution should be
$(cross_prefix}pkg-config (old) ${cross_prefix}sdl_config (new, only used for cross compilation)
Fallback to native *-config and "hope for the best" is no good solution for cross compilations.
If nobody disagrees, I'll send a patch without this fallback.
Stefan
Quoted 19 lines · Stefan Weil
Quoted 12 lines · Aurelien Jarno
Quoted 10 lines · Stefan Weil
This patch enhances the algorithm which finds the correct settings for SDL.
For cross compilations (whencross_prefixis set), it looks for sdl-config
with cross prefix. Here is the complete search order:${cross_prefix}sdl_config (new, only used for cross compilation) $(cross_prefix}pkg-config (old)
pkg-config (old, needs PATH)
sdl-config (old, needs PATH)Quoted 5 lines
Why a different order for cross-compilation than for native compilation? I would expect the same order in both case, that is pkg-config first, and then
sdl_config. The general rule, not specific to QEMU, is to prefer pkg-config over *config programs.
Quoted 4 lines
Maybe the correct solution should be
$(cross_prefix}pkg-config (old) ${cross_prefix}sdl_config (new, only used for cross compilation)
Why sdl_config only for cross compilation? If $(cross_prefix} is not set for native compilation, always looking for:
- first to $(cross_prefix}pkg-config
- and then to ${cross_prefix}sdl-config
looks the way to go.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 23 lines · Aurelien Jarno
Quoted 17 lines · Stefan Weil
Quoted 7 lines · Aurelien Jarno
Quoted 6 lines · Stefan Weil
This patch enhances the algorithm which finds the correct settings for SDL.
For cross compilations (whencross_prefixis set), it looks for sdl-config
with cross prefix. Here is the complete search order:Quoted 9 lines
Quoted 4 lines
${cross_prefix}sdl_config (new, only used for cross compilation) $(cross_prefix}pkg-config (old)
pkg-config (old, needs PATH)
sdl-config (old, needs PATH)Why a different order for cross-compilation than for native compilation? I would expect the same order in both case, that is pkg-config first, and then
sdl_config. The general rule, not specific to QEMU, is to prefer pkg-config over *config programs.Quoted 4 lines
Maybe the correct solution should be
$(cross_prefix}pkg-config (old) ${cross_prefix}sdl_config (new, only used for cross compilation)
Quoted 7 lines
Why
sdl_configonly for cross compilation? If $(cross_prefix} is not set for native compilation, always looking for:- first to $(cross_prefix}pkg-config
- and then to ${cross_prefix}sdl-configlooks the way to go.
D'accord. That's what I wanted to say.
The "only used for cross compilation" was too much copy + paste.
PATCH 1/1 Fix cross compilation
In reply to Aurelien JarnoThis patch enhances the algorithm which finds the correct settings for SDL. For cross compilations (when cross_prefix is set), it looks for sdl-config with cross prefix. Here is the complete search order:
$(cross_prefix}pkg-config (old, only used for cross compilation)
${cross_prefix}sdl_config (new, only used for cross compilation)
pkg-config (old, needs PATH)
sdl-config (old, needs PATH)Cross SDL packages (or the user) now can simply set a link (for example /usr/bin/i586-mingw32msvc-sdl-config -> /usr/i586-mingw32msvc/bin/sdl-config) which allows cross compilations without PATH modifications.
Without the patch, configure and make (which calls configure) typically need a non-standard PATH. Failing to set this special PATH results in broken builds.
v2:
* Favour pkg-config over sdl-config for cross compilations (suggested by Aurelien Jarno) and add comment for this.
--- configure | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
configure +11 -1
@@ -1064,7 +1064,17 @@ fi ########################################## # SDL probe -if $pkgconfig sdl --modversion >/dev/null 2>&1; then +# Look for sdl configuration program (pkg-config or sdl-config). +# Prefer variant with cross prefix if cross compiling, +# and favour pkg-config with sdl over sdl-config. +if test -n "$cross_prefix" -a $pkgconfig != pkg-config && \ + $pkgconfig sdl --modversion >/dev/null 2>&1; then + sdlconfig="$pkgconfig sdl" + _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` +elif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then + sdlconfig="${cross_prefix}sdl-config" + _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` +elif $pkgconfig sdl --modversion >/dev/null 2>&1; then sdlconfig="$pkgconfig sdl" _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` elif has sdl-config; then
Signature · 1 line
1.7.0
Am 11.04.2010 18:44, schrieb Stefan Weil:
Quoted 41 lines
This patch enhances the algorithm which finds the correct settings for SDL. For cross compilations (when
cross_prefixis set), it looks for sdl-config with cross prefix. Here is the complete search order:$(cross_prefix}pkg-config (old, only used for cross compilation) ${cross_prefix}sdl_config (new, only used for cross compilation) pkg-config (old, needs PATH) sdl-config (old, needs PATH)Cross SDL packages (or the user) now can simply set a link (for example
/usr/bin/i586-mingw32msvc-sdl-config->/usr/i586-mingw32msvc/bin/sdl-config) which allows cross compilations without PATH modifications.Without the patch, configure and make (which calls configure) typically need a non-standard PATH. Failing to set this special PATH results in broken builds.
v2:
* Favour pkg-config over sdl-config for cross compilations (suggested by Aurelien Jarno) and add comment for this.Cc Aurelien Jarno<[email protected]>Signed-off-by Stefan Weil<[email protected]>--- configure | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)configure +4
-1@@ -1064,7 +1064,17 @@ fi ########################################## # SDL probe -if $pkgconfig sdl --modversion>/dev/null 2>&1; then +# Look for sdl configuration program (pkg-config or sdl-config). +# Prefer variant with cross prefix if cross compiling, +# and favour pkg-config with sdl over sdl-config. +if test -n "$cross_prefix" -a $pkgconfig != pkg-config&& \
configure fi · line 1080
Quoted 10 lines
configure +7
-0+ $pkgconfig sdl --modversion>/dev/null 2>&1; then + sdlconfig="$pkgconfig sdl" + _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` +elif test -n "$cross_prefix"&& has ${cross_prefix}sdl-config; then + sdlconfig="${cross_prefix}sdl-config" + _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` +elif $pkgconfig sdl --modversion>/dev/null 2>&1; then sdlconfig="$pkgconfig sdl" _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` elif has sdl-config; then
No comments? So this patch can be applied to qemu master?
Thanks, Stefan
Quoted 32 lines · Stefan Weil
This patch enhances the algorithm which finds the correct settings for SDL. For cross compilations (when
cross_prefixis set), it looks for sdl-config with cross prefix. Here is the complete search order:$(cross_prefix}pkg-config (old, only used for cross compilation) ${cross_prefix}sdl_config (new, only used for cross compilation) pkg-config (old, needs PATH) sdl-config (old, needs PATH)Cross SDL packages (or the user) now can simply set a link (for example
/usr/bin/i586-mingw32msvc-sdl-config->/usr/i586-mingw32msvc/bin/sdl-config) which allows cross compilations without PATH modifications.Without the patch, configure and make (which calls configure) typically need a non-standard PATH. Failing to set this special PATH results in broken builds.
v2:
* Favour pkg-config over sdl-config for cross compilations (suggested by Aurelien Jarno) and add comment for this.Cc Aurelien Jarno <[email protected]>Signed-off-by Stefan Weil <[email protected]>--- configure | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)configure +0
-0
configure fi · line 1070
Quoted 8 lines
configure +4
-1@@ -1064,7 +1064,17 @@ fi ########################################## # SDL probe -if $pkgconfig sdl --modversion >/dev/null 2>&1; then +# Look for sdl configuration program (pkg-config or sdl-config). +# Prefer variant with cross prefix if cross compiling, +# and favour pkg-config with sdl over sdl-config. +if test -n "$cross_prefix" -a $pkgconfig != pkg-config && \
^^^^^^^^^^^^^^^^^^^^^^^^^^ Why this test ?
configure fi · line 1072
Quoted 2 lines
configure +2
-0+ $pkgconfig sdl --modversion >/dev/null 2>&1; then + sdlconfig="$pkgconfig sdl"
It should probably be sdlconfig="${cross_prefix}$pkgconfig sdl" so that the cross version of pkg-config is called later in this file.
Quoted 14 lines
configure +5
-0+ _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` +elif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then + sdlconfig="${cross_prefix}sdl-config" + _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` +elif $pkgconfig sdl --modversion >/dev/null 2>&1; then sdlconfig="$pkgconfig sdl" _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` elif has sdl-config; thenSignature · 1 line
1.7.0
Am 18.05.2010 19:43, schrieb Aurelien Jarno:
Quoted 37 lines · Stefan Weil
Quoted 36 lines
This patch enhances the algorithm which finds the correct settings for SDL. For cross compilations (when
cross_prefixis set), it looks for sdl-config with cross prefix. Here is the complete search order:$(cross_prefix}pkg-config (old, only used for cross compilation) ${cross_prefix}sdl_config (new, only used for cross compilation) pkg-config (old, needs PATH) sdl-config (old, needs PATH)Cross SDL packages (or the user) now can simply set a link (for example
/usr/bin/i586-mingw32msvc-sdl-config->/usr/i586-mingw32msvc/bin/sdl-config) which allows cross compilations without PATH modifications.Without the patch, configure and make (which calls configure) typically need a non-standard PATH. Failing to set this special PATH results in broken builds.
v2:
* Favour pkg-config over sdl-config for cross compilations (suggested by Aurelien Jarno) and add comment for this.Cc Aurelien Jarno<[email protected]>Signed-off-by Stefan Weil<[email protected]>--- configure | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)configure +0
-0@@ -1064,7 +1064,17 @@ fi ########################################## # SDL probe
Quoted 10 lines
configure fi
Quoted 6 lines
configure +4
-1-if $pkgconfig sdl --modversion>/dev/null 2>&1; then +# Look for sdl configuration program (pkg-config or sdl-config). +# Prefer variant with cross prefix if cross compiling, +# and favour pkg-config with sdl over sdl-config. +if test -n "$cross_prefix" -a $pkgconfig != pkg-config&& \^^^^^^^^^^^^^^^^^^^^^^^^^^
Why this test ?
This tests for cross compilation with a working cross pkg-config (and not the fallback solution "hope for the best" which is used in the third case).
Quoted 6 lines
configure fi · line 1074
Quoted 3 lines
configure +2
-0+ $pkgconfig sdl --modversion>/dev/null 2>&1; then + sdlconfig="$pkgconfig sdl"It should probably be sdlconfig="${cross_prefix}$pkgconfig sdl" so that the cross version of pkg-config is called later in this file.
pkgconfig="${cross_prefix}pkg-config" (was set earlier), so it is the cross version.
Quoted 17 lines
Quoted 16 lines
configure +5
-0+ _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` +elif test -n "$cross_prefix"&& has ${cross_prefix}sdl-config; then + sdlconfig="${cross_prefix}sdl-config" + _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` +elif $pkgconfig sdl --modversion>/dev/null 2>&1; then sdlconfig="$pkgconfig sdl"_sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`elif has sdl-config; then
Signature · 1 line
1.7.0
Quoted 50 lines · Stefan Weil
Am 18.05.2010 19:43, schrieb Aurelien Jarno:
Quoted 36 lines · Stefan Weil
Quoted 35 lines
This patch enhances the algorithm which finds the correct settings for SDL. For cross compilations (when
cross_prefixis set), it looks for sdl-config with cross prefix. Here is the complete search order:$(cross_prefix}pkg-config (old, only used for cross compilation) ${cross_prefix}sdl_config (new, only used for cross compilation) pkg-config (old, needs PATH) sdl-config (old, needs PATH)Cross SDL packages (or the user) now can simply set a link (for example
/usr/bin/i586-mingw32msvc-sdl-config->/usr/i586-mingw32msvc/bin/sdl-config) which allows cross compilations without PATH modifications.Without the patch, configure and make (which calls configure) typically need a non-standard PATH. Failing to set this special PATH results in broken builds.
v2:
* Favour pkg-config over sdl-config for cross compilations (suggested by Aurelien Jarno) and add comment for this.Cc Aurelien Jarno<[email protected]>Signed-off-by Stefan Weil<[email protected]>--- configure | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)configure +0
-0@@ -1064,7 +1064,17 @@ fi ########################################## # SDL probeQuoted 8 lines
configure fi
Quoted 5 lines
configure +4
-1-if $pkgconfig sdl --modversion>/dev/null 2>&1; then +# Look for sdl configuration program (pkg-config or sdl-config). +# Prefer variant with cross prefix if cross compiling, +# and favour pkg-config with sdl over sdl-config. +if test -n "$cross_prefix" -a $pkgconfig != pkg-config&& \^^^^^^^^^^^^^^^^^^^^^^^^^^ Why this test ?
This tests for cross compilation with a working cross pkg-config (and not the fallback solution "hope for the best" which is used in the third case).
Quoted 8 lines
Quoted 4 lines
configure fi · line 1072
Quoted 2 lines
configure +2
-0+ $pkgconfig sdl --modversion>/dev/null 2>&1; then + sdlconfig="$pkgconfig sdl"It should probably be sdlconfig="${cross_prefix}$pkgconfig sdl" so that the cross version of pkg-config is called later in this file.
pkgconfig="${cross_prefix}pkg-config" (was set earlier), so it is the cross version.
Ok, it makes sense now, applied.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net