From c6093a05d6a84d2144bb6462cf20e907eddf8aeb Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Tue, 10 Apr 2018 13:40:34 +0800 Subject: configure: don't warn SDL abi if disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SDL has the same problem as GTK that we might get warnings on SDL ABI version even if SDL is disabled. Fix that by only probing SDL if SDL is enabled. Also this should let configure be a little bit faster since we don't really need to probe SDL stuff when it's off. CC: Paolo Bonzini CC: Gerd Hoffmann CC: Peter Maydell CC: Daniel P. Berrange CC: Fam Zheng CC: "Philippe Mathieu-Daudé" Signed-off-by: Peter Xu Reviewed-by: Daniel P. Berrangé Reviewed-by: Fam Zheng Message-id: 20180410054034.20479-1-peterx@redhat.com Signed-off-by: Gerd Hoffmann --- configure | 83 ++++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 45 insertions(+), 38 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 931d2a07cc..0a19b033bc 100755 --- a/configure +++ b/configure @@ -2835,49 +2835,52 @@ fi # Look for sdl configuration program (pkg-config or sdl-config). Try # sdl-config even without cross prefix, and favour pkg-config over sdl-config. -if test "$sdlabi" = ""; then - if $pkg_config --exists "sdl2"; then - sdlabi=2.0 - elif $pkg_config --exists "sdl"; then - sdlabi=1.2 - else - sdlabi=2.0 - fi -fi +sdl_probe () +{ + sdl_too_old=no + if test "$sdlabi" = ""; then + if $pkg_config --exists "sdl2"; then + sdlabi=2.0 + elif $pkg_config --exists "sdl"; then + sdlabi=1.2 + else + sdlabi=2.0 + fi + fi -if test $sdlabi = "2.0"; then - sdl_config=$sdl2_config - sdlname=sdl2 - sdlconfigname=sdl2_config -elif test $sdlabi = "1.2"; then - sdlname=sdl - sdlconfigname=sdl_config -else - error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0" -fi + if test $sdlabi = "2.0"; then + sdl_config=$sdl2_config + sdlname=sdl2 + sdlconfigname=sdl2_config + elif test $sdlabi = "1.2"; then + sdlname=sdl + sdlconfigname=sdl_config + else + error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0" + fi -if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then - sdl_config=$sdlconfigname -fi + if test "$(basename $sdl_config)" != $sdlconfigname && ! has ${sdl_config}; then + sdl_config=$sdlconfigname + fi -if $pkg_config $sdlname --exists; then - sdlconfig="$pkg_config $sdlname" - sdlversion=$($sdlconfig --modversion 2>/dev/null) -elif has ${sdl_config}; then - sdlconfig="$sdl_config" - sdlversion=$($sdlconfig --version) -else - if test "$sdl" = "yes" ; then - feature_not_found "sdl" "Install SDL2-devel" + if $pkg_config $sdlname --exists; then + sdlconfig="$pkg_config $sdlname" + sdlversion=$($sdlconfig --modversion 2>/dev/null) + elif has ${sdl_config}; then + sdlconfig="$sdl_config" + sdlversion=$($sdlconfig --version) + else + if test "$sdl" = "yes" ; then + feature_not_found "sdl" "Install SDL2-devel" + fi + sdl=no + # no need to do the rest + return + fi + if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then + echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 fi - sdl=no -fi -if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then - echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 -fi -sdl_too_old=no -if test "$sdl" != "no" ; then cat > $TMPC << EOF #include #undef main /* We don't want SDL to override our main() */ @@ -2919,6 +2922,10 @@ EOF fi sdl=no fi # sdl compile test +} + +if test "$sdl" != "no" ; then + sdl_probe fi if test "$sdl" = "yes" ; then -- cgit v1.2.1