[x264-devel] [PATCH 1/3] x32 configure: add abi detection

Matthias Räncker theonetruecamper at gmx.de
Sun Jan 27 00:00:08 CET 2013


Signed-off-by: Matthias Räncker <theonetruecamper at gmx.de>
---
 configure | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index cb8f669..e8c83d7 100755
--- a/configure
+++ b/configure
@@ -527,6 +527,7 @@ case $host_os in
 esac
 
 LDFLAGS="$LDFLAGS $libm"
+SUBARCH=""
 
 aligned_stack=1
 case $host_cpu in
@@ -571,22 +572,33 @@ case $host_cpu in
         ;;
     x86_64)
         ARCH="X86_64"
+        SUBARCH="X86_64_X64"
         AS="yasm"
-        [ $compiler = GNU ] && CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
         if [ "$SYS" = MACOSX ]; then
             ASFLAGS="$ASFLAGS -f macho64 -m amd64 -DPIC -DPREFIX"
+            [ $compiler = GNU ] && CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
             if cc_check '' "-arch x86_64"; then
                 CFLAGS="$CFLAGS -arch x86_64"
                 LDFLAGS="$LDFLAGS -arch x86_64"
             fi
         elif [ "$SYS" = WINDOWS ]; then
             ASFLAGS="$ASFLAGS -f win32 -m amd64"
+            [ $compiler = GNU ] && CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
             # only the GNU toolchain is inconsistent in prefixing function names with _
             [ $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 "" "" "defined __x86_64__ && defined __ILP32__"; then
+                SUBARCH="X86_64_X32"
+                ASFLAGS="$ASFLAGS -f elf -m x32 -DARCH_$SUBARCH=1"
+                [ $compiler = GNU ] && CFLAGS="-mx32 $CFLAGS" && LDFLAGS="-mx32 $LDFLAGS"
+            else
+                ASFLAGS="$ASFLAGS -f elf -m amd64"
+                [ $compiler = GNU ] && CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
+            fi
         fi
+        [ $SUBARCH = "X86_64_X64" ] && define ARCH_X86_64_X32 0
+        [ $SUBARCH = "X86_64_X32" ] && define ARCH_X86_64_X64 0
         ;;
     powerpc|powerpc64)
         ARCH="PPC"
@@ -724,6 +736,7 @@ fi
 [ "x$AS" = x ] && asm="no" || asm="yes"
 
 define ARCH_$ARCH
+define ARCH_$SUBARCH
 define SYS_$SYS
 
 # skip endianness check for Intel Compiler, as all supported platforms are little. the -ipo flag will also cause the check to fail
@@ -1061,6 +1074,7 @@ bindir=$bindir
 libdir=$libdir
 includedir=$includedir
 ARCH=$ARCH
+SUBARCH=$SUBARCH
 SYS=$SYS
 CC=$CC
 CFLAGS=$CFLAGS
@@ -1172,7 +1186,7 @@ gpl_filters=""
 [ $gpl = yes ] && filters="$filters $gpl_filters"
 
 cat > conftest.log <<EOF
-platform:      $ARCH
+platform:      $ARCH $SUBARCH
 system:        $SYS
 cli:           $cli
 libx264:       $cli_libx264
-- 
1.8.1.1



More information about the x264-devel mailing list