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
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
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) )
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
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*
AS=$AS
ASFLAGS=$ASFLAGS
EXE=$EXE
-VIS=$vis
HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
DEVNULL=$DEVNULL
-GPL=$gpl
EOF
if [ "$shared" = "yes" ]; then