+configure_system_override() {
+ log_check "system libx264 configuration"
+ x264_config_path="$1/x264_config.h"
+ if [ -e "$x264_config_path" ]; then
+ res=$?
+ log_ok
+ arg="$(grep '#define X264_GPL ' $x264_config_path | sed -e 's/#define X264_GPL *//; s/ *$//')"
+ if [ -n "$arg" ]; then
+ [ "$arg" = 0 ] && arg="no" || arg="yes"
+ [ "$arg" != "$gpl" ] && die "Incompatible license with system libx264"
+ fi
+ arg="$(grep '#define X264_BIT_DEPTH ' $x264_config_path | sed -e 's/#define X264_BIT_DEPTH *//; s/ *$//')"
+ if [ -n "$arg" ]; then
+ if [ "$arg" != "$bit_depth" ]; then
+ echo "Override output bit depth with system libx264 configuration"
+ bit_depth="$arg"
+ fi
+ fi
+ arg="$(grep '#define X264_CHROMA_FORMAT ' $x264_config_path | sed -e 's/#define X264_CHROMA_FORMAT *//; s/ *$//')"
+ if [ -n "$arg" ]; then
+ [ "$arg" = 0 ] && arg="all" || arg="${arg#X264_CSP_I}"
+ if [ "$arg" != "$chroma_format" ]; then
+ echo "Override output chroma format with system libx264 configuration"
+ chroma_format="$arg"
+ fi
+ fi
+ arg="$(grep '#define X264_INTERLACED ' $x264_config_path | sed -e 's/#define X264_INTERLACED *//; s/ *$//')"
+ if [ -n "$arg" ]; then
+ [ "$arg" = 0 ] && arg="no" || arg="yes"
+ if [ "$arg" != "$interlaced" ]; then
+ echo "Override interlaced encoding support with system libx264 configuration"
+ interlaced="$arg"
+ fi
+ fi
+ else
+ res=$?
+ log_fail
+ log_msg "Failed search path was: $x264_config_path"
+ fi
+ return $res
+}
+