From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=41342 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P5eUB-0007eq-Vh for qemu-devel@nongnu.org; Tue, 12 Oct 2010 09:01:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P5eU4-0004gK-QM for qemu-devel@nongnu.org; Tue, 12 Oct 2010 09:01:43 -0400 Received: from mail-qy0-f173.google.com ([209.85.216.173]:48077) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P5eU4-0004Lx-Mv for qemu-devel@nongnu.org; Tue, 12 Oct 2010 09:01:36 -0400 Received: by mail-qy0-f173.google.com with SMTP id 36so629119qyk.4 for ; Tue, 12 Oct 2010 06:01:36 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 12 Oct 2010 15:00:34 +0200 Message-Id: <1286888457-5033-17-git-send-email-pbonzini@redhat.com> In-Reply-To: <1286888457-5033-1-git-send-email-pbonzini@redhat.com> References: <1286888457-5033-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 16/39] introduce CFLAGS= and LDFLAGS= configure command-line options List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Also, run checks with -O2. Some headers may provide different code based on __OPTIMIZE__, so it's good to be consistent. Signed-off-by: Paolo Bonzini --- configure | 31 +++++++++++++++++++++---------- 1 files changed, 21 insertions(+), 10 deletions(-) diff --git a/configure b/configure index b387994..2a2f64e 100755 --- a/configure +++ b/configure @@ -187,6 +187,10 @@ for opt do ;; --cpu=*) cpu="$optarg" ;; + CFLAGS=*) CFLAGS="$CFLAGS" + ;; + LDFLAGS=*) LDFLAGS="$LDFLAGS" + ;; --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" ;; --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" @@ -223,13 +227,17 @@ sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}" # default flags for all hosts QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS" -CFLAGS="-g $CFLAGS" QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS" QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" QEMU_CPPFLAGS="-I. -I\$(SRC_PATH)" -LDFLAGS="-g $LDFLAGS" + +if test "$debug" = "no" ; then + : ${CFLAGS='-O2 -g'} +else + : ${CFLAGS='-g'} +fi # find source path source_path=`dirname "$0"` @@ -515,9 +523,9 @@ for opt do ;; --install=*) install="$optarg" ;; - --extra-cflags=*) + CFLAGS=*|--extra-cflags=*) ;; - --extra-ldflags=*) + LDFLAGS=*|--extra-ldflags=*) ;; --cpu=*) ;; @@ -817,8 +825,6 @@ echo "Advanced options (experts only):" echo " --source-path=PATH path of source code [$source_path]" echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" echo " --cc=CC use C compiler CC [$cc]" -echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" -echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" echo " --make=MAKE use specified make [$make]" echo " --install=INSTALL use specified install [$install]" echo " --static enable static build [$static]" @@ -913,6 +919,15 @@ echo " Default:trace-" echo " --disable-spice disable spice" echo " --enable-spice enable spice" echo "" +echo "Deprecated options:" +echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS" +echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS" +echo "" +echo "Some influential environment variables can be passed on the command line:" +echo " CFLAGS C compiler flags" +echo " LDFLAGS linker flags, e.g. -L if you have libraries in a" +echo " nonstandard directory " +echo "" echo "NOTE: The object files are built at the place where configure is launched" exit 1 fi @@ -2193,10 +2208,6 @@ fi # End of CC checks # After here, no more $cc or $ld runs -if test "$debug" = "no" ; then - CFLAGS="-O2 $CFLAGS" -fi - # Consult white-list to determine whether to enable werror # by default. Only enable by default for git builds z_version=`cut -f3 -d. $source_path/VERSION` -- 1.7.2.3