From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAcCd-0003Yy-LJ for qemu-devel@nongnu.org; Mon, 12 Jan 2015 05:26:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YAcCa-0006O9-EG for qemu-devel@nongnu.org; Mon, 12 Jan 2015 05:26:31 -0500 Received: from cantor2.suse.de ([195.135.220.15]:36025 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAcCa-0006Np-5S for qemu-devel@nongnu.org; Mon, 12 Jan 2015 05:26:28 -0500 Message-ID: <54B3A150.3060507@suse.de> Date: Mon, 12 Jan 2015 11:26:24 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1421037791-32021-1-git-send-email-famz@redhat.com> <1421037791-32021-3-git-send-email-famz@redhat.com> In-Reply-To: <1421037791-32021-3-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/3] configure: Default to enable module build List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Brian Jackson , Peter Maydell , Michael Tokarev , Stefan Hajnoczi , Bharata B Rao , Paolo Bonzini , Richard Henderson Am 12.01.2015 um 05:43 schrieb Fam Zheng: > We have module build support around for a while, but also had it bitrot > several times. It probably makes sense to enable it by default so that > people can notice and use it. >=20 > Counterpart to --enable-modules, which is turned as default, > --disable-modules is added to suppress it. If both are omitted, the > support is guesses as usual. >=20 > Signed-off-by: Fam Zheng General idea seems okay, however an error handling nit below. > --- > configure | 96 ++++++++++++++++++++++++++++++++++++++++++++-----------= -------- > 1 file changed, 67 insertions(+), 29 deletions(-) >=20 > diff --git a/configure b/configure > index 7539645..2015179 100755 > --- a/configure > +++ b/configure > @@ -271,7 +271,7 @@ gcov_tool=3D"gcov" > EXESUF=3D"" > DSOSUF=3D".so" > LDFLAGS_SHARED=3D"-shared" > -modules=3D"no" > +modules=3D"" > prefix=3D"/usr/local" > mandir=3D"\${prefix}/share/man" > datadir=3D"\${prefix}/share" > @@ -768,6 +768,9 @@ for opt do > --enable-modules) > modules=3D"yes" > ;; > + --disable-modules) > + modules=3D"no" > + ;; > --cpu=3D*) > ;; > --target-list=3D*) target_list=3D"$optarg" > @@ -1259,7 +1262,8 @@ Advanced options (experts only): > --sysconfdir=3DPATH install config in PATH$confsuffix > --localstatedir=3DPATH install local state in PATH (set at runti= me on win32) > --with-confsuffix=3DSUFFIX suffix for QEMU data inside datadir/libdi= r/sysconfdir [$confsuffix] > - --enable-modules enable modules support > + --enable-modules enable modules support (default) > + --disable-modules enable modules support > --enable-debug-tcg enable TCG debugging > --disable-debug-tcg disable TCG debugging (default) > --enable-debug-info enable debugging information (default) > @@ -2699,22 +2703,26 @@ if test "$mingw32" =3D yes; then > else > glib_req_ver=3D2.12 > fi > -glib_modules=3Dgthread-2.0 > -if test "$modules" =3D yes; then > - glib_modules=3D"$glib_modules gmodule-2.0" > -fi > =20 > -for i in $glib_modules; do > - if $pkg_config --atleast-version=3D$glib_req_ver $i; then > - glib_cflags=3D`$pkg_config --cflags $i` > - glib_libs=3D`$pkg_config --libs $i` > - CFLAGS=3D"$glib_cflags $CFLAGS" > - LIBS=3D"$glib_libs $LIBS" > - libs_qga=3D"$glib_libs $libs_qga" > - else > - error_exit "glib-$glib_req_ver $i is required to compile QEMU" > - fi > -done > +glib_module_try_config() > +{ > + if $pkg_config --atleast-version=3D$glib_req_ver $1; then > + local probe_cflags=3D$($pkg_config --cflags $1) > + local probe_libs=3D$($pkg_config --libs $1) > + CFLAGS=3D"$probe_cflags $CFLAGS" > + LIBS=3D"$probe_libs $LIBS" > + libs_qga=3D"$probe_libs $libs_qga" > + glib_cflags=3D"$probe_cflags $glib_cflags" > + glib_libs=3D"$probe_libs $glib_libs" > + return 0 > + else > + return 1 > + error_exit "glib-$glib_req_ver $i is required to compile QEMU" Is this error_exit ever executed? I.e., shouldn't the two lines be reordered? > + fi > +} > + > +glib_module_try_config gthread-2.0 || \ > + error_exit "glib-$glib_req_ver gthread-2.0 is required to compile QE= MU" Depending on the above, we might drop this error_exit duplication? Regards, Andreas > =20 > # g_test_trap_subprocess added in 2.38. Used by some tests. > glib_subprocess=3Dyes > @@ -2723,19 +2731,49 @@ if ! $pkg_config --atleast-version=3D2.38 glib-= 2.0; then > fi > =20 > ########################################## > -# SHA command probe for modules > -if test "$modules" =3D yes; then > - shacmd_probe=3D"sha1sum sha1 shasum" > - for c in $shacmd_probe; do > - if has $c; then > - shacmd=3D"$c" > - break > - fi > - done > - if test "$shacmd" =3D ""; then > - error_exit "one of the checksum commands is required to enable= modules: $shacmd_probe" > +# SHA command and gmodule-2.0 probe for modules > +# return 0 if probe succeeds > +# $1: true - force mode, exit if probe fail > +# false - optoinal mode, return 1 if probe fail > +module_try_enable() > +{ > + force=3D$1 > + shacmd_probe=3D"sha1sum sha1 shasum" > + for c in $shacmd_probe; do > + if has $c; then > + shacmd=3D"$c" > + break > fi > -fi > + done > + if test "$shacmd" =3D ""; then > + if $force; then > + error_exit "one of the checksum commands is required to enable m= odules: $shacmd_probe" > + else > + modules=3D"no" > + return > + fi > + fi > + if ! glib_module_try_config gmodule-2.0; then > + if $force; then > + error_exit "glib-$glib_req_ver gthread-2.0 is required to compil= e QEMU" > + else > + modules=3D"no" > + return > + fi > + fi > + modules=3D"yes" > +} > + > +case "$modules" in > + yes) > + module_try_enable true > + ;; > + "") > + module_try_enable false > + ;; > + no) > + ;; > +esac > =20 > ########################################## > # pixman support probe --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Felix Imend=F6rffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu, Graham Norton; HRB 21284 (AG N=FCrnberg)