]> granicus.if.org Git - libx264/commitdiff
Attempt to fix build on Linux PPC
authorEric Petit <titer@videolan.org>
Tue, 27 Jul 2004 08:34:59 +0000 (08:34 +0000)
committerEric Petit <titer@videolan.org>
Tue, 27 Jul 2004 08:34:59 +0000 (08:34 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@14 df754926-b1dd-0310-bc7b-ec298dee348c

Jamfile
Makefile
core/cpu.c
core/mc.c
core/pixel.c
core/ppc/mc.c
core/ppc/pixel.c
testing/checkasm.c

diff --git a/Jamfile b/Jamfile
index 7084c5249d9ff967c0542a36f425f1f8f1f7a42e..43b0a5369e930d530935fdd825526b2e0a129a97 100644 (file)
--- a/Jamfile
+++ b/Jamfile
@@ -11,13 +11,13 @@ AS = nasm ;
 CCFLAGS = -g -Wall -W ;
 
 # Globals defines
-DEFINES = DEBUG __X264__ ;
+DEFINES = DEBUG __X264__ ARCH_$(OSPLAT) SYS_$(OS) ;
 
 # Optims
 OPTIM = -O3 -funroll-loops ;
 
 # Headers rep
-HDRS = . core core/i366 decoder encoder ;
+HDRS = . core core/i386 decoder encoder ;
 
 SOURCES_C = core/mc.c core/predict.c core/pixel.c core/macroblock.c
             core/frame.c core/dct.c core/cpu.c core/cabac.c
@@ -33,22 +33,29 @@ SOURCES_ALTIVEC = core/ppc/mc.c core/ppc/pixel.c ;
 
 # libx264
 SOURCES_X264 = $(SOURCES_C) ;
-if $(OS) = LINUX
+if $(OSPLAT) = X86
 {
-    DEFINES      += ARCH_X86 HAVE_MMXEXT HAVE_SSE2 HAVE_MALLOC_H ;
+    DEFINES      += HAVE_MALLOC_H HAVE_MMXEXT HAVE_SSE2 ;
     SOURCES_X264 += $(SOURCES_MMX) ;
     SOURCES_X264 += $(SOURCES_X86) ;
-    ASFLAGS = -f elf ;
+    ASFLAGS       = -f elf ;
 
-    # Don't ask why
+    # Don't ask
     NOARUPDATE = false ;
 }
-if $(OS) = MACOSX
+if $(OSPLAT) = PPC
 {
-    DEFINES      += HAVE_ALTIVEC ;
     SOURCES_X264 += $(SOURCES_ALTIVEC) ;
-    CCFLAGS      += -faltivec ;
-#    OPTIM        += -falign-loops=16 ;
+    OPTIM        += -falign-loops=16 ;
+
+    if $(OS) = MACOSX
+    {
+        CCFLAGS += -faltivec ;
+    }
+    if $(OS) = LINUX
+    {
+        CCFLAGS += -maltivec -mabi=altivec ;
+    }
 }
 Library libx264 : $(SOURCES_X264) ;
 
index 7c2141244f783f0be14014be02c9003a761731c6..49199c1b23fb614960956580a0336d9b7e71ec6d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # Makefile: tuned for i386/MMX system only
 # For ppc append
 #  SRCS: core/ppc/mc.c core/ppc/pixel.c 
-#  Defines: HAVE_ALTIVEC
+#  Defines: HAVE_PPC
 #  CFLAGS: -faltivec
 #
 PFLAGS=-DARCH_X86 -DHAVE_MMXEXT -DHAVE_SSE2
index 8e6d1e3e9762f7350d17bfe1d3df62af617e77bd..9df01da4b94b02393bf04042008e87e3bded149e 100644 (file)
@@ -194,12 +194,13 @@ uint32_t x264_cpu_detect( void )
 }
 #endif
 
-#elif defined( HAVE_ALTIVEC )
-#include <sys/sysctl.h>
+#elif defined( ARCH_PPC )
 
+#ifdef SYS_MACOSX
+#include <sys/sysctl.h>
 uint32_t x264_cpu_detect( void )
 {
-    /* Thx VLC */
+    /* Thank you VLC */
     uint32_t cpu = 0;
     int      selectors[2] = { CTL_HW, HW_VECTORUNIT };
     int      has_altivec = 0;
@@ -214,6 +215,14 @@ uint32_t x264_cpu_detect( void )
     return cpu;
 }
 
+#elif defined( SYS_LINUX )
+uint32_t x264_cpu_detect( void )
+{
+    /* FIXME (Linux PPC) */
+    return X264_CPU_ALTIVEC;
+}
+#endif
+
 void     x264_cpu_restore( uint32_t cpu )
 {
 }
index 2c3fd792654e821f4e2fc1e88f161493371f7155..fbb548d5a17b7c459daebeb582b47fe33cfe91aa 100644 (file)
--- a/core/mc.c
+++ b/core/mc.c
@@ -37,7 +37,7 @@
 #ifdef HAVE_MMXEXT
 #   include "i386/mc.h"
 #endif
-#ifdef HAVE_ALTIVEC
+#ifdef ARCH_PPC
 #   include "ppc/mc.h"
 #endif
 
@@ -313,7 +313,7 @@ void x264_mc_init( int cpu, x264_mc_function_t pf[2] )
         x264_mc_sse2_init( pf );
 #endif
 
-#ifdef HAVE_ALTIVEC
+#ifdef ARCH_PPC
     if( cpu&X264_CPU_ALTIVEC )
         x264_mc_altivec_init( pf );
 #endif
index f06a099e071f30a35f6d7e7c1364c2e8b9b71ac6..7fa93f2a4af69f7fab80c995a3d29624fa33b807 100644 (file)
@@ -31,7 +31,7 @@
 #ifdef HAVE_MMXEXT
 #   include "i386/pixel.h"
 #endif
-#ifdef HAVE_ALTIVEC
+#ifdef ARCH_PPC
 #   include "ppc/pixel.h"
 #endif
 
@@ -218,7 +218,7 @@ void x264_pixel_init( int cpu, x264_pixel_function_t *pixf )
         pixf->satd[PIXEL_4x4]  = x264_pixel_satd_4x4_mmxext;
     }
 #endif
-#ifdef HAVE_ALTIVEC
+#ifdef ARCH_PPC
     if( cpu&X264_CPU_ALTIVEC )
     {
         x264_pixel_altivec_init( pixf );
index f4b54d77c506479b94a89fee37c4f6ce7c4f210b..0aa6eccae9f4b01878b94be693225e237c949550 100644 (file)
 #include <string.h>
 #include <stdint.h>
 
+#ifdef SYS_LINUX
+#include <altivec.h>
+#endif
+
 #include "x264.h"
 #include "../mc.h"
 #include "../clip1.h"
index 16cbcc5d143f61bb761b11b964860574e2fc1c4e..ec163c139b6f8c2e0d477c98a1dc3d3b0e4c2031 100644 (file)
 #include <string.h>
 #include <stdint.h>
 
+#ifdef SYS_LINUX
+#include <altivec.h>
+#endif
+
 #include "x264.h"
 #include "../pixel.h"
 #include "pixel.h"
index eea3a1e4f8920dcc1f1e95573e99137cad4a27c4..1c5ab7e0aa5fc74d173b97cc940b454c79a43027 100644 (file)
@@ -9,7 +9,7 @@
 #include "core/i386/dct.h"
 #include "core/i386/mc.h"
 #endif
-#ifdef HAVE_ALTIVEC
+#ifdef ARCH_PPC
 #include "core/ppc/pixel.h"
 #endif
 
@@ -30,7 +30,7 @@ static int check_pixel()
 #ifdef HAVE_MMXEXT
     x264_pixel_init( X264_CPU_MMX|X264_CPU_MMXEXT, &pixel_asm );
 #endif
-#ifdef HAVE_ALTIVEC
+#ifdef ARCH_PPC
     x264_pixel_altivec_init( &pixel_asm );
 #endif
 
@@ -311,7 +311,7 @@ int main()
 
 #ifdef HAVE_MMXEXT
     fprintf( stderr, "x264: MMXEXT against C\n" );
-#elif HAVE_ALTIVEC
+#elif ARCH_PPC
     fprintf( stderr, "x264: ALTIVEC against C\n" );
 #endif