-m32 gives me mixture of 32- and 64-bit code

Hi all,

after reading and learning much more about GNU's configure and compile
machine than I ever wanted ;-), I arrived at configuring llvm-2.2 like
this:
  CFLAGS=-m32 CXXFLAGS=-m32 ./configure --prefix=$HOME

The assembler errors are finally gone (phew!, and thanks for all the
help!), but I get linker errors now:

llvm[3]: Linking Release Object Library LLVMX86.o
llvm[3]: Compiling DelaySlotFiller.cpp for Release build
/usr/bin/ld: Relocatable linking with relocations from format
elf64-x86-64
(/home/jo/Delta/llvm-2.2/lib/Target/X86/Release/X86ATTAsmPrinter.o) to
format elf32-i386 (/home/jo/Delta/llvm-2.2/Release/lib/LLVMX86.o) is not
supported
make[3]: *** [/home/jo/Delta/llvm-2.2/Release/lib/LLVMX86.o] Fehler 1

Seems like was told to link lib/Target/X86/Release/X86ATTAsmPrinter.o
(which is 64-bit) and Release/lib/LLVMX86.o (which is 32-bit).
The interesting question being: how did it manage to create a 64-bit
X86ATTAsmPrinter.o?

I tried throwing everything 32-bitty at it using
CFLAGS=-m32 CXXFLAGS=-m32 linux32 \
./configure --prefix=$HOME \
--host=i686-pc-linux-gnu \
--target=i686-pc-linux-gnu \
--build=i686-pc-linux-gnu; \
make
and, strangely enough, the above mismatch vanishes but I still get

/usr/bin/ld: skipping
incompatible /usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib32/libm.so when searching for -lm
/usr/bin/ld: skipping
incompatible /usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib32/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/../lib32/libm.so when
searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/../lib32/libm.a when
searching for -lm
/usr/bin/ld: skipping
incompatible /usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib32/libc.so when searching for -lc
/usr/bin/ld: skipping
incompatible /usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib32/libc.a when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/../lib32/libc.so when
searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/../lib32/libc.a when
searching for -lc
/usr/bin/ld: skipping
incompatible /usr/lib/gcc/x86_64-linux-gnu/4.1.3/32/libgcc_s.so when
searching for -lgcc_s
/usr/bin/ld: i386 architecture of input file
`/usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib32/crti.o' is
incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file
`/usr/lib/gcc/x86_64-linux-gnu/4.1.3/32/crtbeginS.o' is incompatible
with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file
`/usr/lib/gcc/x86_64-linux-gnu/4.1.3/32/crtendS.o' is incompatible with
i386:x86-64 output
/usr/bin/ld: i386 architecture of input file
`/usr/lib/gcc/x86_64-linux-gnu/4.1.3/../../../../lib32/crtn.o' is
incompatible with i386:x86-64 output
collect2: ld returned 1 exit status
make[3]: *** [/home/jo/Delta/llvm-2.2/Release/lib/LLVMHello.la] Fehler 1

meaning it's trying to combine 32-bit standard libs with something
64-bitty. (Does "i386:x86-64 output" mean ld is still trying to generate
64-bit executables? Maybe I need yet another option here...)

Anybody got an idea what's going on here?

Regards,
Jo