On 2015-02-27 11:47:08 +0200, Martin Storsjö wrote:
> On Fri, 27 Feb 2015, Janne Grunau wrote:
> 
> >From: Janne Grunau <[email protected]>
> >
> >---8<---
> >This is not as nice as one would hope. Another option would be
> >using a flags filter for -march. That would leave LD in the dark
> >about crosscompiling though.
> >I'm also not sure if -arch has the same meaning as -march=. Judging
> >from the compiler defines it does though:
> >
> >'clang -arch armv7 -dM -E -x c /dev/null' differs from
> >'clang -arch armv7s ...'
> >
> >So this ugly if in probe_cc is the best option I see.
> >
> >Janne
> >
> >---
> >configure | 7 +++++++
> >1 file changed, 7 insertions(+)
> >
> >diff --git a/configure b/configure
> >index 59c19a8..7e4f169 100755
> >--- a/configure
> >+++ b/configure
> >@@ -2911,6 +2911,13 @@ probe_cc(){
> >        _depflags='-MMD -MF $(@:.o=.d) -MT $@'
> >        _cflags_speed='-O3'
> >        _cflags_size='-Os'
> >+    # handle cross compilation for Apple's clang
> >+    if enabled cross_compile && [ $(expr "$_ident" : "Apple LLVM") = 10 ] ; 
> >then
> >+        case $pfx in
> >+            as|cc|ld) _flags="-arch $arch";;
> >+            *)        ;;
> >+        esac
> >+    fi
> 
> FWIW, this breaks existing configure setups (e.g. a setup like
> "--enable-cross-compile --arch=arm --target-os=darwin --cc='clang
> -arch armv7 -isysroot /...'" will end up adding an extra -arch arm
> to the clang command line, which breaks things).

hmm, I didn't thought about passing '-arch' in cc, I always used 
--extra-{c,ld}flags.

The laziest way to fix this would be adding a ["$toolchain" = 
"xcode-ios"] to the if condition but then I could move it there and just 
set {AS,C,LD}FLAGS directly. I thought it would be nice if it handled 
other cases too.

I'd consider checking $_cc whether it contains ' -arch ' if the rest of 
the check would be clean.

btw configure will handle --arch=armv7s? just fine.

Another problem of the patch is that I shouldn't use $arch directly.  
clang doesn't understand -arch aarch64 and for arm we probably should 
choose it based on arch and cpu.

Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to