configure: avoid basename usage message
PATCH 1/1 configure: avoid basename usage message
basename prints a missing-argument error when sdlconfig is empty and we're cross-compiling.
--- configure | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
configure +2 -1
@@ -1233,7 +1233,8 @@ else fi sdl=no fi -if test -n "$cross_prefix" && test "`basename $sdlconfig`" = sdl-config; then +if test -n "$cross_prefix" -a -n "$sdlconfig" && \ + test "`basename $sdlconfig`" = sdl-config; then echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 fi
Signature · 1 line
1.7.1
configure else · line 1237
Quoted 11 lines · Scott Wood
configure +2
-1@@ -1233,7 +1233,8 @@ else fi sdl=no fi -if test -n "$cross_prefix" && test "`basename $sdlconfig`" = sdl-config; then +if test -n "$cross_prefix" -a -n "$sdlconfig" && \ + test "`basename $sdlconfig`" = sdl-config; then
Instead of doing test -n "$sdlconfig" first with short-circuit evaluation, I think would should do:
test $(basename "$sdlconfig") = sdl-config
Then you don't need to test sdlconfig because basename will produce an empty string without error.
Stefan
PATCH v2 1/1 configure: avoid basename usage message
basename prints a missing-argument error when sdlconfig is empty and we're cross-compiling.
---
v2: quote the input to basename rather than introduce an extra test, as suggested by Stefan.
configure | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
@@ -1233,7 +1233,7 @@ else fi sdl=no fi -if test -n "$cross_prefix" && test "`basename $sdlconfig`" = sdl-config; then +if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 fi
Signature · 1 line
1.7.1
Quoted 10 lines · Scott Wood
basename prints a missing-argument error when sdlconfig is empty and we're cross-compiling.
Signed-off-by Scott Wood <[email protected]>---
v2: quote the input to basename rather than introduce an extra test, as suggested by Stefan.configure | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
I have merged into the trivial patches tree since $() is POSIX and we already use it in ./configure:git://repo.or.cz/qemu/stefanha.git trivial-patches
A pull request will be sent to merge this into qemu.git. For more information, see http://wiki.qemu.org/Contribute/TrivialPatches.
Stefan
Quoted 15 lines · Stefan Hajnoczi
configure else · line 1237
Quoted 11 lines · Scott Wood
configure +2
-1@@ -1233,7 +1233,8 @@ else fi sdl=no fi -if test -n "$cross_prefix"&& test "`basename $sdlconfig`" = sdl-config; then +if test -n "$cross_prefix" -a -n "$sdlconfig"&& \ + test "`basename $sdlconfig`" = sdl-config; thenInstead of doing test -n "$sdlconfig" first with short-circuit evaluation, I think would should do:
Quoted 1 line
test $(basename "$sdlconfig") = sdl-config
$() is a bash-ism FYI.
Regards,
Anthony Liguori
Quoted 5 lines
Then you don't need to test sdlconfig because basename will produce an empty string without error.
Stefan
Quoted 16 lines · On Fri, 8 Apr 2011 15:06:57 -0500 Anthony Liguori <[email protected]> wrote:
Quoted 15 lines · Stefan Hajnoczi
configure else · line 1237
Quoted 11 lines · Scott Wood
configure +2
-1@@ -1233,7 +1233,8 @@ else fi sdl=no fi -if test -n "$cross_prefix"&& test "`basename $sdlconfig`" = sdl-config; then +if test -n "$cross_prefix" -a -n "$sdlconfig"&& \ + test "`basename $sdlconfig`" = sdl-config; thenInstead of doing test -n "$sdlconfig" first with short-circuit evaluation, I think would should do:
Quoted 3 lines
Quoted 1 line
test $(basename "$sdlconfig") = sdl-config
$() is a bash-ism FYI.
See section 2.6.3 of
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
And I've tested that it works in dash.
-Scott