summaryrefslogtreecommitdiff
path: root/media-libs/x264/files/x264-x32.patch
blob: 7af4405a84720788182c605a264fa88fa18f53c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
https://bugs.gentoo.org/420241

initial x32 support -- no asm code, just pure C

--- a/configure
+++ b/configure
@@ -567,7 +567,13 @@ case $host_cpu in
     x86_64)
         ARCH="X86_64"
         AS="yasm"
-        [ $compiler = GNU ] && CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
+        if [ $compiler = GNU ]; then
+            if cpp_check "" "" "__ILP32__" ; then
+                CFLAGS="-mx32 $CFLAGS" && LDFLAGS="-mx32 $LDFLAGS"
+            else
+                CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
+            fi
+        fi
         if [ "$SYS" = MACOSX ]; then
             ASFLAGS="$ASFLAGS -f macho64 -m amd64 -DPIC -DPREFIX"
             if cc_check '' "-arch x86_64"; then
@@ -580,7 +586,11 @@ case $host_cpu in
             [ $compiler = GNU ] && cc_check "" "-S" && grep -q "_main:" conftest && ASFLAGS="$ASFLAGS -DPREFIX"
             [ $compiler = GNU ] && RCFLAGS="--target=pe-x86-64 $RCFLAGS"
         else
-            ASFLAGS="$ASFLAGS -f elf -m amd64"
+            if cpp_check "" "" "__ILP32__" ; then
+                AS="${cross_prefix}as"
+            else
+                ASFLAGS="$ASFLAGS -f elf -m amd64"
+            fi
         fi
         ;;
     powerpc|powerpc64)