From patchwork Fri Aug 14 13:03:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 507370 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44218140291 for ; Fri, 14 Aug 2015 23:03:49 +1000 (AEST) Received: from localhost ([::1]:46164 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQEeB-000067-Ex for incoming@patchwork.ozlabs.org; Fri, 14 Aug 2015 09:03:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQEdo-0007wg-Kz for qemu-devel@nongnu.org; Fri, 14 Aug 2015 09:03:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZQEdl-0001oo-Oo for qemu-devel@nongnu.org; Fri, 14 Aug 2015 09:03:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQEdl-0001ok-Gb for qemu-devel@nongnu.org; Fri, 14 Aug 2015 09:03:21 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 2AB984C672 for ; Fri, 14 Aug 2015 13:03:21 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7ED3H1m019924; Fri, 14 Aug 2015 09:03:19 -0400 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 14 Aug 2015 15:03:17 +0200 Message-Id: <1439557397-26661-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1439557397-26661-1-git-send-email-pbonzini@redhat.com> References: <1439557397-26661-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Fam Zheng Subject: [Qemu-devel] [PULL v2 09/20] configure: Default to enable module build X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: 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. Add --disable-modules as a counterpart to --enable-modules, which is now turned on by default. If both are omitted, support is guessed as usual. pie is now checked for all platforms, because it's depended on by module build. Signed-off-by: Fam Zheng Message-Id: <1423481144-20314-2-git-send-email-famz@redhat.com> Signed-off-by: Paolo Bonzini --- .travis.yml | 2 +- configure | 123 +++++++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 86 insertions(+), 39 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0ac170b..12bf1db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -99,5 +99,5 @@ matrix: EXTRA_CONFIG="--enable-trace-backends=ust" compiler: gcc - env: TARGETS=i386-softmmu,x86_64-softmmu - EXTRA_CONFIG="--enable-modules" + EXTRA_CONFIG="--disable-modules" compiler: gcc diff --git a/configure b/configure index 704b34c..6faeb00 100755 --- a/configure +++ b/configure @@ -271,7 +271,7 @@ gcov_tool="gcov" EXESUF="" DSOSUF=".so" LDFLAGS_SHARED="-shared" -modules="no" +modules="" prefix="/usr/local" mandir="\${prefix}/share/man" datadir="\${prefix}/share" @@ -784,6 +784,9 @@ for opt do --enable-modules) modules="yes" ;; + --disable-modules) + modules="no" + ;; --cpu=*) ;; --target-list=*) target_list="$optarg" @@ -1508,9 +1511,6 @@ if compile_prog "-Werror -fno-gcse" "" ; then fi if test "$static" = "yes" ; then - if test "$modules" = "yes" ; then - error_exit "static and modules are mutually incompatible" - fi if test "$pie" = "yes" ; then error_exit "static and pie are mutually incompatible" else @@ -1518,17 +1518,6 @@ if test "$static" = "yes" ; then fi fi -# Unconditional check for compiler __thread support - cat > $TMPC << EOF -static __thread int tls_var; -int main(void) { return tls_var; } -EOF - -if ! compile_prog "-Werror" "" ; then - error_exit "Your compiler does not support the __thread specifier for " \ - "Thread-Local Storage (TLS). Please upgrade to a version that does." -fi - if test "$pie" = ""; then case "$cpu-$targetos" in i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD) @@ -1601,6 +1590,17 @@ EOF fi fi +# Unconditional check for compiler __thread support + cat > $TMPC << EOF +static __thread int tls_var; +int main(void) { return tls_var; } +EOF + +if ! compile_prog "-Werror" "" ; then + error_exit "Your compiler does not support the __thread specifier for " \ + "Thread-Local Storage (TLS). Please upgrade to a version that does." +fi + ########################################## # __sync_fetch_and_and requires at least -march=i486. Many toolchains # use i686 as default anyway, but for those that don't, an explicit @@ -2784,17 +2784,26 @@ if test "$modules" = yes; then glib_modules="$glib_modules gmodule-2.0" fi -for i in $glib_modules; do - if $pkg_config --atleast-version=$glib_req_ver $i; then - glib_cflags=`$pkg_config --cflags $i` - glib_libs=`$pkg_config --libs $i` - CFLAGS="$glib_cflags $CFLAGS" - LIBS="$glib_libs $LIBS" - libs_qga="$glib_libs $libs_qga" - else - error_exit "glib-$glib_req_ver $i is required to compile QEMU" - fi -done +glib_pkg_config() +{ + if $pkg_config --atleast-version=$glib_req_ver $1; then + local probe_cflags + local probe_libs + probe_cflags=$($pkg_config --cflags $1) + probe_libs=$($pkg_config --libs $1) + CFLAGS="$probe_cflags $CFLAGS" + LIBS="$probe_libs $LIBS" + libs_qga="$probe_libs $libs_qga" + glib_cflags="$probe_cflags $glib_cflags" + glib_libs="$probe_libs $glib_libs" + return 0 + else + return 1 + fi +} + +glib_pkg_config gthread-2.0 || \ + error_exit "glib-$glib_req_ver gthread-2.0 is required to compile QEMU" # g_test_trap_subprocess added in 2.38. Used by some tests. glib_subprocess=yes @@ -2815,19 +2824,57 @@ if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then fi ########################################## -# SHA command probe for modules -if test "$modules" = yes; then - shacmd_probe="sha1sum sha1 shasum" - for c in $shacmd_probe; do - if has $c; then - shacmd="$c" - break - fi - done - if test "$shacmd" = ""; 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=$1 + if test "$static" = "yes"; then + if $force; then + error_exit "static and modules are mutually incompatible" + else + modules="no" + return fi -fi + fi + shacmd_probe="sha1sum sha1 shasum" + for c in $shacmd_probe; do + if has $c; then + shacmd="$c" + break + fi + done + if test "$shacmd" = ""; then + if $force; then + error_exit "one of the checksum commands is required to enable modules: $shacmd_probe" + else + modules="no" + return + fi + fi + if ! glib_pkg_config gmodule-2.0; then + if $force; then + error_exit "glib-$glib_req_ver gmodule-2.0 is required to compile QEMU" + else + modules="no" + return + fi + fi + modules="yes" +} + +case "$modules" in + yes) + module_try_enable true + ;; + "") + module_try_enable false + ;; + no) + ;; +esac ########################################## # pixman support probe