From: Alex Izvorski Date: Tue, 5 Jun 2007 18:38:31 +0000 (+0000) Subject: allow compiling without yasm/nasm on x86 and x86-64 platforms X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=17dd119d8275224ad7f830dcdf4a5458150fcd31;p=libx264 allow compiling without yasm/nasm on x86 and x86-64 platforms git-svn-id: svn://svn.videolan.org/x264/trunk@658 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/Makefile b/Makefile index 8e81ba04..4400cd5c 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ endif # MMX/SSE optims ifeq ($(ARCH),X86) +ifneq ($(AS),) SRCS += common/i386/mc-c.c common/i386/predict-c.c ASMSRC = common/i386/dct-a.asm common/i386/cpu-a.asm \ common/i386/pixel-a.asm common/i386/mc-a.asm \ @@ -28,9 +29,11 @@ ASMSRC = common/i386/dct-a.asm common/i386/cpu-a.asm \ OBJASM = $(ASMSRC:%.asm=%.o) ASFLAGS += -Icommon/i386/ endif +endif # MMX/SSE optims ifeq ($(ARCH),X86_64) +ifneq ($(AS),) SRCS += common/i386/mc-c.c common/i386/predict-c.c ASMSRC = common/amd64/dct-a.asm common/amd64/cpu-a.asm \ common/amd64/pixel-a.asm common/amd64/mc-a.asm \ @@ -40,6 +43,7 @@ ASMSRC = common/amd64/dct-a.asm common/amd64/cpu-a.asm \ OBJASM = $(ASMSRC:%.asm=%.o) ASFLAGS += -Icommon/amd64 endif +endif # AltiVec optims ifeq ($(ARCH),PPC) diff --git a/common/cpu.c b/common/cpu.c index 62235c3a..9640e10f 100644 --- a/common/cpu.c +++ b/common/cpu.c @@ -37,7 +37,7 @@ #include "common.h" -#if defined(ARCH_X86) || defined(ARCH_X86_64) +#if ( defined(ARCH_X86) || defined(ARCH_X86_64) ) && defined(HAVE_MMX) extern int x264_cpu_cpuid_test( void ); extern uint32_t x264_cpu_cpuid( uint32_t op, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx ); extern void x264_emms( void ); @@ -49,10 +49,6 @@ uint32_t x264_cpu_detect( void ) uint32_t eax, ebx, ecx, edx; int b_amd; -#ifndef HAVE_MMX - return 0; -#endif - if( !x264_cpu_cpuid_test() ) { /* No cpuid */ diff --git a/configure b/configure index 3d192054..bb7c895b 100755 --- a/configure +++ b/configure @@ -147,7 +147,6 @@ esac case "${MACHINE%%-*}" in i*86) ARCH="X86" - CFLAGS="$CFLAGS -DHAVE_MMX" AS="yasm" ASFLAGS="-O2" if [ "$SYS" = MACOSX ]; then @@ -163,7 +162,6 @@ case "${MACHINE%%-*}" in ;; x86_64) ARCH="X86_64" - CFLAGS="$CFLAGS -DHAVE_MMX" AS="yasm" ASFLAGS="-f elf -m amd64" ;; @@ -215,19 +213,23 @@ then then echo "Your version of 'nasm' is too old." echo "Please install Xcode 2.4.1 or later." - exit 1 + AS="" fi fi if [ $ARCH = X86 -o $ARCH = X86_64 ] ; then - if ! as_check ; then - echo "No assembler. Please install yasm." - exit 1 + if as_check ; then + CFLAGS="$CFLAGS -DHAVE_MMX" fi if as_check "pabsw xmm0, xmm0" ; then ASFLAGS="$ASFLAGS -DHAVE_SSE3" CFLAGS="$CFLAGS -DHAVE_SSE3" fi + if ! as_check ; then + echo "No suitable assembler found. x264 will be several times slower." + echo "Please install 'yasm' to get MMX/SSE optimized code." + AS="" + fi fi CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS"