[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 2/4] configure: introduce --extra-libs
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [RFC PATCH 2/4] configure: introduce --extra-libs |
Date: |
Mon, 25 Jan 2016 17:08:13 +0000 |
On 25 January 2016 at 16:49, Alex Bennée <address@hidden> wrote:
> If for example you want to use the thread sanitizer you want to ensure all
> binaries are linked with the library:
>
> ./configure ${TARGETS} --cc=gcc-5 --cxx=g++-5 \
> --extra-cflags="-fsanitize=thread" --extra-libs="-ltsan"
>
> This is more explicit than just specifying --extra-ldflags which might
> not get applied in the right place all the time.
When would they differ? The commit message makes this sound like
it's working around a bug in the code that uses LDFLAGS...
> Signed-off-by: Alex Bennée <address@hidden>
> ---
> configure | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/configure b/configure
> index 7d23c6c..194bae9 100755
> --- a/configure
> +++ b/configure
> @@ -365,6 +365,8 @@ for opt do
> --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
> EXTRA_LDFLAGS="$optarg"
> ;;
> + --extra-libs=*) EXTRA_LIBS="$optarg"
> + ;;
> --enable-debug-info) debug_info="yes"
> ;;
> --disable-debug-info) debug_info="no"
The reason for having this special case to set the variables for
CC related things early is to ensure that they apply for all
compilations including any that get done very early in configure...
> @@ -785,6 +787,8 @@ for opt do
> ;;
> --extra-ldflags=*)
> ;;
> + --extra-libs=*)
> + ;;
> --enable-debug-info)
> ;;
> --disable-debug-info)
> @@ -1281,6 +1285,7 @@ Advanced options (experts only):
> --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
> --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
> --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
> + --extra-libs=LIBS append extra libraries when linking
> --make=MAKE use specified make [$make]
> --install=INSTALL use specified install [$install]
> --python=PYTHON use specified python [$python]
> @@ -4718,6 +4723,11 @@ libs_softmmu="$pixman_libs $libs_softmmu"
> CFLAGS="$CFLAGS $EXTRA_CFLAGS"
> QEMU_CFLAGS="$QEMU_CFLAGS $EXTRA_CFLAGS"
>
> +# extra-libs
> +LIBS="$LIBS $EXTRA_LIBS"
...but if you don't set LIBS until way down here there's no
point in defining EXTRA_LIBS early.
We should handle all the compiler-option related flags the
same way, I think, for consistency.
> +libs_softmmu="$libs_softmmu $EXTRA_LIBS"
> +libs_qga="$libs_qga $EXTRA_LIBS"
> +
> echo "Install prefix $prefix"
> echo "BIOS directory `eval echo $qemu_datadir`"
> echo "binary directory `eval echo $bindir`"
> @@ -4888,6 +4898,7 @@ fi
> echo "qemu_helperdir=$libexecdir" >> $config_host_mak
> echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
> echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
> +echo "extra_libs=$EXTRA_LIBS" >> $config_host_mak
> echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
> echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
thanks
-- PMM
[Qemu-devel] [RFC PATCH 3/4] include/qemu/atomic.h: default to __atomic functions, Alex Bennée, 2016/01/25