From 3145e67de9ec38ab5432023286f285e467355c05 Mon Sep 17 00:00:00 2001 From: James Darnley Date: Fri, 17 Sep 2010 04:06:59 -0700 Subject: [PATCH] Add --disable-gpl option to configure Used for commercially-licensed versions of x264. Doesn't currently change anything, but may be used to disable GPL-only CLI tools, such as video filters, in the future. Also print the x264 license and libavformat license in version info. --- Makefile | 5 +++++ configure | 15 +++++++++++++++ filters/video/video.c | 2 ++ x264.c | 45 +++++++++++++++++++++++++++++++------------ 4 files changed, 55 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 0f4d0cf7..bab55e54 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,11 @@ SRCSO = CONFIG := $(shell cat config.h) +# GPL-only files +ifeq ($(GPL),yes) +SRCCLI += +endif + # Optional module sources ifneq ($(findstring HAVE_AVS, $(CONFIG)),) SRCCLI += input/avs.c diff --git a/configure b/configure index 21f5166b..1ad2b579 100755 --- a/configure +++ b/configure @@ -11,6 +11,7 @@ echo " --disable-avs disables avisynth support (windows only)" echo " --disable-lavf disables libavformat support" echo " --disable-ffms disables ffmpegsource support" echo " --disable-gpac disables gpac support" +echo " --disable-gpl disables GPL-only features" echo " --disable-pthread disables multithreaded encoding" echo " --disable-swscale disables swscale support" echo " --disable-asm disables platform-specific assembly optimizations" @@ -138,6 +139,7 @@ avs="auto" lavf="auto" ffms="auto" gpac="auto" +gpl="yes" pthread="auto" swscale="auto" asm="auto" @@ -192,6 +194,9 @@ for opt do --disable-gpac) gpac="no" ;; + --disable-gpl) + gpl="no" + ;; --extra-asflags=*) ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}" ;; @@ -709,6 +714,12 @@ fi define BIT_DEPTH $bit_depth +if [ $gpl = yes ]; then + define HAVE_GPL 1 +else + define HAVE_GPL 0 +fi + rm -f conftest* # generate config files @@ -734,6 +745,7 @@ EXE=$EXE VIS=$vis HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG DEVNULL=$DEVNULL +GPL=$gpl EOF if [ "$shared" = "yes" ]; then @@ -776,7 +788,9 @@ Cflags: -I$includedir EOF filters="crop select_every" +gpl_filters="" [ $swscale = yes ] && filters="resize $filters" +[ $gpl = yes ] && filters="$filters $gpl_filters" cat > conftest.log < #include #include #endif @@ -199,6 +201,36 @@ void x264_cli_printf( int i_level, const char *fmt, ... ) va_end( arg ); } +static void print_version_info() +{ +#ifdef X264_POINTVER + printf( "x264 "X264_POINTVER"\n" ); +#else + printf( "x264 0.%d.X\n", X264_BUILD ); +#endif + printf( "built on " __DATE__ ", " ); +#ifdef __GNUC__ + printf( "gcc: " __VERSION__ "\n" ); +#else + printf( "using a non-gcc compiler\n" ); +#endif + printf( "configuration: --bit-depth=%d\n", BIT_DEPTH ); + printf( "x264 license: " ); +#if HAVE_GPL + printf( "GPL version 2 or later\n" ); +#else + printf( "Non-GPL commercial\n" ); +#endif +#if HAVE_LAVF + const char *license = avformat_license(); + printf( "libavformat license: %s\n", license ); + if( !strcmp( license, "nonfree and unredistributable" ) || + (!HAVE_GPL && (!strcmp( license, "GPL version 2 or later" ) + || !strcmp( license, "GPL version 3 or later" )))) + printf( "WARNING: This binary is unredistributable!\n" ); +#endif +} + /**************************************************************************** * main: ****************************************************************************/ @@ -1153,18 +1185,7 @@ static int Parse( int argc, char **argv, x264_param_t *param, cli_opt_t *opt ) Help( &defaults, 2 ); exit(0); case 'V': -#ifdef X264_POINTVER - printf( "x264 "X264_POINTVER"\n" ); -#else - printf( "x264 0.%d.X\n", X264_BUILD ); -#endif - printf( "built on " __DATE__ ", " ); -#ifdef __GNUC__ - printf( "gcc: " __VERSION__ "\n" ); -#else - printf( "using a non-gcc compiler\n" ); -#endif - printf( "configuration: --bit-depth=%d\n", BIT_DEPTH ); + print_version_info(); exit(0); case OPT_FRAMES: param->i_frame_total = X264_MAX( atoi( optarg ), 0 ); -- 2.39.2