From 21877a04337d044dfcd93cca957967662dbdd6d6 Mon Sep 17 00:00:00 2001 From: Steven Walters Date: Mon, 22 Nov 2010 10:31:05 +0900 Subject: [PATCH] Fix configure so that boolean configuration options are 1/0 There are many cases of 1/undef, not 1/0. --- Makefile | 14 +++++++------- common/arm/asm.S | 4 ++-- common/bitstream.c | 4 ++-- common/macroblock.h | 2 +- configure | 16 +++++++++------- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 21f57e7c..6344ca4f 100644 --- a/Makefile +++ b/Makefile @@ -25,34 +25,34 @@ SRCSO = CONFIG := $(shell cat config.h) # GPL-only files -ifeq ($(GPL),yes) +ifneq ($(findstring HAVE_GPL 1, $(CONFIG)),) SRCCLI += endif # Optional module sources -ifneq ($(findstring HAVE_AVS, $(CONFIG)),) +ifneq ($(findstring HAVE_AVS 1, $(CONFIG)),) SRCCLI += input/avs.c endif -ifneq ($(findstring HAVE_PTHREAD, $(CONFIG)),) +ifneq ($(findstring HAVE_PTHREAD 1, $(CONFIG)),) SRCCLI += input/thread.c SRCS += common/threadpool.c endif -ifneq ($(findstring HAVE_LAVF, $(CONFIG)),) +ifneq ($(findstring HAVE_LAVF 1, $(CONFIG)),) SRCCLI += input/lavf.c endif -ifneq ($(findstring HAVE_FFMS, $(CONFIG)),) +ifneq ($(findstring HAVE_FFMS 1, $(CONFIG)),) SRCCLI += input/ffms.c endif -ifneq ($(findstring HAVE_GPAC, $(CONFIG)),) +ifneq ($(findstring HAVE_GPAC 1, $(CONFIG)),) SRCCLI += output/mp4.c endif # Visualization sources -ifeq ($(VIS),yes) +ifneq ($(findstring HAVE_VISUALIZE 1, $(CONFIG)),) SRCS += common/visualize.c common/display-x11.c endif diff --git a/common/arm/asm.S b/common/arm/asm.S index 74342622..1bf2a007 100644 --- a/common/arm/asm.S +++ b/common/arm/asm.S @@ -56,7 +56,7 @@ ELF .type \name, %function .endm .macro movrel rd, val -#if defined(HAVE_ARMV6T2) && !defined(PIC) +#if HAVE_ARMV6T2 && !defined(PIC) movw \rd, #:lower16:\val movt \rd, #:upper16:\val #else @@ -65,7 +65,7 @@ ELF .type \name, %function .endm .macro movconst rd, val -#ifdef HAVE_ARMV6T2 +#if HAVE_ARMV6T2 movw \rd, #:lower16:\val .if \val >> 16 movt \rd, #:upper16:\val diff --git a/common/bitstream.c b/common/bitstream.c index 8350fb35..0f2bc9fb 100644 --- a/common/bitstream.c +++ b/common/bitstream.c @@ -39,7 +39,7 @@ static uint8_t *x264_nal_escape_c( uint8_t *dst, uint8_t *src, uint8_t *end ) return dst; } -#ifdef HAVE_MMX +#if HAVE_MMX uint8_t *x264_nal_escape_mmxext( uint8_t *dst, uint8_t *src, uint8_t *end ); uint8_t *x264_nal_escape_sse2( uint8_t *dst, uint8_t *src, uint8_t *end ); #endif @@ -88,7 +88,7 @@ void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal ) void x264_bitstream_init( int cpu, x264_bitstream_function_t *pf ) { pf->nal_escape = x264_nal_escape_c; -#ifdef HAVE_MMX +#if HAVE_MMX if( cpu&X264_CPU_MMXEXT ) pf->nal_escape = x264_nal_escape_mmxext; if( (cpu&X264_CPU_SSE2) && (cpu&X264_CPU_SSE2_IS_FAST) ) diff --git a/common/macroblock.h b/common/macroblock.h index 75629487..ce4ead98 100644 --- a/common/macroblock.h +++ b/common/macroblock.h @@ -364,7 +364,7 @@ static ALWAYS_INLINE uint32_t pack16to32_mask( int a, int b ) } static ALWAYS_INLINE uint64_t pack32to64( uint32_t a, uint32_t b ) { -#ifdef WORDS_BIGENDIAN +#if WORDS_BIGENDIAN return b + ((uint64_t)a<<32); #else return a + ((uint64_t)b<<32); diff --git a/configure b/configure index fd623375..8ca32984 100755 --- a/configure +++ b/configure @@ -171,6 +171,9 @@ cross_prefix="" EXE="" +# list of all preprocessor HAVE values we can define +CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON PTHREAD LOG2F VISUALIZE SWSCALE LAVF FFMS GPAC GF_MALLOC AVS GPL" + # parse options for opt do @@ -735,11 +738,12 @@ fi define BIT_DEPTH $bit_depth ASFLAGS="$ASFLAGS -DBIT_DEPTH=$bit_depth" -if [ $gpl = yes ]; then - define HAVE_GPL 1 -else - define HAVE_GPL 0 -fi +[ $gpl = yes ] && define HAVE_GPL + +#define undefined vars as 0 +for var in $CONFIG_HAVE; do + grep -q "HAVE_$var 1" config.h || define HAVE_$var 0 +done rm -f conftest* @@ -763,10 +767,8 @@ STRIP=$STRIP AS=$AS ASFLAGS=$ASFLAGS EXE=$EXE -VIS=$vis HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG DEVNULL=$DEVNULL -GPL=$gpl EOF if [ "$shared" = "yes" ]; then -- 2.47.3