Re: [PATCH] [RESEND] Add cross compile to top level configuration file

Jerone Young
2007-10-16T19:08:28Z

On Tue, 2007-10-16 at 11:59 +0200, Avi Kivity wrote:
> Jerone Young wrote:
> > This new patch removes gcc 3.x checks, as well as adds environment
> > variables $CFLAGS & $LDFLAGS to include libs to qemu for cross compile.
> > I was going to add this in another patch. But they should probably go in
> > now. So an example for power is to include zlib so before running
> > configure you do:
> > export LDFLAGS="-L/home/public/zlib-ppc/lib"
> > export CFLAGS="-I/home/public/zlib-ppc/include"
> >
> >
>
> Let's not add dependencies on environment variables. Explicit --options
> please.

ok will do this in the next redo.

>
> > Signed-on-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> >
> > diff -r ff2feafadcac configure
> > --- a/configure Fri Oct 12 07:35:25 2007 -0500
> > +++ b/configure Mon Oct 15 21:52:51 2007 -0500
> > @@ -3,32 +3,29 @@ prefix=/usr/local
> > prefix=/usr/local
> > kerneldir=/lib/modules/$(uname -r)/build
> > want_module=1
> > -qemu_cc=$(ls /usr/bin/gcc3* /usr/bin/gcc-3* 2>/dev/null | tail -n1)
> >
>
>
> > +cc=gcc
> > disable_gcc_check=
> > +cross_prefix=
> > +arch=`uname -m`
> > +target_exec=
> >
> > usage() {
> > cat <<-EOF
> > Usage: $0 [options]
> >
> > Options include:
> > -
> > + --arch=ARCH architecture to compile for ($arch)
> > + --cross-prefix=PREFIX prefix for cross compiler
> > --prefix=PREFIX where to install things ($prefix)
> > --with-patched-kernel don't use external module
> > --kerneldir=DIR kernel build directory ($kerneldir)
> > - --qemu-cc="$qemu_cc" compiler for qemu (needs gcc3.x) ($qemu_cc)
> > + --qemu-cc=CC compiler for qemu (needs to be gcc 3.x)
> > + Not valid if used with --cross-prefix
> > --disable-gcc-check don't insist on gcc-3.x
> > - - this will break running without kvm
> > + CAUTION: using this option may break build
> >
>
> Looks like a step back in terms of the amount of information provided to
> the user.

I'll add the text back with the CAUTION:

>
> > while [[ "$1" = -* ]]; do
> > opt="$1"; shift
> > @@ -48,11 +45,17 @@ while [[ "$1" = -* ]]; do
> > want_module=
> > ;;
> > --qemu-cc)
> > - qemu_cc="$arg"
> > + cc="$arg"
> >
>
> This forces everything to be compiled with $cc, not just qemu? Or is
> the kernel/ dierctory not affected by this?

I can create two but it will make things very complicated. This only
will effect the qemu and user directory, but not the kernel directory.
Currently kernel directory is used for headers by these two.

If a user wants to change this they can run the configure script in user
directory manually.

Really I can just change it to just the option is --cc and remove the
qemu part. That actually makes more since.

Otherwise you end up with something more complicated like having to
specify which one needs the cross compiler and not, which need this
specific gcc, just bad. Really you should be compiling both with the
same gcc anyway. If you want to do something different then you really
should go into both directories and run configure stand alone.

>
> > +qemudir=`pwd`/qemu
> >
>
> Add quoting so we can pretend we're safe in the presence of whitespace
> in $PWD.