From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5oyR-000639-3R for qemu-devel@nongnu.org; Tue, 10 Apr 2018 04:49:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5oyQ-0001dk-0Z for qemu-devel@nongnu.org; Tue, 10 Apr 2018 04:49:55 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59282 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f5oyP-0001dC-R3 for qemu-devel@nongnu.org; Tue, 10 Apr 2018 04:49:53 -0400 Date: Tue, 10 Apr 2018 16:49:50 +0800 From: Fam Zheng Message-ID: <20180410084950.GB2785@lemon.usersys.redhat.com> References: <20180410054034.20479-1-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20180410054034.20479-1-peterx@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] configure: don't warn SDL abi if disabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu Cc: qemu-devel@nongnu.org, Paolo Bonzini , Gerd Hoffmann , Peter Maydell , "Daniel P . Berrange" , Philippe =?iso-8859-1?Q?Mathieu-Daud=E9?= On Tue, 04/10 13:40, Peter Xu wrote: > 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 i= s > enabled. Also this should let configure be a little bit faster since w= e > don't really need to probe SDL stuff when it's off. >=20 > CC: Paolo Bonzini > CC: Gerd Hoffmann > CC: Peter Maydell > CC: Daniel P. Berrange > CC: Fam Zheng > CC: "Philippe Mathieu-Daud=E9" > Signed-off-by: Peter Xu > --- > configure | 83 ++++++++++++++++++++++++++++++++++---------------------= -------- > 1 file changed, 45 insertions(+), 38 deletions(-) >=20 > diff --git a/configure b/configure > index 752dd9ef32..f647026b8d 100755 > --- a/configure > +++ b/configure > @@ -2836,49 +2836,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. > =20 > -if test "$sdlabi" =3D ""; then > - if $pkg_config --exists "sdl2"; then > - sdlabi=3D2.0 > - elif $pkg_config --exists "sdl"; then > - sdlabi=3D1.2 > - else > - sdlabi=3D2.0 > - fi > -fi > +sdl_probe () > +{ We have had function_name() { ... and function_name() { ... and function_name () { ... finally you invent the last in the family: function_name () { :) . > + sdl_too_old=3Dno > + if test "$sdlabi" =3D ""; then > + if $pkg_config --exists "sdl2"; then > + sdlabi=3D2.0 > + elif $pkg_config --exists "sdl"; then > + sdlabi=3D1.2 > + else > + sdlabi=3D2.0 > + fi > + fi > =20 > -if test $sdlabi =3D "2.0"; then > - sdl_config=3D$sdl2_config > - sdlname=3Dsdl2 > - sdlconfigname=3Dsdl2_config > -elif test $sdlabi =3D "1.2"; then > - sdlname=3Dsdl > - sdlconfigname=3Dsdl_config > -else > - error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0" > -fi > + if test $sdlabi =3D "2.0"; then > + sdl_config=3D$sdl2_config > + sdlname=3Dsdl2 > + sdlconfigname=3Dsdl2_config > + elif test $sdlabi =3D "1.2"; then > + sdlname=3Dsdl > + sdlconfigname=3Dsdl_config > + else > + error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0" > + fi > =20 > -if test "$(basename $sdl_config)" !=3D $sdlconfigname && ! has ${sdl_c= onfig}; then > - sdl_config=3D$sdlconfigname > -fi > + if test "$(basename $sdl_config)" !=3D $sdlconfigname && ! has ${sdl= _config}; then > + sdl_config=3D$sdlconfigname > + fi > =20 > -if $pkg_config $sdlname --exists; then > - sdlconfig=3D"$pkg_config $sdlname" > - sdlversion=3D$($sdlconfig --modversion 2>/dev/null) > -elif has ${sdl_config}; then > - sdlconfig=3D"$sdl_config" > - sdlversion=3D$($sdlconfig --version) > -else > - if test "$sdl" =3D "yes" ; then > - feature_not_found "sdl" "Install SDL2-devel" > + if $pkg_config $sdlname --exists; then > + sdlconfig=3D"$pkg_config $sdlname" > + sdlversion=3D$($sdlconfig --modversion 2>/dev/null) > + elif has ${sdl_config}; then > + sdlconfig=3D"$sdl_config" > + sdlversion=3D$($sdlconfig --version) > + else > + if test "$sdl" =3D "yes" ; then > + feature_not_found "sdl" "Install SDL2-devel" > + fi > + sdl=3Dno > + # no need to do the rest > + return > + fi > + if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" =3D sd= l-config; then > + echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl = >&2 > fi > - sdl=3Dno > -fi > -if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" =3D sdl-= config; then > - echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&= 2 > -fi > =20 > -sdl_too_old=3Dno > -if test "$sdl" !=3D "no" ; then > cat > $TMPC << EOF > #include > #undef main /* We don't want SDL to override our main() */ > @@ -2920,6 +2923,10 @@ EOF > fi > sdl=3Dno > fi # sdl compile test > +} > + > +if test "$sdl" !=3D "no" ; then > + sdl_probe > fi > =20 > if test "$sdl" =3D "yes" ; then > --=20 > 2.14.3 >=20 Reviewed-by: Fam Zheng