From bf06e99e9b054a3f671a6f3f0c62d9b204057b0b Mon Sep 17 00:00:00 2001 From: Eric Petit Date: Tue, 27 Jul 2004 08:34:59 +0000 Subject: [PATCH] Attempt to fix build on Linux PPC git-svn-id: svn://svn.videolan.org/x264/trunk@14 df754926-b1dd-0310-bc7b-ec298dee348c --- Jamfile | 27 +++++++++++++++++---------- Makefile | 2 +- core/cpu.c | 15 ++++++++++++--- core/mc.c | 4 ++-- core/pixel.c | 4 ++-- core/ppc/mc.c | 4 ++++ core/ppc/pixel.c | 4 ++++ testing/checkasm.c | 6 +++--- 8 files changed, 45 insertions(+), 21 deletions(-) diff --git a/Jamfile b/Jamfile index 7084c524..43b0a536 100644 --- 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) ; diff --git a/Makefile b/Makefile index 7c214124..49199c1b 100644 --- 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 diff --git a/core/cpu.c b/core/cpu.c index 8e6d1e3e..9df01da4 100644 --- a/core/cpu.c +++ b/core/cpu.c @@ -194,12 +194,13 @@ uint32_t x264_cpu_detect( void ) } #endif -#elif defined( HAVE_ALTIVEC ) -#include +#elif defined( ARCH_PPC ) +#ifdef SYS_MACOSX +#include 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 ) { } diff --git a/core/mc.c b/core/mc.c index 2c3fd792..fbb548d5 100644 --- 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 diff --git a/core/pixel.c b/core/pixel.c index f06a099e..7fa93f2a 100644 --- a/core/pixel.c +++ b/core/pixel.c @@ -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 ); diff --git a/core/ppc/mc.c b/core/ppc/mc.c index f4b54d77..0aa6ecca 100644 --- a/core/ppc/mc.c +++ b/core/ppc/mc.c @@ -26,6 +26,10 @@ #include #include +#ifdef SYS_LINUX +#include +#endif + #include "x264.h" #include "../mc.h" #include "../clip1.h" diff --git a/core/ppc/pixel.c b/core/ppc/pixel.c index 16cbcc5d..ec163c13 100644 --- a/core/ppc/pixel.c +++ b/core/ppc/pixel.c @@ -26,6 +26,10 @@ #include #include +#ifdef SYS_LINUX +#include +#endif + #include "x264.h" #include "../pixel.h" #include "pixel.h" diff --git a/testing/checkasm.c b/testing/checkasm.c index eea3a1e4..1c5ab7e0 100644 --- a/testing/checkasm.c +++ b/testing/checkasm.c @@ -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 -- 2.40.0