[FFmpeg-cvslog] Merge commit 'b62ed6873821c8fce8f7e2c2927ae54f86afeb22'

James Almer git at videolan.org
Thu Oct 26 22:15:39 EEST 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Oct 26 16:14:54 2017 -0300| [cdba33c45f79900a5dc6c5699acd4b7bdef78745] | committer: James Almer

Merge commit 'b62ed6873821c8fce8f7e2c2927ae54f86afeb22'

* commit 'b62ed6873821c8fce8f7e2c2927ae54f86afeb22':
  configure: Better names for functions that sanitize input

Merged-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cdba33c45f79900a5dc6c5699acd4b7bdef78745
---

 configure | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/configure b/configure
index 2e0236285e..0e1ccaac58 100755
--- a/configure
+++ b/configure
@@ -584,13 +584,13 @@ sanitize_var_name(){
     echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
 }
 
-set_safe(){
+set_sanitized(){
     var=$1
     shift
     eval $(sanitize_var_name "$var")='$*'
 }
 
-get_safe(){
+get_sanitized(){
     eval echo \$$(sanitize_var_name "$1")
 }
 
@@ -636,13 +636,13 @@ disable_weak(){
     set_weak no $*
 }
 
-enable_safe(){
+enable_sanitized(){
     for var; do
         enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
     done
 }
 
-disable_safe(){
+disable_sanitized(){
     for var; do
         disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
     done
@@ -1108,8 +1108,8 @@ check_header(){
     log check_header "$@"
     header=$1
     shift
-    disable_safe $header
-    check_cpp "$@" <<EOF && enable_safe $header
+    disable_sanitized $header
+    check_cpp "$@" <<EOF && enable_sanitized $header
 #include <$header>
 int x;
 EOF
@@ -1120,11 +1120,11 @@ check_header_objcc(){
     rm -f -- "$TMPO"
     header=$1
     shift
-    disable_safe $header
+    disable_sanitized $header
     {
        echo "#include <$header>"
        echo "int main(void) { return 0; }"
-    } | check_objcc && check_stat "$TMPO" && enable_safe $header
+    } | check_objcc && check_stat "$TMPO" && enable_sanitized $header
 }
 
 check_apple_framework(){
@@ -1196,7 +1196,7 @@ check_func_headers(){
             echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
         done
         echo "return ret; }"
-    } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
+    } | check_ld "cc" "$@" && enable $funcs && enable_sanitized $headers
 }
 
 check_class_headers_cpp(){
@@ -1215,7 +1215,7 @@ check_class_headers_cpp(){
             i=$(expr $i + 1)
         done
         echo "return 0; }"
-    } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
+    } | check_ld "cxx" "$@" && enable $funcs && enable_sanitized $headers
 }
 
 check_cpp_condition(){
@@ -1282,8 +1282,8 @@ check_pkg_config(){
     pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
     check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
         enable $name &&
-        set_safe "${name}_cflags"    $pkg_cflags &&
-        set_safe "${name}_extralibs" $pkg_libs
+        set_sanitized "${name}_cflags"    $pkg_cflags &&
+        set_sanitized "${name}_extralibs" $pkg_libs
 }
 
 check_exec(){
@@ -1326,8 +1326,8 @@ check_type(){
     headers=$1
     type=$2
     shift 2
-    disable_safe "$type"
-    check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
+    disable_sanitized "$type"
+    check_code cc "$headers" "$type v" "$@" && enable_sanitized "$type"
 }
 
 check_struct(){
@@ -1336,9 +1336,9 @@ check_struct(){
     struct=$2
     member=$3
     shift 3
-    disable_safe "${struct}_${member}"
+    disable_sanitized "${struct}_${member}"
     check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
-        enable_safe "${struct}_${member}"
+        enable_sanitized "${struct}_${member}"
 }
 
 check_builtin(){
@@ -1398,7 +1398,7 @@ use_pkg_config(){
     log use_pkg_config "$@"
     name="$1"
     check_pkg_config "$@" || return 1
-    add_cflags    $(get_safe "${name}_cflags")
+    add_cflags    $(get_sanitized "${name}_cflags")
 }
 
 require_pkg_config(){
@@ -6183,7 +6183,7 @@ rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || d
 # check V4L2 codecs available in the API
 check_header linux/fb.h
 check_header linux/videodev2.h
-check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
+check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
 check_code cc linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" || disable v4l2_m2m
 check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;" && enable vc1_v4l2_m2m
 check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;" && enable mpeg1_v4l2_m2m
@@ -6196,7 +6196,7 @@ check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" && enable vp8_v4l2_m
 check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" && enable vp9_v4l2_m2m
 
 check_header sys/videoio.h
-check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
+check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
 
 check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
 check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
@@ -6216,9 +6216,9 @@ check_type "dshow.h" IBaseFilter
 check_header dev/ic/bt8xx.h
 
 if check_struct sys/soundcard.h audio_buf_info bytes; then
-    enable_safe sys/soundcard.h
+    enable_sanitized sys/soundcard.h
 else
-    check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
+    check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_sanitized sys/soundcard.h
     #include <sys/soundcard.h>
     audio_buf_info abc;
 EOF


======================================================================

diff --cc configure
index 2e0236285e,ecc77842ff..0e1ccaac58
--- a/configure
+++ b/configure
@@@ -1115,28 -944,6 +1115,28 @@@ int x
  EOF
  }
  
 +check_header_objcc(){
 +    log check_header_objcc "$@"
 +    rm -f -- "$TMPO"
 +    header=$1
 +    shift
-     disable_safe $header
++    disable_sanitized $header
 +    {
 +       echo "#include <$header>"
 +       echo "int main(void) { return 0; }"
-     } | check_objcc && check_stat "$TMPO" && enable_safe $header
++    } | check_objcc && check_stat "$TMPO" && enable_sanitized $header
 +}
 +
 +check_apple_framework(){
 +    log check_apple_framework "$@"
 +    framework="$1"
 +    name="$(tolower $framework)"
 +    header="${framework}/${framework}.h"
 +    disable $name
 +    check_header_objcc $header &&
 +        enable $name && eval ${name}_extralibs='"-framework $framework"'
 +}
 +
  check_func(){
      log check_func "$@"
      func=$1
@@@ -1190,32 -981,8 +1190,32 @@@ check_func_headers()
          for func in $funcs; do
              echo "long check_$func(void) { return (long) $func; }"
          done
 -        echo "int main(void) { return 0; }"
 -    } | check_ld "$@" && enable $funcs && enable_sanitized $headers
 +        echo "int main(void) { int ret = 0;"
 +        # LTO could optimize out the test functions without this
 +        for func in $funcs; do
 +            echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
 +        done
 +        echo "return ret; }"
-     } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
++    } | check_ld "cc" "$@" && enable $funcs && enable_sanitized $headers
 +}
 +
 +check_class_headers_cpp(){
 +    log check_class_headers_cpp "$@"
 +    headers=$1
 +    classes=$2
 +    shift 2
 +    {
 +        for hdr in $headers; do
 +            echo "#include <$hdr>"
 +        done
 +        echo "int main(void) { "
 +        i=1
 +        for class in $classes; do
 +            echo "$class obj$i;"
 +            i=$(expr $i + 1)
 +        done
 +        echo "return 0; }"
-     } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
++    } | check_ld "cxx" "$@" && enable $funcs && enable_sanitized $headers
  }
  
  check_cpp_condition(){
@@@ -1282,8 -1036,8 +1282,8 @@@ check_pkg_config()
      pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
      check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
          enable $name &&
-         set_safe "${name}_cflags"    $pkg_cflags &&
-         set_safe "${name}_extralibs" $pkg_libs
 -        add_cflags    "$pkg_cflags" &&
 -        eval $(sanitize_var_name ${name}_extralibs)="\$pkg_libs"
++        set_sanitized "${name}_cflags"    $pkg_cflags &&
++        set_sanitized "${name}_extralibs" $pkg_libs
  }
  
  check_exec(){
@@@ -1394,13 -1140,6 +1394,13 @@@ require_cpp_condition()
      check_cpp_condition "$header" "$condition" "$@" || die "ERROR: $condition not satisfied"
  }
  
 +use_pkg_config(){
 +    log use_pkg_config "$@"
 +    name="$1"
 +    check_pkg_config "$@" || return 1
-     add_cflags    $(get_safe "${name}_cflags")
++    add_cflags    $(get_sanitized "${name}_cflags")
 +}
 +
  require_pkg_config(){
      log require_pkg_config "$@"
      pkg_version="$2"
@@@ -6112,91 -4789,32 +6112,91 @@@ enabled openssl           && { use_pkg_
                                 check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
                                 check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
                                 die "ERROR: openssl not found"; }
 +enabled rkmpp             && { { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create ||
 +                                 die "ERROR : Rockchip MPP was not found."; } &&
 +                               { check_func_headers rockchip/rk_mpi_cmd.h "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
 +                                 die "ERROR: Rockchip MPP is outdated, please get a more recent one."; } &&
 +                               { enabled libdrm ||
 +                                 die "ERROR: rkmpp requires --enable-libdrm"; }
 +                             }
  
 -enabled gnutls            && check_lib gmp gmp.h mpz_export -lgmp
 -
 -if enabled nvenc; then
 -    require_header nvEncodeAPI.h
 -    require_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6"
 +if enabled gcrypt; then
 +    GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
 +    if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
 +        gcrypt_cflags=$("${GCRYPT_CONFIG}" --cflags)
 +        gcrypt_extralibs=$("${GCRYPT_CONFIG}" --libs)
 +        check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_extralibs ||
 +            die "ERROR: gcrypt not found"
 +        add_cflags $gcrypt_cflags
 +    else
 +        require gcrypt gcrypt.h gcry_mpi_new -lgcrypt
 +    fi
  fi
  
 -# SDL is "special" and adds some CFLAGS that should not pollute anything else.
 -if enabled avplay; then
 -    CFLAGS_SAVE=$CFLAGS
 -    check_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent &&
 -    sdl_cflags=$pkg_cflags
 -    CFLAGS=$CFLAGS_SAVE
 +if enabled sdl2; then
 +    SDL2_CONFIG="${cross_prefix}sdl2-config"
 +    if check_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent; then
 +        check_func SDL_Init $sdl2_extralibs $sdl2_cflags ||
 +            disable sdl2
 +    elif "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
 +        sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
 +        sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
 +        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
 +        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
 +        check_func SDL_Init $sdl2_extralibs $sdl2_cflags &&
 +            enable sdl2
 +    fi
 +    if test $target_os = "mingw32"; then
 +        sdl2_extralibs=$(filter_out '-mwindows' $sdl2_extralibs)
 +    fi
  fi
  
 -! disabled pod2man   && check_cmd pod2man --help     && enable pod2man   || disable pod2man
 -! disabled texi2html && check_cmd texi2html -version && enable texi2html || disable texi2html
 +if enabled decklink; then
 +    case $target_os in
 +        mingw32*|mingw64*|win32|win64)
 +            decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32"
 +            decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32"
 +            ;;
 +    esac
 +fi
  
 +enabled securetransport &&
 +    check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
 +    check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" ||
 +        disable securetransport
 +
 +enabled schannel &&
 +    check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 &&
 +    check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" &&
 +    schannel_extralibs="-lsecur32" ||
 +        disable schannel
 +
 +makeinfo --version > /dev/null 2>&1 && enable makeinfo  || disable makeinfo
 +enabled makeinfo \
 +    && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \
 +    && enable makeinfo_html || disable makeinfo_html
 +disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
 +perl -v            > /dev/null 2>&1 && enable perl      || disable perl
 +pod2man --help     > /dev/null 2>&1 && enable pod2man   || disable pod2man
 +rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
 +
 +# check V4L2 codecs available in the API
  check_header linux/fb.h
  check_header linux/videodev2.h
- check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
 -check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
 -
 -check_header AVFoundation/AVFoundation.h
++check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
 +check_code cc linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" || disable v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;" && enable vc1_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;" && enable mpeg1_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;" && enable mpeg2_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;" && enable mpeg4_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;" && enable hevc_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H263;" && enable h263_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H264;" && enable h264_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" && enable vp8_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" && enable vp9_v4l2_m2m
  
  check_header sys/videoio.h
- check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
++check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete
  
  check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
  check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
@@@ -6215,17 -4831,10 +6215,17 @@@ check_type "dshow.h" IBaseFilte
    check_header dev/video/bktr/ioctl_bt848.h; } ||
  check_header dev/ic/bt8xx.h
  
 -check_header sys/soundcard.h
 +if check_struct sys/soundcard.h audio_buf_info bytes; then
-     enable_safe sys/soundcard.h
++    enable_sanitized sys/soundcard.h
 +else
-     check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
++    check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_sanitized sys/soundcard.h
 +    #include <sys/soundcard.h>
 +    audio_buf_info abc;
 +EOF
 +fi
  check_header soundcard.h
  
 -enabled_any alsa_indev alsa_outdev &&
 +enabled alsa && use_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimestamp ||
      check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
  
  enabled libjack &&



More information about the ffmpeg-cvslog mailing list