]> git.sesse.net Git - ffmpeg/blobdiff - configure
configure: Move add_fooflags() helper functions into canonical order
[ffmpeg] / configure
index 90fb6f07ca72f917ddee1809b4473eff7a905743..20a839c1d905a709f52291a1d52cd4005f1dc232 100755 (executable)
--- a/configure
+++ b/configure
@@ -213,6 +213,7 @@ External library support:
   --enable-libschroedinger   Dirac video encoding/decoding
   --enable-libsnappy         snappy compression
   --enable-libspeex          Speex audio encoding/decoding
+  --enable-libsrt            Haivision SRT protocol
   --enable-libtheora         Theora video encoding/decoding
   --enable-libtwolame        MP2 audio encoding
   --enable-libvo-aacenc      AAC audio encoding
@@ -717,14 +718,14 @@ add_cflags_headers(){
     append CFLAGS_HEADERS $($cflags_filter "$@")
 }
 
-add_asflags(){
-    append ASFLAGS $($asflags_filter "$@")
-}
-
 add_objcflags(){
     append OBJCFLAGS $($objcflags_filter "$@")
 }
 
+add_asflags(){
+    append ASFLAGS $($asflags_filter "$@")
+}
+
 add_ldflags(){
     append LDFLAGS $($ldflags_filter "$@")
 }
@@ -737,14 +738,14 @@ add_ldsoflags(){
     append LDSOFLAGS $($ldflags_filter "$@")
 }
 
-add_stripflags(){
-    append STRIPFLAGS "$@"
-}
-
 add_extralibs(){
     prepend extralibs $($ldflags_filter "$@")
 }
 
+add_stripflags(){
+    append STRIPFLAGS "$@"
+}
+
 add_host_cppflags(){
     append host_cppflags "$@"
 }
@@ -768,12 +769,32 @@ test_cmd(){
     "$@" >> $logfile 2>&1
 }
 
+cc_e(){
+    eval printf '%s\\n' $CC_E
+}
+
 cc_o(){
     eval printf '%s\\n' $CC_O
 }
 
-cc_e(){
-    eval printf '%s\\n' $CC_E
+as_o(){
+    eval printf '%s\\n' $AS_O
+}
+
+x86asm_o(){
+    eval printf '%s\\n' $X86ASM_O
+}
+
+ld_o(){
+    eval printf '%s\\n' $LD_O
+}
+
+hostcc_e(){
+    eval printf '%s\\n' $HOSTCC_E
+}
+
+hostcc_o(){
+    eval printf '%s\\n' $HOSTCC_O
 }
 
 test_cc(){
@@ -797,10 +818,6 @@ test_cpp(){
     test_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
 }
 
-as_o(){
-    eval printf '%s\\n' $AS_O
-}
-
 test_as(){
     log test_as "$@"
     cat > $TMPS
@@ -808,10 +825,6 @@ test_as(){
     test_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
 }
 
-x86asm_o(){
-    eval printf '%s\\n' $X86ASM_O
-}
-
 test_x86asm(){
     log test_x86asm "$@"
     echo "$1" > $TMPASM
@@ -864,10 +877,6 @@ check_x86asm(){
     test_x86asm "$@" && enable $name
 }
 
-ld_o(){
-    eval printf '%s\\n' $LD_O
-}
-
 test_ld(){
     log test_ld "$@"
     flags=$(filter_out '-l*' "$@")
@@ -967,8 +976,8 @@ check_stripflags(){
     test_stripflags "$@" && add_stripflags "$@"
 }
 
-check_header(){
-    log check_header "$@"
+check_headers(){
+    log check_headers "$@"
     headers=$1
     shift
     disable_sanitized $headers
@@ -1171,20 +1180,19 @@ require(){
 require_cc(){
     log require_cc "$@"
     name="$1"
-    shift
-    test_code cc "$@" || die "ERROR: $name failed"
+    check_cc "$@" || die "ERROR: $name failed"
 }
 
 require_header(){
     log require_header "$@"
     headers="$1"
-    check_header "$@" || die "ERROR: $headers not found"
+    check_headers "$@" || die "ERROR: $headers not found"
 }
 
 require_cpp_condition(){
     log require_cpp_condition "$@"
     condition="$2"
-    test_cpp_condition "$@" || die "ERROR: $condition not satisfied"
+    check_cpp_condition "$@" || die "ERROR: $condition not satisfied"
 }
 
 require_pkg_config(){
@@ -1193,14 +1201,6 @@ require_pkg_config(){
     check_pkg_config "$@" || die "ERROR: $pkg_version not found"
 }
 
-hostcc_e(){
-    eval printf '%s\\n' $HOSTCC_E
-}
-
-hostcc_o(){
-    eval printf '%s\\n' $HOSTCC_O
-}
-
 test_host_cc(){
     log test_host_cc "$@"
     cat > $TMPC
@@ -1374,6 +1374,7 @@ EXTERNAL_LIBRARY_LIST="
     libschroedinger
     libsnappy
     libspeex
+    libsrt
     libtheora
     libtwolame
     libvorbis
@@ -1701,12 +1702,12 @@ SYSTEM_FUNCS="
 "
 
 SYSTEM_LIBRARIES="
+    bcrypt
     sdl
     vaapi_1
     vaapi_drm
     vaapi_x11
     vdpau_x11
-    wincrypt
 "
 
 TOOLCHAIN_FEATURES="
@@ -1730,7 +1731,6 @@ TOOLCHAIN_FEATURES="
 "
 
 TYPES_LIST="
-    CONDITION_VARIABLE_Ptr
     CUVIDDECODECREATEINFO_bitDepthMinus8
     socklen_t
     struct_addrinfo
@@ -2000,7 +2000,7 @@ atomics_gcc_if="sync_val_compare_and_swap"
 atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
 atomics_win32_if="MemoryBarrier"
 atomics_native_if_any="$ATOMICS_LIST"
-w32threads_deps="atomics_native"
+w32threads_deps="atomics_native CONDITION_VARIABLE"
 threads_if_any="$THREADS_LIST"
 
 # subsystems
@@ -2518,11 +2518,6 @@ httpproxy_protocol_suggest="zlib"
 https_protocol_select="tls_protocol"
 https_protocol_suggest="zlib"
 icecast_protocol_select="http_protocol"
-librtmp_protocol_deps="librtmp"
-librtmpe_protocol_deps="librtmp"
-librtmps_protocol_deps="librtmp"
-librtmpt_protocol_deps="librtmp"
-librtmpte_protocol_deps="librtmp"
 mmsh_protocol_select="http_protocol"
 mmst_protocol_select="network"
 rtmp_protocol_conflict="librtmp_protocol"
@@ -2550,6 +2545,15 @@ udp_protocol_select="network"
 unix_protocol_deps="sys_un_h"
 unix_protocol_select="network"
 
+# external library protocols
+librtmp_protocol_deps="librtmp"
+librtmpe_protocol_deps="librtmp"
+librtmps_protocol_deps="librtmp"
+librtmpt_protocol_deps="librtmp"
+librtmpte_protocol_deps="librtmp"
+libsrt_protocol_deps="libsrt"
+libsrt_protocol_select="network"
+
 # filters
 asyncts_filter_deps="avresample"
 blackframe_filter_deps="gpl"
@@ -2607,7 +2611,7 @@ avdevice_extralibs="libm_extralibs"
 avformat_extralibs="libm_extralibs"
 avfilter_extralibs="pthreads_extralibs libm_extralibs"
 avresample_extralibs="libm_extralibs"
-avutil_extralibs="clock_gettime_extralibs cuda_extralibs cuvid_extralibs d3d11va_extralibs libm_extralibs libmfx_extralibs nanosleep_extralibs pthreads_extralibs user32_extralibs vaapi_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vdpau_x11_extralibs wincrypt_extralibs"
+avutil_extralibs="bcrypt_extralibs clock_gettime_extralibs cuda_extralibs cuvid_extralibs d3d11va_extralibs libm_extralibs libmfx_extralibs nanosleep_extralibs pthreads_extralibs user32_extralibs vaapi_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vdpau_x11_extralibs"
 swscale_extralibs="libm_extralibs"
 
 # programs
@@ -3938,7 +3942,7 @@ case $target_os in
         enabled x86_64 && objformat="macho64" || objformat="macho32"
         enabled_any pic shared ||
             { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
-        check_header dispatch/dispatch.h &&
+        check_headers dispatch/dispatch.h &&
             add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
         if test -n "$sysroot"; then
             is_in -isysroot $cc $CPPFLAGS $CFLAGS || check_cppflags -isysroot $sysroot
@@ -4099,12 +4103,16 @@ probe_libc(){
     elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
         eval ${pfx}libc_type=newlib
         add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
+        test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
+            add_${pfx}cppflags -D_WIN32_WINNT=0x0600
     # MinGW64 is backwards compatible with MinGW32, so check for it first.
     elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
         eval ${pfx}libc_type=mingw64
         add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
         eval test \$${pfx_no_}cc_type = "gcc" &&
             add_${pfx}cppflags -D__printf__=__gnu_printf__
+        test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
+            add_${pfx}cppflags -D_WIN32_WINNT=0x0600
     elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION"  ||
          test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
         eval ${pfx}libc_type=mingw32
@@ -4114,8 +4122,8 @@ probe_libc(){
         add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
         test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
             add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
-        test_${pfx}cpp_condition windows.h "defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0502" &&
-            add_${pfx}cppflags -D_WIN32_WINNT=0x0502
+        test_${pfx}cpp_condition windows.h "!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600" &&
+            add_${pfx}cppflags -D_WIN32_WINNT=0x0600
         eval test \$${pfx_no_}cc_type = "gcc" &&
             add_${pfx}cppflags -D__printf__=__gnu_printf__
     elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
@@ -4135,14 +4143,14 @@ probe_libc(){
         # 0x601 by default unless something else is set by the user.
         # This can easily lead to us detecting functions only present
         # in such new versions and producing binaries requiring windows 7.0.
-        # Therefore explicitly set the default to XP unless the user has
+        # Therefore explicitly set the default to Vista unless the user has
         # set something else on the command line.
         # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
         # family. For these cases, configure is free to use any functions
         # found in the SDK headers by default. (Alternatively, we could force
         # _WIN32_WINNT to 0x0602 in that case.)
         test_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
-            { test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0502; }
+            { test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0600; }
 #ifdef WINAPI_FAMILY
 #include <winapifamily.h>
 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
@@ -4470,9 +4478,9 @@ if ! disabled network; then
     check_type "sys/types.h sys/socket.h" socklen_t
 
     # Prefer arpa/inet.h over winsock2
-    if check_header arpa/inet.h ; then
+    if check_headers arpa/inet.h ; then
         check_func closesocket
-    elif check_header winsock2.h ; then
+    elif check_headers winsock2.h ; then
         check_func_headers winsock2.h closesocket -lws2 &&
             network_extralibs="-lws2" ||
         { check_func_headers winsock2.h closesocket -lws2_32 &&
@@ -4549,33 +4557,33 @@ check_func_headers windows.h MapViewOfFile
 check_func_headers windows.h SetConsoleTextAttribute
 check_func_headers windows.h Sleep
 check_func_headers windows.h VirtualAlloc
-check_struct windows.h "CONDITION_VARIABLE" Ptr
-
-check_header direct.h
-check_header dxgidebug.h
-check_header dxva.h
-check_header dxva2api.h
-check_header io.h
-check_header malloc.h
-check_header poll.h
-check_header sys/param.h
-check_header sys/resource.h
-check_header sys/select.h
-check_header sys/time.h
-check_header sys/un.h
-check_header unistd.h
-check_header valgrind/valgrind.h
-check_header VideoDecodeAcceleration/VDADecoder.h
-check_header windows.h
+
+check_headers direct.h
+check_headers dxgidebug.h
+check_headers dxva.h
+check_headers dxva2api.h
+check_headers io.h
+check_headers malloc.h
+check_headers poll.h
+check_headers sys/param.h
+check_headers sys/resource.h
+check_headers sys/select.h
+check_headers sys/time.h
+check_headers sys/un.h
+check_headers unistd.h
+check_headers valgrind/valgrind.h
+check_headers VideoDecodeAcceleration/VDADecoder.h
+check_headers windows.h
 
 # it seems there are versions of clang in some distros that try to use the
 # gcc headers, which explodes for stdatomic
 # so we also check that atomics actually work here
 check_builtin stdatomic stdatomic.h "atomic_int foo; atomic_store(&foo, 0)"
 
+check_lib bcrypt   "windows.h bcrypt.h"   BCryptGenRandom      -lbcrypt &&
+    check_cpp_condition bcrypt bcrypt.h "defined BCRYPT_RNG_ALGORITHM"
 check_lib ole32    "windows.h"            CoTaskMemFree        -lole32
 check_lib shell32  "windows.h shellapi.h" CommandLineToArgvW   -lshell32
-check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom       -ladvapi32
 check_lib psapi    "windows.h psapi.h"    GetProcessMemoryInfo -lpsapi
 
 check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
@@ -4601,7 +4609,8 @@ check_type "va/va.h va/va_enc_vp9.h"  "VAEncPictureParameterBufferVP9"
 check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
 
 if ! disabled w32threads && ! enabled pthreads; then
-    check_lib w32threads "windows.h process.h" _beginthreadex
+    check_lib w32threads "windows.h process.h" _beginthreadex &&
+        check_type "windows.h" CONDITION_VARIABLE
 fi
 
 # check for some common methods of building with pthread support
@@ -4639,12 +4648,12 @@ for func in $MATH_FUNCS; do
 done
 
 # these are off by default, so fail if requested and not available
-enabled amf               && require_cpp_condition AMF/core/Version.h "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400040001"
-enabled avisynth          && require_header avisynth/avisynth_c.h
-enabled avxsynth          && require_header avxsynth/avxsynth_c.h
+enabled amf               && require_cpp_condition amf AMF/core/Version.h "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400040001"
+enabled avisynth          && require_headers avisynth/avisynth_c.h
+enabled avxsynth          && require_headers avxsynth/avxsynth_c.h
 enabled cuda              && require cuda cuda.h cuInit -lcuda
 enabled cuvid             && require cuvid cuviddec.h cuvidCreateDecoder -lnvcuvid
-enabled frei0r            && require_header frei0r.h
+enabled frei0r            && require_headers frei0r.h
 enabled gnutls            && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init &&
                              check_lib gmp gmp.h mpz_export -lgmp
 enabled libaom            && require_pkg_config libaom "aom >= 0.1.0" aom/aom_codec.h aom_codec_version
@@ -4674,6 +4683,7 @@ enabled librtmp           && require_pkg_config librtmp librtmp librtmp/rtmp.h R
 enabled libschroedinger   && require_pkg_config libschroedinger schroedinger-1.0 schroedinger/schro.h schro_init
 enabled libsnappy         && require libsnappy snappy-c.h snappy_compress -lsnappy
 enabled libspeex          && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
+enabled libsrt            && require_pkg_config libsrt "srt >= 1.2.0" srt/srt.h srt_socket
 enabled libtheora         && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
 enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame
 enabled libvo_aacenc      && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
@@ -4694,10 +4704,10 @@ enabled libvpx            && require_pkg_config libvpx "vpx >= 1.3.0" vpx/vpx_co
 enabled libwavpack        && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput  -lwavpack
 enabled libwebp           && require_pkg_config libwebp libwebp webp/encode.h WebPGetEncoderVersion
 enabled libx264           && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
-                             require_cpp_condition x264.h "X264_BUILD >= 118" &&
+                             require_cpp_condition libx264 x264.h "X264_BUILD >= 118" &&
                              check_cpp_condition libx262 x264.h "X264_MPEG2"
 enabled libx265           && require_pkg_config libx265 x265 x265.h x265_api_get &&
-                             require_cpp_condition x265.h "X265_BUILD >= 57"
+                             require_cpp_condition libx265 x265.h "X265_BUILD >= 57"
 enabled libxavs           && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs
 enabled libxvid           && require libxvid xvid.h xvid_global -lxvidcore
 enabled mmal              && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
@@ -4707,10 +4717,10 @@ enabled mmal              && { check_lib mmal interface/mmal/mmal.h mmal_port_co
                                  check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
                                die "ERROR: mmal not found" &&
                                check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
-enabled nvenc             && require_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6"
-enabled omx               && require_header OMX_Core.h
-enabled omx_rpi           && { check_header OMX_Core.h ||
-                               { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
+enabled nvenc             && require_cpp_condition nvenc nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6"
+enabled omx               && require_headers OMX_Core.h
+enabled omx_rpi           && { check_headers OMX_Core.h ||
+                               { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_headers OMX_Core.h ; } ||
                                die "ERROR: OpenMAX IL headers not found"; } && enable omx
 enabled openssl           && { { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
                                  check_pkg_config openssl openssl openssl/ssl.h SSL_library_init; } ||
@@ -4723,13 +4733,13 @@ enabled openssl           && { { check_pkg_config openssl openssl openssl/ssl.h
 enabled avplay &&
     test_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent
 
-check_header linux/fb.h
-check_header linux/videodev2.h
+check_headers linux/fb.h
+check_headers linux/videodev2.h
 check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
 
-check_header AVFoundation/AVFoundation.h
+check_headers AVFoundation/AVFoundation.h
 
-check_header sys/videoio.h
+check_headers sys/videoio.h
 
 check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
 check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
@@ -4738,12 +4748,12 @@ check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
 check_cpp_condition vfwcap_defines vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER"
 
 # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
-check_header "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h"                   ||
-    check_header "machine/ioctl_meteor.h machine/ioctl_bt848.h"                 ||
-    check_header "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" ||
-    check_header "dev/ic/bt8xx.h"
+check_headers "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h"                   ||
+    check_headers "machine/ioctl_meteor.h machine/ioctl_bt848.h"                 ||
+    check_headers "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" ||
+    check_headers "dev/ic/bt8xx.h"
 
-check_header sys/soundcard.h
+check_headers sys/soundcard.h
 
 enabled alsa_indev &&
     check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
@@ -4841,7 +4851,9 @@ check_disable_warning_headers -Wno-unused-variable
 
 check_objcflags -fobjc-arc && enable objc_arc
 
-check_cc blocks_extension "" "void (^block)(void)"
+test_cc <<EOF && enable blocks_extension
+void (^block)(void);
+EOF
 
 # add some linker flags
 check_ldflags -Wl,--warn-common
@@ -4895,10 +4907,14 @@ if enabled proper_dce; then
     if test_ldflags -Wl,${version_script},$TMPV; then
         append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
         quotes='""'
-        check_cc symver_asm_label "" "void ff_foo(void) __asm__ ("av_foo@VERSION");
-                                      void ff_foo(void) { ${inline_asm+__asm__($quotes);} }"
-        check_cc symver_gnu_asm   "" "__asm__(".symver ff_foo,av_foo@VERSION");
-                                      void ff_foo(void) {}"
+        test_cc <<EOF && enable symver_asm_label
+void ff_foo(void) __asm__ ("av_foo@VERSION");
+void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
+EOF
+        test_cc <<EOF && enable symver_gnu_asm
+__asm__(".symver ff_foo,av_foo@VERSION");
+void ff_foo(void) {}
+EOF
     fi
 fi