You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4093 lines
119KB

  1. #!/bin/sh
  2. #
  3. # Libav configure script
  4. #
  5. # Copyright (c) 2000-2002 Fabrice Bellard
  6. # Copyright (c) 2005-2008 Diego Biurrun
  7. # Copyright (c) 2005-2008 Mans Rullgard
  8. #
  9. # Prevent locale nonsense from breaking basic text processing.
  10. LC_ALL=C
  11. export LC_ALL
  12. # make sure we are running under a compatible shell
  13. # try to make this part work with most shells
  14. try_exec(){
  15. echo "Trying shell $1"
  16. type "$1" > /dev/null 2>&1 && exec "$@"
  17. }
  18. unset foo
  19. (: ${foo%%bar}) 2> /dev/null
  20. E1="$?"
  21. (: ${foo?}) 2> /dev/null
  22. E2="$?"
  23. if test "$E1" != 0 || test "$E2" = 0; then
  24. echo "Broken shell detected. Trying alternatives."
  25. export FF_CONF_EXEC
  26. if test "0$FF_CONF_EXEC" -lt 1; then
  27. FF_CONF_EXEC=1
  28. try_exec bash "$0" "$@"
  29. fi
  30. if test "0$FF_CONF_EXEC" -lt 2; then
  31. FF_CONF_EXEC=2
  32. try_exec ksh "$0" "$@"
  33. fi
  34. if test "0$FF_CONF_EXEC" -lt 3; then
  35. FF_CONF_EXEC=3
  36. try_exec /usr/xpg4/bin/sh "$0" "$@"
  37. fi
  38. echo "No compatible shell script interpreter found."
  39. echo "This configure script requires a POSIX-compatible shell"
  40. echo "such as bash or ksh."
  41. echo "THIS IS NOT A BUG IN LIBAV, DO NOT REPORT IT AS SUCH."
  42. echo "Instead, install a working POSIX-compatible shell."
  43. echo "Disabling this configure test will create a broken Libav."
  44. if test "$BASH_VERSION" = '2.04.0(1)-release'; then
  45. echo "This bash version ($BASH_VERSION) is broken on your platform."
  46. echo "Upgrade to a later version if available."
  47. fi
  48. exit 1
  49. fi
  50. test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
  51. show_help(){
  52. cat <<EOF
  53. Usage: configure [options]
  54. Options: [defaults in brackets after descriptions]
  55. Help options:
  56. --help print this message
  57. --list-decoders show all available decoders
  58. --list-encoders show all available encoders
  59. --list-hwaccels show all available hardware accelerators
  60. --list-demuxers show all available demuxers
  61. --list-muxers show all available muxers
  62. --list-parsers show all available parsers
  63. --list-protocols show all available protocols
  64. --list-bsfs show all available bitstream filters
  65. --list-indevs show all available input devices
  66. --list-outdevs show all available output devices
  67. --list-filters show all available filters
  68. Standard options:
  69. --logfile=FILE log tests and output to FILE [config.log]
  70. --disable-logging do not log configure debug information
  71. --prefix=PREFIX install in PREFIX [$prefix]
  72. --bindir=DIR install binaries in DIR [PREFIX/bin]
  73. --datadir=DIR install data files in DIR [PREFIX/share/avconv]
  74. --libdir=DIR install libs in DIR [PREFIX/lib]
  75. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  76. --incdir=DIR install includes in DIR [PREFIX/include]
  77. --mandir=DIR install man page in DIR [PREFIX/share/man]
  78. Licensing options:
  79. --enable-gpl allow use of GPL code, the resulting libs
  80. and binaries will be under GPL [no]
  81. --enable-version3 upgrade (L)GPL to version 3 [no]
  82. --enable-nonfree allow use of nonfree code, the resulting libs
  83. and binaries will be unredistributable [no]
  84. Configuration options:
  85. --disable-static do not build static libraries [no]
  86. --enable-shared build shared libraries [no]
  87. --enable-small optimize for size instead of speed
  88. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  89. --enable-gray enable full grayscale support (slower color)
  90. --disable-swscale-alpha disable alpha channel support in swscale
  91. --disable-all disable building components, libraries and programs
  92. Program options:
  93. --disable-programs do not build command line programs
  94. --disable-avconv disable avconv build
  95. --disable-avplay disable avplay build
  96. --disable-avprobe disable avprobe build
  97. --disable-avserver disable avserver build
  98. Component options:
  99. --disable-doc do not build documentation
  100. --disable-avdevice disable libavdevice build
  101. --disable-avcodec disable libavcodec build
  102. --disable-avformat disable libavformat build
  103. --disable-avutil disable libavutil build
  104. --disable-swscale disable libswscale build
  105. --disable-avfilter disable video filter support [no]
  106. --disable-avresample disable libavresample build [no]
  107. --disable-pthreads disable pthreads [auto]
  108. --disable-w32threads disable Win32 threads [auto]
  109. --disable-network disable network support [no]
  110. --disable-dct disable DCT code
  111. --disable-lsp disable LSP code
  112. --disable-lzo disable LZO decoder code
  113. --disable-mdct disable MDCT code
  114. --disable-rdft disable RDFT code
  115. --disable-fft disable FFT code
  116. Hardware accelerators:
  117. --enable-dxva2 enable DXVA2 code
  118. --enable-vaapi enable VAAPI code
  119. --enable-vda enable VDA code
  120. --enable-vdpau enable VDPAU code
  121. Individual component options:
  122. --disable-everything disable all components listed below
  123. --disable-encoder=NAME disable encoder NAME
  124. --enable-encoder=NAME enable encoder NAME
  125. --disable-encoders disable all encoders
  126. --disable-decoder=NAME disable decoder NAME
  127. --enable-decoder=NAME enable decoder NAME
  128. --disable-decoders disable all decoders
  129. --disable-hwaccel=NAME disable hwaccel NAME
  130. --enable-hwaccel=NAME enable hwaccel NAME
  131. --disable-hwaccels disable all hwaccels
  132. --disable-muxer=NAME disable muxer NAME
  133. --enable-muxer=NAME enable muxer NAME
  134. --disable-muxers disable all muxers
  135. --disable-demuxer=NAME disable demuxer NAME
  136. --enable-demuxer=NAME enable demuxer NAME
  137. --disable-demuxers disable all demuxers
  138. --enable-parser=NAME enable parser NAME
  139. --disable-parser=NAME disable parser NAME
  140. --disable-parsers disable all parsers
  141. --enable-bsf=NAME enable bitstream filter NAME
  142. --disable-bsf=NAME disable bitstream filter NAME
  143. --disable-bsfs disable all bitstream filters
  144. --enable-protocol=NAME enable protocol NAME
  145. --disable-protocol=NAME disable protocol NAME
  146. --disable-protocols disable all protocols
  147. --enable-indev=NAME enable input device NAME
  148. --disable-indev=NAME disable input device NAME
  149. --disable-indevs disable input devices
  150. --enable-outdev=NAME enable output device NAME
  151. --disable-outdev=NAME disable output device NAME
  152. --disable-outdevs disable output devices
  153. --disable-devices disable all devices
  154. --enable-filter=NAME enable filter NAME
  155. --disable-filter=NAME disable filter NAME
  156. --disable-filters disable all filters
  157. External library support:
  158. --enable-avisynth enable reading of AVISynth script files [no]
  159. --enable-bzlib enable bzlib [autodetect]
  160. --enable-frei0r enable frei0r video filtering
  161. --enable-gnutls enable gnutls [no]
  162. --enable-libcdio enable audio CD grabbing with libcdio
  163. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  164. and libraw1394 [no]
  165. --enable-libfaac enable AAC encoding via libfaac [no]
  166. --enable-libfdk-aac enable AAC encoding via libfdk-aac [no]
  167. --enable-libfreetype enable libfreetype [no]
  168. --enable-libgsm enable GSM de/encoding via libgsm [no]
  169. --enable-libilbc enable iLBC de/encoding via libilbc [no]
  170. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  171. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  172. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  173. --enable-libopencv enable video filtering via libopencv [no]
  174. --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
  175. --enable-libopus enable Opus decoding via libopus [no]
  176. --enable-libpulse enable Pulseaudio input via libpulse [no]
  177. --enable-librtmp enable RTMP[E] support via librtmp [no]
  178. --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
  179. --enable-libspeex enable Speex de/encoding via libspeex [no]
  180. --enable-libtheora enable Theora encoding via libtheora [no]
  181. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  182. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  183. --enable-libvorbis enable Vorbis encoding via libvorbis [no]
  184. --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
  185. --enable-libx264 enable H.264 encoding via x264 [no]
  186. --enable-libxavs enable AVS encoding via xavs [no]
  187. --enable-libxvid enable Xvid encoding via xvidcore,
  188. native MPEG-4/Xvid encoder exists [no]
  189. --enable-openssl enable openssl [no]
  190. --enable-x11grab enable X11 grabbing [no]
  191. --enable-zlib enable zlib [autodetect]
  192. Advanced options (experts only):
  193. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  194. --enable-cross-compile assume a cross-compiler is used
  195. --sysroot=PATH root of cross-build tree
  196. --sysinclude=PATH location of cross-build system headers
  197. --target-os=OS compiler targets OS [$target_os]
  198. --target-exec=CMD command to run executables on target
  199. --target-path=DIR path to view of build directory on target
  200. --toolchain=NAME set tool defaults according to NAME
  201. --nm=NM use nm tool
  202. --ar=AR use archive tool AR [$ar_default]
  203. --as=AS use assembler AS [$as_default]
  204. --cc=CC use C compiler CC [$cc_default]
  205. --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
  206. --ld=LD use linker LD
  207. --host-cc=HOSTCC use host C compiler HOSTCC
  208. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  209. --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
  210. --host-ld=HOSTLD use host linker HOSTLD
  211. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  212. --host-libs=HLIBS use libs HLIBS when linking for host
  213. --host-os=OS compiler host OS [$target_os]
  214. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  215. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  216. --extra-libs=ELIBS add ELIBS [$ELIBS]
  217. --extra-version=STRING version string suffix []
  218. --optflags=OPTFLAGS override optimization-related compiler flags
  219. --build-suffix=SUFFIX library name suffix []
  220. --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
  221. --arch=ARCH select architecture [$arch]
  222. --cpu=CPU select the minimum required CPU (affects
  223. instruction selection, may crash on older CPUs)
  224. --enable-pic build position-independent code
  225. --enable-sram allow use of on-chip SRAM
  226. --enable-thumb compile for Thumb instruction set
  227. --disable-symver disable symbol versioning
  228. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  229. --disable-safe-bitstream-reader
  230. disable buffer boundary checking in bitreaders
  231. (faster, but may crash)
  232. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  233. --enable-lto use link-time optimization
  234. Optimization options (experts only):
  235. --disable-asm disable all assembler optimizations
  236. --disable-altivec disable AltiVec optimizations
  237. --disable-amd3dnow disable 3DNow! optimizations
  238. --disable-amd3dnowext disable 3DNow! extended optimizations
  239. --disable-mmx disable MMX optimizations
  240. --disable-mmxext disable MMXEXT optimizations
  241. --disable-sse disable SSE optimizations
  242. --disable-sse2 disable SSE2 optimizations
  243. --disable-sse3 disable SSE3 optimizations
  244. --disable-ssse3 disable SSSE3 optimizations
  245. --disable-sse4 disable SSE4 optimizations
  246. --disable-sse42 disable SSE4.2 optimizations
  247. --disable-avx disable AVX optimizations
  248. --disable-fma4 disable FMA4 optimizations
  249. --disable-armv5te disable armv5te optimizations
  250. --disable-armv6 disable armv6 optimizations
  251. --disable-armv6t2 disable armv6t2 optimizations
  252. --disable-vfp disable VFP optimizations
  253. --disable-neon disable NEON optimizations
  254. --disable-vis disable VIS optimizations
  255. --disable-inline-asm disable use of inline assembler
  256. --disable-yasm disable use of yasm assembler
  257. Developer options (useful when working on Libav itself):
  258. --disable-debug disable debugging symbols
  259. --enable-debug=LEVEL set the debug level [$debuglevel]
  260. --disable-optimizations disable compiler optimizations
  261. --enable-extra-warnings enable more compiler warnings
  262. --samples=PATH location of test samples for FATE, if not set use
  263. \$LIBAV_SAMPLES at make invocation time.
  264. --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
  265. should be used only for debugging purposes)
  266. --enable-random randomly enable/disable components
  267. --disable-random
  268. --enable-random=LIST randomly enable/disable specific components or
  269. --disable-random=LIST component groups. LIST is a comma-separated list
  270. of NAME[:PROB] entries where NAME is a component
  271. (group) and PROB the probability associated with
  272. NAME (default 0.5).
  273. --random-seed=VALUE seed value for --enable/disable-random
  274. NOTE: Object files are built at the place where configure is launched.
  275. EOF
  276. exit 0
  277. }
  278. quotes='""'
  279. log(){
  280. echo "$@" >> $logfile
  281. }
  282. log_file(){
  283. log BEGIN $1
  284. pr -n -t $1 >> $logfile
  285. log END $1
  286. }
  287. echolog(){
  288. log "$@"
  289. echo "$@"
  290. }
  291. warn(){
  292. log "WARNING: $*"
  293. WARNINGS="${WARNINGS}WARNING: $*\n"
  294. }
  295. die(){
  296. echolog "$@"
  297. cat <<EOF
  298. If you think configure made a mistake, make sure you are using the latest
  299. version from Git. If the latest version fails, report the problem to the
  300. libav-user@libav.org mailing list or IRC #libav on irc.freenode.net.
  301. EOF
  302. if disabled logging; then
  303. cat <<EOF
  304. Rerun configure with logging enabled (do not use --disable-logging), and
  305. include the log this produces with your report.
  306. EOF
  307. else
  308. cat <<EOF
  309. Include the log file "$logfile" produced by configure as this will help
  310. solving the problem.
  311. EOF
  312. fi
  313. exit 1
  314. }
  315. # Avoid locale weirdness, besides we really just want to translate ASCII.
  316. toupper(){
  317. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  318. }
  319. tolower(){
  320. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  321. }
  322. c_escape(){
  323. echo "$*" | sed 's/["\\]/\\\0/g'
  324. }
  325. sh_quote(){
  326. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  327. test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
  328. echo "$v"
  329. }
  330. cleanws(){
  331. echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
  332. }
  333. filter(){
  334. pat=$1
  335. shift
  336. for v; do
  337. eval "case $v in $pat) echo $v ;; esac"
  338. done
  339. }
  340. filter_out(){
  341. pat=$1
  342. shift
  343. for v; do
  344. eval "case $v in $pat) ;; *) echo $v ;; esac"
  345. done
  346. }
  347. map(){
  348. m=$1
  349. shift
  350. for v; do eval $m; done
  351. }
  352. add_suffix(){
  353. suffix=$1
  354. shift
  355. for v; do echo ${v}${suffix}; done
  356. }
  357. set_all(){
  358. value=$1
  359. shift
  360. for var in $*; do
  361. eval $var=$value
  362. done
  363. }
  364. set_weak(){
  365. value=$1
  366. shift
  367. for var; do
  368. eval : \${$var:=$value}
  369. done
  370. }
  371. sanitize_var_name(){
  372. echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
  373. }
  374. set_safe(){
  375. var=$1
  376. shift
  377. eval $(sanitize_var_name "$var")='$*'
  378. }
  379. get_safe(){
  380. eval echo \$$(sanitize_var_name "$1")
  381. }
  382. pushvar(){
  383. for var in $*; do
  384. eval level=\${${var}_level:=0}
  385. eval ${var}_${level}="\$$var"
  386. eval ${var}_level=$(($level+1))
  387. done
  388. }
  389. popvar(){
  390. for var in $*; do
  391. eval level=\${${var}_level:-0}
  392. test $level = 0 && continue
  393. eval level=$(($level-1))
  394. eval $var="\${${var}_${level}}"
  395. eval ${var}_level=$level
  396. eval unset ${var}_${level}
  397. done
  398. }
  399. enable(){
  400. set_all yes $*
  401. }
  402. disable(){
  403. set_all no $*
  404. }
  405. enable_weak(){
  406. set_weak yes $*
  407. }
  408. disable_weak(){
  409. set_weak no $*
  410. }
  411. enable_safe(){
  412. for var; do
  413. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  414. done
  415. }
  416. disable_safe(){
  417. for var; do
  418. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  419. done
  420. }
  421. do_enable_deep(){
  422. for var; do
  423. enabled $var && continue
  424. eval sel="\$${var}_select"
  425. eval sgs="\$${var}_suggest"
  426. pushvar var sgs
  427. enable_deep $sel
  428. popvar sgs
  429. enable_deep_weak $sgs
  430. popvar var
  431. done
  432. }
  433. enable_deep(){
  434. do_enable_deep $*
  435. enable $*
  436. }
  437. enable_deep_weak(){
  438. do_enable_deep $*
  439. enable_weak $*
  440. }
  441. enabled(){
  442. test "${1#!}" = "$1" && op== || op=!=
  443. eval test "x\$${1#!}" $op "xyes"
  444. }
  445. disabled(){
  446. test "${1#!}" = "$1" && op== || op=!=
  447. eval test "x\$${1#!}" $op "xno"
  448. }
  449. enabled_all(){
  450. for opt; do
  451. enabled $opt || return 1
  452. done
  453. }
  454. disabled_all(){
  455. for opt; do
  456. disabled $opt || return 1
  457. done
  458. }
  459. enabled_any(){
  460. for opt; do
  461. enabled $opt && return 0
  462. done
  463. }
  464. disabled_any(){
  465. for opt; do
  466. disabled $opt && return 0
  467. done
  468. return 1
  469. }
  470. set_default(){
  471. for opt; do
  472. eval : \${$opt:=\$${opt}_default}
  473. done
  474. }
  475. is_in(){
  476. value=$1
  477. shift
  478. for var in $*; do
  479. [ $var = $value ] && return 0
  480. done
  481. return 1
  482. }
  483. do_check_deps(){
  484. for cfg; do
  485. cfg="${cfg#!}"
  486. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  487. disabled ${cfg}_checking && continue
  488. enable ${cfg}_checking
  489. append allopts $cfg
  490. eval dep_all="\$${cfg}_deps"
  491. eval dep_any="\$${cfg}_deps_any"
  492. eval dep_sel="\$${cfg}_select"
  493. eval dep_sgs="\$${cfg}_suggest"
  494. eval dep_ifa="\$${cfg}_if"
  495. eval dep_ifn="\$${cfg}_if_any"
  496. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  497. do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  498. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  499. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  500. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  501. enabled_all $dep_all || disable $cfg
  502. enabled_any $dep_any || disable $cfg
  503. disabled_any $dep_sel && disable $cfg
  504. if enabled $cfg; then
  505. enable_deep $dep_sel
  506. enable_deep_weak $dep_sgs
  507. fi
  508. disable ${cfg}_checking
  509. done
  510. }
  511. check_deps(){
  512. unset allopts
  513. do_check_deps "$@"
  514. for cfg in $allopts; do
  515. enabled $cfg || continue
  516. eval dep_extralibs="\$${cfg}_extralibs"
  517. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  518. done
  519. }
  520. print_config(){
  521. pfx=$1
  522. files=$2
  523. shift 2
  524. map 'eval echo "$v \${$v:-no}"' "$@" |
  525. awk "BEGIN { split(\"$files\", files) }
  526. {
  527. c = \"$pfx\" toupper(\$1);
  528. v = \$2;
  529. sub(/yes/, 1, v);
  530. sub(/no/, 0, v);
  531. for (f in files) {
  532. file = files[f];
  533. if (file ~ /\\.h\$/) {
  534. printf(\"#define %s %d\\n\", c, v) >>file;
  535. } else if (file ~ /\\.asm\$/) {
  536. printf(\"%%define %s %d\\n\", c, v) >>file;
  537. } else if (file ~ /\\.mak\$/) {
  538. n = -v ? \"\" : \"!\";
  539. printf(\"%s%s=yes\\n\", n, c) >>file;
  540. }
  541. }
  542. }"
  543. }
  544. print_enabled(){
  545. suf=$1
  546. shift
  547. for v; do
  548. enabled $v && printf "%s\n" ${v%$suf};
  549. done
  550. }
  551. append(){
  552. var=$1
  553. shift
  554. eval "$var=\"\$$var $*\""
  555. }
  556. prepend(){
  557. var=$1
  558. shift
  559. eval "$var=\"$* \$$var\""
  560. }
  561. add_cppflags(){
  562. append CPPFLAGS "$@"
  563. }
  564. add_cflags(){
  565. append CFLAGS $($cflags_filter "$@")
  566. }
  567. add_asflags(){
  568. append ASFLAGS $($asflags_filter "$@")
  569. }
  570. add_ldflags(){
  571. append LDFLAGS $($ldflags_filter "$@")
  572. }
  573. add_extralibs(){
  574. prepend extralibs $($ldflags_filter "$@")
  575. }
  576. add_host_cppflags(){
  577. append host_cppflags "$@"
  578. }
  579. add_host_cflags(){
  580. append host_cflags $($host_cflags_filter "$@")
  581. }
  582. add_host_ldflags(){
  583. append host_ldflags $($host_ldflags_filter "$@")
  584. }
  585. add_compat(){
  586. append compat_objs $1
  587. shift
  588. map 'add_cppflags -D$v' "$@"
  589. }
  590. check_cmd(){
  591. log "$@"
  592. "$@" >> $logfile 2>&1
  593. }
  594. cc_o(){
  595. eval printf '%s\\n' $CC_O
  596. }
  597. cc_e(){
  598. eval printf '%s\\n' $CC_E
  599. }
  600. check_cc(){
  601. log check_cc "$@"
  602. cat > $TMPC
  603. log_file $TMPC
  604. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
  605. }
  606. check_cpp(){
  607. log check_cpp "$@"
  608. cat > $TMPC
  609. log_file $TMPC
  610. check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
  611. }
  612. as_o(){
  613. eval printf '%s\\n' $AS_O
  614. }
  615. check_as(){
  616. log check_as "$@"
  617. cat > $TMPS
  618. log_file $TMPS
  619. check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
  620. }
  621. check_inline_asm(){
  622. log check_inline_asm "$@"
  623. name="$1"
  624. code="$2"
  625. shift 2
  626. disable $name
  627. check_cc "$@" <<EOF && enable $name
  628. void foo(void){ __asm__ volatile($code); }
  629. EOF
  630. }
  631. check_insn(){
  632. log check_insn "$@"
  633. check_inline_asm ${1}_inline "\"$2\""
  634. echo "$2" | check_as && enable ${1}_external || disable ${1}_external
  635. }
  636. check_yasm(){
  637. log check_yasm "$@"
  638. echo "$1" > $TMPS
  639. log_file $TMPS
  640. shift 1
  641. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  642. }
  643. ld_o(){
  644. eval printf '%s\\n' $LD_O
  645. }
  646. check_ld(){
  647. log check_ld "$@"
  648. flags=$(filter_out '-l*' "$@")
  649. libs=$(filter '-l*' "$@")
  650. check_cc $($cflags_filter $flags) || return
  651. flags=$($ldflags_filter $flags)
  652. libs=$($ldflags_filter $libs)
  653. check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
  654. }
  655. check_code(){
  656. log check_code "$@"
  657. check=$1
  658. headers=$2
  659. code=$3
  660. shift 3
  661. {
  662. for hdr in $headers; do
  663. echo "#include <$hdr>"
  664. done
  665. echo "int main(void) { $code; return 0; }"
  666. } | check_$check "$@"
  667. }
  668. check_cppflags(){
  669. log check_cppflags "$@"
  670. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  671. int x;
  672. EOF
  673. }
  674. check_cflags(){
  675. log check_cflags "$@"
  676. set -- $($cflags_filter "$@")
  677. check_cc "$@" <<EOF && append CFLAGS "$@"
  678. int x;
  679. EOF
  680. }
  681. test_ldflags(){
  682. log test_ldflags "$@"
  683. check_ld "$@" <<EOF
  684. int main(void){ return 0; }
  685. EOF
  686. }
  687. check_ldflags(){
  688. log check_ldflags "$@"
  689. test_ldflags "$@" && add_ldflags "$@"
  690. }
  691. check_header(){
  692. log check_header "$@"
  693. header=$1
  694. shift
  695. disable_safe $header
  696. check_cpp "$@" <<EOF && enable_safe $header
  697. #include <$header>
  698. int x;
  699. EOF
  700. }
  701. check_func(){
  702. log check_func "$@"
  703. func=$1
  704. shift
  705. disable $func
  706. check_ld "$@" <<EOF && enable $func
  707. extern int $func();
  708. int main(void){ $func(); }
  709. EOF
  710. }
  711. check_mathfunc(){
  712. log check_mathfunc "$@"
  713. func=$1
  714. narg=$2
  715. shift 2
  716. test $narg = 2 && args="f, g" || args="f"
  717. disable $func
  718. check_ld "$@" <<EOF && enable $func
  719. #include <math.h>
  720. float foo(float f, float g) { return $func($args); }
  721. int main(void){ return 0; }
  722. EOF
  723. }
  724. check_func_headers(){
  725. log check_func_headers "$@"
  726. headers=$1
  727. funcs=$2
  728. shift 2
  729. {
  730. for hdr in $headers; do
  731. echo "#include <$hdr>"
  732. done
  733. for func in $funcs; do
  734. echo "long check_$func(void) { return (long) $func; }"
  735. done
  736. echo "int main(void) { return 0; }"
  737. } | check_ld "$@" && enable $funcs && enable_safe $headers
  738. }
  739. check_cpp_condition(){
  740. log check_cpp_condition "$@"
  741. header=$1
  742. condition=$2
  743. shift 2
  744. check_cpp "$@" <<EOF
  745. #include <$header>
  746. #if !($condition)
  747. #error "unsatisfied condition: $condition"
  748. #endif
  749. EOF
  750. }
  751. check_lib(){
  752. log check_lib "$@"
  753. header="$1"
  754. func="$2"
  755. shift 2
  756. check_header $header && check_func $func "$@" && add_extralibs "$@"
  757. }
  758. check_lib2(){
  759. log check_lib2 "$@"
  760. headers="$1"
  761. funcs="$2"
  762. shift 2
  763. check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
  764. }
  765. check_pkg_config(){
  766. log check_pkg_config "$@"
  767. pkg="$1"
  768. headers="$2"
  769. funcs="$3"
  770. shift 3
  771. $pkg_config --exists $pkg || return
  772. pkg_cflags=$($pkg_config --cflags $pkg)
  773. pkg_libs=$($pkg_config --libs $pkg)
  774. check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
  775. set_safe ${pkg}_cflags $pkg_cflags &&
  776. set_safe ${pkg}_libs $pkg_libs
  777. }
  778. check_exec(){
  779. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  780. }
  781. check_exec_crash(){
  782. code=$(cat)
  783. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  784. # are safe but may not be available everywhere. Thus we use
  785. # raise(SIGTERM) instead. The check is run in a subshell so we
  786. # can redirect the "Terminated" message from the shell. SIGBUS
  787. # is not defined by standard C so it is used conditionally.
  788. (check_exec "$@") >> $logfile 2>&1 <<EOF
  789. #include <signal.h>
  790. static void sighandler(int sig){
  791. raise(SIGTERM);
  792. }
  793. int foo(void){
  794. $code
  795. }
  796. int main(void){
  797. signal(SIGILL, sighandler);
  798. signal(SIGFPE, sighandler);
  799. signal(SIGSEGV, sighandler);
  800. #ifdef SIGBUS
  801. signal(SIGBUS, sighandler);
  802. #endif
  803. foo();
  804. }
  805. EOF
  806. }
  807. check_type(){
  808. log check_type "$@"
  809. headers=$1
  810. type=$2
  811. shift 2
  812. disable_safe "$type"
  813. check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
  814. }
  815. check_struct(){
  816. log check_struct "$@"
  817. headers=$1
  818. struct=$2
  819. member=$3
  820. shift 3
  821. disable_safe "${struct}_${member}"
  822. check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
  823. enable_safe "${struct}_${member}"
  824. }
  825. check_builtin(){
  826. log check_builtin "$@"
  827. name=$1
  828. headers=$2
  829. builtin=$3
  830. shift 3
  831. disable "$name"
  832. check_code ld "$headers" "$builtin" "$@" && enable "$name"
  833. }
  834. require(){
  835. name="$1"
  836. header="$2"
  837. func="$3"
  838. shift 3
  839. check_lib $header $func "$@" || die "ERROR: $name not found"
  840. }
  841. require2(){
  842. name="$1"
  843. headers="$2"
  844. func="$3"
  845. shift 3
  846. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  847. }
  848. require_pkg_config(){
  849. pkg="$1"
  850. check_pkg_config "$@" || die "ERROR: $pkg not found"
  851. add_cflags $(get_safe ${pkg}_cflags)
  852. add_extralibs $(get_safe ${pkg}_libs)
  853. }
  854. hostcc_o(){
  855. eval printf '%s\\n' $HOSTCC_O
  856. }
  857. check_host_cc(){
  858. log check_host_cc "$@"
  859. cat > $TMPC
  860. log_file $TMPC
  861. check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
  862. }
  863. check_host_cppflags(){
  864. log check_host_cppflags "$@"
  865. check_host_cc "$@" <<EOF && append host_cppflags "$@"
  866. int x;
  867. EOF
  868. }
  869. check_host_cflags(){
  870. log check_host_cflags "$@"
  871. set -- $($host_cflags_filter "$@")
  872. check_host_cc "$@" <<EOF && append host_cflags "$@"
  873. int x;
  874. EOF
  875. }
  876. apply(){
  877. file=$1
  878. shift
  879. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  880. }
  881. cp_if_changed(){
  882. cmp -s "$1" "$2" && echo "$2 is unchanged" && return
  883. mkdir -p "$(dirname $2)"
  884. $cp_f "$1" "$2"
  885. }
  886. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  887. # system-dependent things.
  888. COMPONENT_LIST="
  889. bsfs
  890. decoders
  891. demuxers
  892. encoders
  893. filters
  894. hwaccels
  895. indevs
  896. muxers
  897. outdevs
  898. parsers
  899. protocols
  900. "
  901. EXTERNAL_LIBRARY_LIST="
  902. avisynth
  903. bzlib
  904. frei0r
  905. gnutls
  906. libcdio
  907. libdc1394
  908. libfaac
  909. libfdk_aac
  910. libfreetype
  911. libgsm
  912. libilbc
  913. libmp3lame
  914. libopencore_amrnb
  915. libopencore_amrwb
  916. libopencv
  917. libopenjpeg
  918. libopus
  919. libpulse
  920. librtmp
  921. libschroedinger
  922. libspeex
  923. libtheora
  924. libvo_aacenc
  925. libvo_amrwbenc
  926. libvorbis
  927. libvpx
  928. libx264
  929. libxavs
  930. libxvid
  931. openssl
  932. x11grab
  933. zlib
  934. "
  935. HWACCEL_LIST="
  936. dxva2
  937. vaapi
  938. vda
  939. vdpau
  940. "
  941. LIBRARY_LIST="
  942. avcodec
  943. avdevice
  944. avfilter
  945. avformat
  946. avresample
  947. avutil
  948. swscale
  949. "
  950. PROGRAM_LIST="
  951. avconv
  952. avplay
  953. avprobe
  954. avserver
  955. "
  956. CONFIG_LIST="
  957. $COMPONENT_LIST
  958. $EXTERNAL_LIBRARY_LIST
  959. $HWACCEL_LIST
  960. $LIBRARY_LIST
  961. $PROGRAM_LIST
  962. dct
  963. doc
  964. fft
  965. gpl
  966. gray
  967. hardcoded_tables
  968. lsp
  969. lzo
  970. mdct
  971. memalign_hack
  972. network
  973. nonfree
  974. pic
  975. rdft
  976. runtime_cpudetect
  977. safe_bitstream_reader
  978. shared
  979. small
  980. sram
  981. static
  982. swscale_alpha
  983. thumb
  984. version3
  985. xmm_clobber_test
  986. "
  987. THREADS_LIST='
  988. pthreads
  989. w32threads
  990. '
  991. ARCH_LIST='
  992. aarch64
  993. alpha
  994. arm
  995. avr32
  996. avr32_ap
  997. avr32_uc
  998. bfin
  999. ia64
  1000. m68k
  1001. mips
  1002. mips64
  1003. parisc
  1004. ppc
  1005. ppc64
  1006. s390
  1007. sh4
  1008. sparc
  1009. sparc64
  1010. tilegx
  1011. tilepro
  1012. tomi
  1013. x86
  1014. x86_32
  1015. x86_64
  1016. '
  1017. ARCH_EXT_LIST_ARM='
  1018. armv5te
  1019. armv6
  1020. armv6t2
  1021. neon
  1022. vfp
  1023. vfpv3
  1024. '
  1025. ARCH_EXT_LIST_X86='
  1026. amd3dnow
  1027. amd3dnowext
  1028. avx
  1029. fma4
  1030. mmx
  1031. mmxext
  1032. sse
  1033. sse2
  1034. sse3
  1035. sse4
  1036. sse42
  1037. ssse3
  1038. '
  1039. ARCH_EXT_LIST="
  1040. $ARCH_EXT_LIST_ARM
  1041. $ARCH_EXT_LIST_X86
  1042. altivec
  1043. ppc4xx
  1044. vis
  1045. "
  1046. HAVE_LIST_CMDLINE='
  1047. inline_asm
  1048. symver
  1049. yasm
  1050. '
  1051. HAVE_LIST_PUB='
  1052. bigendian
  1053. fast_unaligned
  1054. '
  1055. MATH_FUNCS="
  1056. atanf
  1057. atan2f
  1058. cbrtf
  1059. cosf
  1060. exp2
  1061. exp2f
  1062. expf
  1063. isinf
  1064. isnan
  1065. ldexpf
  1066. llrint
  1067. llrintf
  1068. log2
  1069. log2f
  1070. log10f
  1071. lrint
  1072. lrintf
  1073. powf
  1074. rint
  1075. round
  1076. roundf
  1077. sinf
  1078. trunc
  1079. truncf
  1080. "
  1081. HAVE_LIST="
  1082. $ARCH_EXT_LIST
  1083. $(add_suffix _external $ARCH_EXT_LIST)
  1084. $(add_suffix _inline $ARCH_EXT_LIST)
  1085. $HAVE_LIST_CMDLINE
  1086. $HAVE_LIST_PUB
  1087. $THREADS_LIST
  1088. $MATH_FUNCS
  1089. aligned_malloc
  1090. aligned_stack
  1091. alsa_asoundlib_h
  1092. altivec_h
  1093. arpa_inet_h
  1094. asm_mod_q
  1095. asm_mod_y
  1096. attribute_may_alias
  1097. attribute_packed
  1098. cdio_paranoia_h
  1099. cdio_paranoia_paranoia_h
  1100. closesocket
  1101. cmov
  1102. CommandLineToArgvW
  1103. cpunop
  1104. CryptGenRandom
  1105. dcbzl
  1106. dev_bktr_ioctl_bt848_h
  1107. dev_bktr_ioctl_meteor_h
  1108. dev_ic_bt8xx_h
  1109. dev_video_bktr_ioctl_bt848_h
  1110. dev_video_meteor_ioctl_meteor_h
  1111. direct_h
  1112. dlfcn_h
  1113. dlopen
  1114. dos_paths
  1115. dxva_h
  1116. ebp_available
  1117. ebx_available
  1118. fast_64bit
  1119. fast_clz
  1120. fast_cmov
  1121. fcntl
  1122. fork
  1123. getaddrinfo
  1124. gethrtime
  1125. getopt
  1126. GetProcessAffinityMask
  1127. GetProcessMemoryInfo
  1128. GetProcessTimes
  1129. GetSystemTimeAsFileTime
  1130. getrusage
  1131. getservbyport
  1132. gettimeofday
  1133. gnu_as
  1134. gsm_h
  1135. ibm_asm
  1136. inet_aton
  1137. io_h
  1138. isatty
  1139. jack_port_get_latency_range
  1140. ldbrx
  1141. libdc1394_1
  1142. libdc1394_2
  1143. local_aligned_16
  1144. local_aligned_8
  1145. localtime_r
  1146. loongson
  1147. machine_ioctl_bt848_h
  1148. machine_ioctl_meteor_h
  1149. malloc_h
  1150. MapViewOfFile
  1151. memalign
  1152. mkstemp
  1153. mm_empty
  1154. mmap
  1155. mprotect
  1156. msvcrt
  1157. nanosleep
  1158. poll_h
  1159. posix_memalign
  1160. rdtsc
  1161. sched_getaffinity
  1162. sdl
  1163. sdl_video_size
  1164. SetConsoleTextAttribute
  1165. setmode
  1166. setrlimit
  1167. Sleep
  1168. sndio_h
  1169. socklen_t
  1170. soundcard_h
  1171. strerror_r
  1172. strptime
  1173. strtok_r
  1174. struct_addrinfo
  1175. struct_group_source_req
  1176. struct_ip_mreq_source
  1177. struct_ipv6_mreq
  1178. struct_pollfd
  1179. struct_rusage_ru_maxrss
  1180. struct_sockaddr_in6
  1181. struct_sockaddr_sa_len
  1182. struct_sockaddr_storage
  1183. struct_v4l2_frmivalenum_discrete
  1184. symver_asm_label
  1185. symver_gnu_asm
  1186. sysconf
  1187. sysctl
  1188. sys_mman_h
  1189. sys_param_h
  1190. sys_resource_h
  1191. sys_select_h
  1192. sys_soundcard_h
  1193. sys_time_h
  1194. sys_videoio_h
  1195. threads
  1196. unistd_h
  1197. usleep
  1198. vfp_args
  1199. VirtualAlloc
  1200. windows_h
  1201. winsock2_h
  1202. xform_asm
  1203. xmm_clobbers
  1204. "
  1205. # options emitted with CONFIG_ prefix but not available on the command line
  1206. CONFIG_EXTRA="
  1207. aandcttables
  1208. ac3dsp
  1209. audio_frame_queue
  1210. error_resilience
  1211. gcrypt
  1212. golomb
  1213. gplv3
  1214. h264chroma
  1215. h264dsp
  1216. h264pred
  1217. h264qpel
  1218. huffman
  1219. lgplv3
  1220. lpc
  1221. mpegaudio
  1222. mpegaudiodsp
  1223. mpegvideo
  1224. mpegvideoenc
  1225. nettle
  1226. rangecoder
  1227. rtpdec
  1228. rtpenc_chain
  1229. sinewin
  1230. videodsp
  1231. vp3dsp
  1232. "
  1233. CMDLINE_SELECT="
  1234. $ARCH_EXT_LIST
  1235. $CONFIG_LIST
  1236. $HAVE_LIST_CMDLINE
  1237. $THREADS_LIST
  1238. asm
  1239. cross_compile
  1240. debug
  1241. extra_warnings
  1242. logging
  1243. lto
  1244. optimizations
  1245. "
  1246. PATHS_LIST='
  1247. bindir
  1248. datadir
  1249. incdir
  1250. libdir
  1251. mandir
  1252. prefix
  1253. shlibdir
  1254. '
  1255. CMDLINE_SET="
  1256. $PATHS_LIST
  1257. ar
  1258. arch
  1259. as
  1260. build_suffix
  1261. cc
  1262. cpu
  1263. cross_prefix
  1264. dep_cc
  1265. extra_version
  1266. host_cc
  1267. host_cflags
  1268. host_ld
  1269. host_ldflags
  1270. host_libs
  1271. host_os
  1272. ld
  1273. logfile
  1274. malloc_prefix
  1275. nm
  1276. optflags
  1277. pkg_config
  1278. random_seed
  1279. samples
  1280. sysinclude
  1281. sysroot
  1282. target_exec
  1283. target_os
  1284. target_path
  1285. toolchain
  1286. "
  1287. CMDLINE_APPEND="
  1288. extra_cflags
  1289. host_cppflags
  1290. "
  1291. # code dependency declarations
  1292. # architecture extensions
  1293. armv5te_deps="arm"
  1294. armv6_deps="arm"
  1295. armv6t2_deps="arm"
  1296. neon_deps="arm"
  1297. vfp_deps="arm"
  1298. vfpv3_deps="vfp"
  1299. map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
  1300. altivec_deps="ppc"
  1301. ppc4xx_deps="ppc"
  1302. vis_deps="sparc"
  1303. x86_64_suggest="cmov fast_cmov"
  1304. amd3dnow_deps="mmx"
  1305. amd3dnowext_deps="amd3dnow"
  1306. mmx_deps="x86"
  1307. mmxext_deps="mmx"
  1308. sse_deps="mmxext"
  1309. sse2_deps="sse"
  1310. sse3_deps="sse2"
  1311. ssse3_deps="sse3"
  1312. sse4_deps="ssse3"
  1313. sse42_deps="sse4"
  1314. avx_deps="sse42"
  1315. fma4_deps="avx"
  1316. mmx_external_deps="yasm"
  1317. mmx_inline_deps="inline_asm"
  1318. mmx_suggest="mmx_external mmx_inline"
  1319. for ext in $(filter_out mmx $ARCH_EXT_LIST_X86); do
  1320. eval dep=\$${ext}_deps
  1321. eval ${ext}_external_deps='"${dep}_external"'
  1322. eval ${ext}_inline_deps='"${dep}_inline"'
  1323. eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
  1324. done
  1325. aligned_stack_if_any="ppc x86"
  1326. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1327. fast_clz_if_any="alpha avr32 mips ppc x86"
  1328. fast_unaligned_if_any="ppc x86"
  1329. inline_asm_deps="!tms470"
  1330. need_memalign="altivec neon sse"
  1331. symver_if_any="symver_asm_label symver_gnu_asm"
  1332. log2_deps="!msvcrt"
  1333. # subsystems
  1334. dct_select="rdft"
  1335. mdct_select="fft"
  1336. rdft_select="fft"
  1337. mpegaudio_select="mpegaudiodsp"
  1338. mpegaudiodsp_select="dct"
  1339. mpegvideo_select="videodsp"
  1340. mpegvideoenc_select="mpegvideo"
  1341. # decoders / encoders
  1342. aac_decoder_select="mdct sinewin"
  1343. aac_encoder_select="audio_frame_queue mdct sinewin"
  1344. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1345. ac3_decoder_select="mdct ac3dsp ac3_parser"
  1346. ac3_encoder_select="mdct ac3dsp"
  1347. ac3_fixed_encoder_select="mdct ac3dsp"
  1348. alac_encoder_select="lpc"
  1349. amrnb_decoder_select="lsp"
  1350. amrwb_decoder_select="lsp"
  1351. atrac1_decoder_select="mdct sinewin"
  1352. atrac3_decoder_select="mdct"
  1353. binkaudio_dct_decoder_select="mdct rdft dct sinewin"
  1354. binkaudio_rdft_decoder_select="mdct rdft sinewin"
  1355. cavs_decoder_select="golomb h264chroma mpegvideo"
  1356. comfortnoise_encoder_select="lpc"
  1357. cook_decoder_select="mdct sinewin"
  1358. cscd_decoder_select="lzo"
  1359. cscd_decoder_suggest="zlib"
  1360. dca_decoder_select="mdct"
  1361. dnxhd_encoder_select="aandcttables mpegvideoenc"
  1362. dxa_decoder_select="zlib"
  1363. eac3_decoder_select="ac3_decoder"
  1364. eac3_encoder_select="ac3_encoder"
  1365. eamad_decoder_select="aandcttables mpegvideo"
  1366. eatgq_decoder_select="aandcttables"
  1367. eatqi_decoder_select="aandcttables mpegvideo"
  1368. ffv1_decoder_select="golomb rangecoder"
  1369. ffv1_encoder_select="rangecoder"
  1370. ffvhuff_encoder_select="huffman"
  1371. flac_decoder_select="golomb"
  1372. flac_encoder_select="golomb lpc"
  1373. flashsv_decoder_select="zlib"
  1374. flashsv_encoder_select="zlib"
  1375. flashsv2_decoder_select="zlib"
  1376. flv_decoder_select="h263_decoder"
  1377. flv_encoder_select="h263_encoder"
  1378. fraps_decoder_select="huffman"
  1379. h261_decoder_select="error_resilience mpegvideo"
  1380. h261_encoder_select="aandcttables mpegvideoenc"
  1381. h263_decoder_select="error_resilience h263_parser mpegvideo"
  1382. h263_encoder_select="aandcttables mpegvideoenc"
  1383. h263i_decoder_select="h263_decoder"
  1384. h263p_encoder_select="h263_encoder"
  1385. h264_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel videodsp"
  1386. huffyuv_encoder_select="huffman"
  1387. iac_decoder_select="fft mdct sinewin"
  1388. imc_decoder_select="fft mdct sinewin"
  1389. jpegls_decoder_select="golomb"
  1390. jpegls_encoder_select="golomb"
  1391. ljpeg_encoder_select="aandcttables mpegvideoenc"
  1392. loco_decoder_select="golomb"
  1393. mdec_decoder_select="error_resilience mpegvideo"
  1394. mjpeg_encoder_select="aandcttables mpegvideoenc"
  1395. mlp_decoder_select="mlp_parser"
  1396. mp1_decoder_select="mpegaudio"
  1397. mp1float_decoder_select="mpegaudio"
  1398. mp2_decoder_select="mpegaudio"
  1399. mp2float_decoder_select="mpegaudio"
  1400. mp3_decoder_select="mpegaudio"
  1401. mp3adu_decoder_select="mpegaudio"
  1402. mp3adufloat_decoder_select="mpegaudio"
  1403. mp3float_decoder_select="mpegaudio"
  1404. mp3on4_decoder_select="mpegaudio"
  1405. mp3on4float_decoder_select="mpegaudio"
  1406. mpc7_decoder_select="mpegaudiodsp"
  1407. mpc8_decoder_select="mpegaudiodsp"
  1408. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1409. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1410. mpeg1video_decoder_select="error_resilience mpegvideo"
  1411. mpeg1video_encoder_select="aandcttables mpegvideoenc"
  1412. mpeg2video_decoder_select="error_resilience mpegvideo"
  1413. mpeg2video_encoder_select="aandcttables mpegvideoenc"
  1414. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1415. mpeg4_encoder_select="h263_encoder"
  1416. msmpeg4v1_decoder_select="h263_decoder"
  1417. msmpeg4v1_encoder_select="h263_encoder"
  1418. msmpeg4v2_decoder_select="h263_decoder"
  1419. msmpeg4v2_encoder_select="h263_encoder"
  1420. msmpeg4v3_decoder_select="h263_decoder"
  1421. msmpeg4v3_encoder_select="h263_encoder"
  1422. mss2_decoder_select="error_resilience vc1_decoder"
  1423. nellymoser_decoder_select="mdct sinewin"
  1424. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  1425. nuv_decoder_select="lzo"
  1426. png_decoder_select="zlib"
  1427. png_encoder_select="zlib"
  1428. qcelp_decoder_select="lsp"
  1429. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1430. ra_144_encoder_select="audio_frame_queue lpc"
  1431. ralf_decoder_select="golomb"
  1432. rv10_decoder_select="error_resilience h263_decoder"
  1433. rv10_encoder_select="h263_encoder"
  1434. rv20_decoder_select="error_resilience h263_decoder"
  1435. rv20_encoder_select="h263_encoder"
  1436. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo"
  1437. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo"
  1438. shorten_decoder_select="golomb"
  1439. sipr_decoder_select="lsp"
  1440. svq1_decoder_select="mpegvideo"
  1441. svq1_encoder_select="aandcttables mpegvideoenc"
  1442. svq3_decoder_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel mpegvideo"
  1443. svq3_decoder_suggest="zlib"
  1444. theora_decoder_select="vp3_decoder"
  1445. tiff_decoder_suggest="zlib"
  1446. tiff_encoder_suggest="zlib"
  1447. truehd_decoder_select="mlp_decoder"
  1448. tscc_decoder_select="zlib"
  1449. twinvq_decoder_select="mdct lsp sinewin"
  1450. utvideo_encoder_select="huffman"
  1451. vc1_decoder_select="error_resilience h263_decoder h264chroma h264qpel"
  1452. vc1image_decoder_select="vc1_decoder"
  1453. vorbis_decoder_select="mdct"
  1454. vorbis_encoder_select="mdct"
  1455. vp3_decoder_select="vp3dsp videodsp"
  1456. vp5_decoder_select="h264chroma videodsp vp3dsp"
  1457. vp6_decoder_select="h264chroma huffman videodsp vp3dsp"
  1458. vp6a_decoder_select="vp6_decoder"
  1459. vp6f_decoder_select="vp6_decoder"
  1460. vp8_decoder_select="h264pred videodsp"
  1461. wmapro_decoder_select="mdct sinewin"
  1462. wmav1_decoder_select="mdct sinewin"
  1463. wmav1_encoder_select="mdct sinewin"
  1464. wmav2_decoder_select="mdct sinewin"
  1465. wmav2_encoder_select="mdct sinewin"
  1466. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1467. wmv1_decoder_select="h263_decoder"
  1468. wmv1_encoder_select="h263_encoder"
  1469. wmv2_decoder_select="h263_decoder"
  1470. wmv2_encoder_select="h263_encoder"
  1471. wmv3_decoder_select="vc1_decoder"
  1472. wmv3image_decoder_select="wmv3_decoder"
  1473. zerocodec_decoder_select="zlib"
  1474. zlib_decoder_select="zlib"
  1475. zlib_encoder_select="zlib"
  1476. zmbv_decoder_select="zlib"
  1477. zmbv_encoder_select="zlib"
  1478. # hardware accelerators
  1479. dxva2_deps="dxva2api_h"
  1480. vaapi_deps="va_va_h"
  1481. vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  1482. vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
  1483. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1484. h263_vaapi_hwaccel_deps="vaapi"
  1485. h263_vaapi_hwaccel_select="h263_decoder"
  1486. h263_vdpau_hwaccel_deps="vdpau"
  1487. h263_vdpau_hwaccel_select="h263_decoder"
  1488. h264_dxva2_hwaccel_deps="dxva2"
  1489. h264_dxva2_hwaccel_select="h264_decoder"
  1490. h264_vaapi_hwaccel_deps="vaapi"
  1491. h264_vaapi_hwaccel_select="h264_decoder"
  1492. h264_vda_hwaccel_deps="vda"
  1493. h264_vda_hwaccel_select="h264_decoder"
  1494. h264_vdpau_decoder_deps="vdpau"
  1495. h264_vdpau_decoder_select="h264_decoder"
  1496. h264_vdpau_hwaccel_deps="vdpau"
  1497. h264_vdpau_hwaccel_select="h264_decoder"
  1498. mpeg_vdpau_decoder_deps="vdpau"
  1499. mpeg_vdpau_decoder_select="mpegvideo_decoder"
  1500. mpeg1_vdpau_decoder_deps="vdpau"
  1501. mpeg1_vdpau_decoder_select="mpeg1video_decoder"
  1502. mpeg1_vdpau_hwaccel_deps="vdpau"
  1503. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  1504. mpeg2_dxva2_hwaccel_deps="dxva2"
  1505. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  1506. mpeg2_vaapi_hwaccel_deps="vaapi"
  1507. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  1508. mpeg2_vdpau_hwaccel_deps="vdpau"
  1509. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  1510. mpeg4_vaapi_hwaccel_deps="vaapi"
  1511. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  1512. mpeg4_vdpau_decoder_deps="vdpau"
  1513. mpeg4_vdpau_decoder_select="mpeg4_decoder"
  1514. mpeg4_vdpau_hwaccel_deps="vdpau"
  1515. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  1516. vc1_dxva2_hwaccel_deps="dxva2"
  1517. vc1_dxva2_hwaccel_select="vc1_decoder"
  1518. vc1_vaapi_hwaccel_deps="vaapi"
  1519. vc1_vaapi_hwaccel_select="vc1_decoder"
  1520. vc1_vdpau_decoder_deps="vdpau"
  1521. vc1_vdpau_decoder_select="vc1_decoder"
  1522. vc1_vdpau_hwaccel_deps="vdpau"
  1523. vc1_vdpau_hwaccel_select="vc1_decoder"
  1524. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1525. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1526. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1527. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  1528. # parsers
  1529. h264_parser_select="error_resilience golomb h264chroma h264dsp h264pred h264qpel videodsp"
  1530. mpeg4video_parser_select="error_resilience mpegvideo"
  1531. mpegvideo_parser_select="error_resilience mpegvideo"
  1532. vc1_parser_select="mpegvideo"
  1533. # external libraries
  1534. libfaac_encoder_deps="libfaac"
  1535. libfaac_encoder_select="audio_frame_queue"
  1536. libfdk_aac_encoder_deps="libfdk_aac"
  1537. libfdk_aac_encoder_select="audio_frame_queue"
  1538. libgsm_decoder_deps="libgsm"
  1539. libgsm_encoder_deps="libgsm"
  1540. libgsm_ms_decoder_deps="libgsm"
  1541. libgsm_ms_encoder_deps="libgsm"
  1542. libilbc_decoder_deps="libilbc"
  1543. libilbc_encoder_deps="libilbc"
  1544. libmp3lame_encoder_deps="libmp3lame"
  1545. libmp3lame_encoder_select="audio_frame_queue"
  1546. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1547. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1548. libopencore_amrnb_encoder_select="audio_frame_queue"
  1549. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1550. libopenjpeg_decoder_deps="libopenjpeg"
  1551. libopenjpeg_encoder_deps="libopenjpeg"
  1552. libopus_decoder_deps="libopus"
  1553. libopus_encoder_deps="libopus"
  1554. libopus_encoder_select="audio_frame_queue"
  1555. libschroedinger_decoder_deps="libschroedinger"
  1556. libschroedinger_encoder_deps="libschroedinger"
  1557. libspeex_decoder_deps="libspeex"
  1558. libspeex_encoder_deps="libspeex"
  1559. libspeex_encoder_select="audio_frame_queue"
  1560. libtheora_encoder_deps="libtheora"
  1561. libvo_aacenc_encoder_deps="libvo_aacenc"
  1562. libvo_aacenc_encoder_select="audio_frame_queue"
  1563. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1564. libvorbis_encoder_deps="libvorbis"
  1565. libvorbis_encoder_select="audio_frame_queue"
  1566. libvpx_vp8_decoder_deps="libvpx"
  1567. libvpx_vp8_encoder_deps="libvpx"
  1568. libvpx_vp9_decoder_deps="libvpx"
  1569. libvpx_vp9_encoder_deps="libvpx"
  1570. libx264_encoder_deps="libx264"
  1571. libxavs_encoder_deps="libxavs"
  1572. libxvid_encoder_deps="libxvid"
  1573. # demuxers / muxers
  1574. ac3_demuxer_select="ac3_parser"
  1575. asf_stream_muxer_select="asf_muxer"
  1576. avisynth_demuxer_deps="avisynth"
  1577. dirac_demuxer_select="dirac_parser"
  1578. eac3_demuxer_select="ac3_parser"
  1579. flac_demuxer_select="flac_parser"
  1580. ipod_muxer_select="mov_muxer"
  1581. ismv_muxer_select="mov_muxer"
  1582. matroska_audio_muxer_select="matroska_muxer"
  1583. matroska_demuxer_suggest="bzlib lzo zlib"
  1584. mov_demuxer_suggest="zlib"
  1585. mov_muxer_select="rtpenc_chain"
  1586. mp3_demuxer_select="mpegaudio_parser"
  1587. mp4_muxer_select="mov_muxer"
  1588. mpegts_muxer_select="adts_muxer latm_muxer mpegvideo"
  1589. mpegtsraw_demuxer_select="mpegts_demuxer"
  1590. mxf_d10_muxer_select="mxf_muxer"
  1591. ogg_demuxer_select="golomb"
  1592. psp_muxer_select="mov_muxer"
  1593. rtp_demuxer_select="sdp_demuxer"
  1594. rtp_muxer_select="mpegvideo"
  1595. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1596. rtsp_demuxer_select="http_protocol rtpdec"
  1597. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  1598. sap_demuxer_select="sdp_demuxer"
  1599. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  1600. sdp_demuxer_select="rtpdec"
  1601. smoothstreaming_muxer_select="ismv_muxer"
  1602. spdif_muxer_select="aac_parser"
  1603. tak_demuxer_select="tak_parser"
  1604. tg2_muxer_select="mov_muxer"
  1605. tgp_muxer_select="mov_muxer"
  1606. w64_demuxer_deps="wav_demuxer"
  1607. # indevs / outdevs
  1608. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1609. alsa_outdev_deps="alsa_asoundlib_h"
  1610. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1611. dv1394_indev_deps="dv1394 dv_demuxer"
  1612. fbdev_indev_deps="linux_fb_h"
  1613. jack_indev_deps="jack_jack_h"
  1614. libcdio_indev_deps="libcdio"
  1615. libdc1394_indev_deps="libdc1394"
  1616. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1617. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1618. pulse_indev_deps="libpulse"
  1619. sndio_indev_deps="sndio_h"
  1620. sndio_outdev_deps="sndio_h"
  1621. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1622. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1623. vfwcap_indev_extralibs="-lavicap32"
  1624. x11grab_indev_deps="x11grab XShmCreateImage"
  1625. # protocols
  1626. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  1627. ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
  1628. ffrtmpcrypt_protocol_select="tcp_protocol"
  1629. ffrtmphttp_protocol_deps="!librtmp_protocol"
  1630. ffrtmphttp_protocol_select="http_protocol"
  1631. gopher_protocol_select="network"
  1632. httpproxy_protocol_select="tcp_protocol"
  1633. http_protocol_select="tcp_protocol"
  1634. https_protocol_select="tls_protocol"
  1635. librtmp_protocol_deps="librtmp"
  1636. librtmpe_protocol_deps="librtmp"
  1637. librtmps_protocol_deps="librtmp"
  1638. librtmpt_protocol_deps="librtmp"
  1639. librtmpte_protocol_deps="librtmp"
  1640. mmsh_protocol_select="http_protocol"
  1641. mmst_protocol_select="network"
  1642. rtmp_protocol_deps="!librtmp_protocol"
  1643. rtmp_protocol_select="tcp_protocol"
  1644. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  1645. rtmps_protocol_deps="!librtmp_protocol"
  1646. rtmps_protocol_select="tls_protocol"
  1647. rtmpt_protocol_select="ffrtmphttp_protocol"
  1648. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  1649. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  1650. rtp_protocol_select="udp_protocol"
  1651. sctp_protocol_deps="struct_sctp_event_subscribe"
  1652. sctp_protocol_select="network"
  1653. srtp_protocol_select="rtp_protocol"
  1654. tcp_protocol_select="network"
  1655. tls_protocol_deps_any="openssl gnutls"
  1656. tls_protocol_select="tcp_protocol"
  1657. udp_protocol_select="network"
  1658. # filters
  1659. blackframe_filter_deps="gpl"
  1660. boxblur_filter_deps="gpl"
  1661. cropdetect_filter_deps="gpl"
  1662. delogo_filter_deps="gpl"
  1663. drawtext_filter_deps="libfreetype"
  1664. frei0r_filter_deps="frei0r dlopen strtok_r"
  1665. frei0r_filter_extralibs='$ldl'
  1666. frei0r_src_filter_deps="frei0r dlopen strtok_r"
  1667. frei0r_src_filter_extralibs='$ldl'
  1668. hqdn3d_filter_deps="gpl"
  1669. resample_filter_deps="avresample"
  1670. ocv_filter_deps="libopencv"
  1671. scale_filter_deps="swscale"
  1672. yadif_filter_deps="gpl"
  1673. # libraries
  1674. avcodec_deps="avutil"
  1675. avdevice_deps="avutil avcodec avformat"
  1676. avfilter_deps="avutil"
  1677. avformat_deps="avutil avcodec"
  1678. avresample_deps="avutil"
  1679. swscale_deps="avutil"
  1680. # programs
  1681. avconv_deps="avcodec avfilter avformat avresample swscale"
  1682. avconv_select="aformat_filter anull_filter asyncts_filter format_filter
  1683. fps_filter null_filter resample_filter scale_filter
  1684. setpts_filter"
  1685. avplay_deps="avcodec avformat avresample swscale sdl"
  1686. avplay_select="rdft"
  1687. avprobe_deps="avcodec avformat"
  1688. avserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer !shared"
  1689. avserver_extralibs='$ldl'
  1690. doc_deps="texi2html"
  1691. # default parameters
  1692. logfile="config.log"
  1693. # installation paths
  1694. prefix_default="/usr/local"
  1695. bindir_default='${prefix}/bin'
  1696. datadir_default='${prefix}/share/avconv'
  1697. incdir_default='${prefix}/include'
  1698. libdir_default='${prefix}/lib'
  1699. mandir_default='${prefix}/share/man'
  1700. shlibdir_default="$libdir_default"
  1701. # toolchain
  1702. ar_default="ar"
  1703. cc_default="gcc"
  1704. host_cc_default="gcc"
  1705. cp_f="cp -f"
  1706. ln_s="ln -s -f"
  1707. nm_default="nm -g"
  1708. objformat="elf"
  1709. pkg_config_default=pkg-config
  1710. ranlib="ranlib"
  1711. yasmexe="yasm"
  1712. nogas=":"
  1713. # machine
  1714. arch_default=$(uname -m)
  1715. cpu="generic"
  1716. # OS
  1717. target_os_default=$(tolower $(uname -s))
  1718. host_os=$target_os_default
  1719. # configurable options
  1720. enable $LIBRARY_LIST $PROGRAM_LIST
  1721. enable asm
  1722. enable debug
  1723. enable doc
  1724. enable optimizations
  1725. enable safe_bitstream_reader
  1726. enable static
  1727. enable swscale_alpha
  1728. # build settings
  1729. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1730. AVSERVERLDFLAGS=-Wl,-E
  1731. LIBPREF="lib"
  1732. LIBSUF=".a"
  1733. FULLNAME='$(NAME)$(BUILDSUF)'
  1734. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1735. SLIBPREF="lib"
  1736. SLIBSUF=".so"
  1737. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1738. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1739. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1740. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1741. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  1742. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  1743. asflags_filter=echo
  1744. cflags_filter=echo
  1745. ldflags_filter=echo
  1746. AS_C='-c'
  1747. AS_O='-o $@'
  1748. CC_C='-c'
  1749. CC_E='-E -o $@'
  1750. CC_O='-o $@'
  1751. LD_O='-o $@'
  1752. LD_LIB='-l%'
  1753. LD_PATH='-L'
  1754. HOSTCC_C='-c'
  1755. HOSTCC_O='-o $@'
  1756. HOSTLD_O='-o $@'
  1757. host_cflags='-O3 -g'
  1758. host_cppflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600'
  1759. host_libs='-lm'
  1760. host_cflags_filter=echo
  1761. host_ldflags_filter=echo
  1762. target_path='$(CURDIR)'
  1763. # since the object filename is not given with the -MM flag, the compiler
  1764. # is only able to print the basename, and we must add the path ourselves
  1765. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1766. DEPFLAGS='-MM'
  1767. # find source path
  1768. if test -f configure; then
  1769. source_path=.
  1770. else
  1771. source_path=$(cd $(dirname "$0"); pwd)
  1772. echo "$source_path" | grep -q '[[:blank:]]' &&
  1773. die "Out of tree builds are impossible with whitespace in source path."
  1774. test -e "$source_path/config.h" &&
  1775. die "Out of tree builds are impossible with config.h in source dir."
  1776. fi
  1777. for v in "$@"; do
  1778. r=${v#*=}
  1779. l=${v%"$r"}
  1780. r=$(sh_quote "$r")
  1781. LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
  1782. done
  1783. find_things(){
  1784. thing=$1
  1785. pattern=$2
  1786. file=$source_path/$3
  1787. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1788. }
  1789. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1790. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1791. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1792. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1793. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1794. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1795. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1796. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1797. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1798. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1799. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1800. ALL_COMPONENTS="
  1801. $BSF_LIST
  1802. $DECODER_LIST
  1803. $DEMUXER_LIST
  1804. $ENCODER_LIST
  1805. $FILTER_LIST
  1806. $HWACCEL_LIST
  1807. $INDEV_LIST
  1808. $MUXER_LIST
  1809. $OUTDEV_LIST
  1810. $PARSER_LIST
  1811. $PROTOCOL_LIST
  1812. "
  1813. for n in $COMPONENT_LIST; do
  1814. v=$(toupper ${n%s})_LIST
  1815. eval enable \$$v
  1816. eval ${n}_if_any="\$$v"
  1817. done
  1818. enable $ARCH_EXT_LIST
  1819. die_unknown(){
  1820. echo "Unknown option \"$1\"."
  1821. echo "See $0 --help for available options."
  1822. exit 1
  1823. }
  1824. print_3_columns() {
  1825. cat | tr ' ' '\n' | sort | pr -r -3 -t
  1826. }
  1827. show_list() {
  1828. suffix=_$1
  1829. shift
  1830. echo $* | sed s/$suffix//g | print_3_columns
  1831. exit 0
  1832. }
  1833. rand_list(){
  1834. IFS=', '
  1835. set -- $*
  1836. unset IFS
  1837. for thing; do
  1838. comp=${thing%:*}
  1839. prob=${thing#$comp}
  1840. prob=${prob#:}
  1841. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  1842. echo "prob ${prob:-0.5}"
  1843. printf '%s\n' $comp
  1844. done
  1845. }
  1846. do_random(){
  1847. action=$1
  1848. shift
  1849. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  1850. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  1851. }
  1852. for opt do
  1853. optval="${opt#*=}"
  1854. case "$opt" in
  1855. --extra-ldflags=*)
  1856. add_ldflags $optval
  1857. ;;
  1858. --extra-libs=*)
  1859. add_extralibs $optval
  1860. ;;
  1861. --disable-devices)
  1862. disable $INDEV_LIST $OUTDEV_LIST
  1863. ;;
  1864. --enable-debug=*)
  1865. debuglevel="$optval"
  1866. ;;
  1867. --disable-programs)
  1868. disable $PROGRAM_LIST
  1869. ;;
  1870. --disable-everything)
  1871. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1872. ;;
  1873. --disable-all)
  1874. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1875. disable $LIBRARY_LIST $PROGRAM_LIST doc
  1876. ;;
  1877. --enable-random|--disable-random)
  1878. action=${opt%%-random}
  1879. do_random ${action#--} $COMPONENT_LIST
  1880. ;;
  1881. --enable-random=*|--disable-random=*)
  1882. action=${opt%%-random=*}
  1883. do_random ${action#--} $optval
  1884. ;;
  1885. --enable-*=*|--disable-*=*)
  1886. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1887. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1888. eval list=\$$(toupper $thing)_LIST
  1889. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1890. $action $(filter "$name" $list)
  1891. ;;
  1892. --enable-?*|--disable-?*)
  1893. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1894. if is_in $option $COMPONENT_LIST; then
  1895. test $action = disable && action=unset
  1896. eval $action \$$(toupper ${option%s})_LIST
  1897. elif is_in $option $CMDLINE_SELECT; then
  1898. $action $option
  1899. else
  1900. die_unknown $opt
  1901. fi
  1902. ;;
  1903. --list-*)
  1904. NAME="${opt#--list-}"
  1905. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1906. NAME=${NAME%s}
  1907. eval show_list $NAME \$$(toupper $NAME)_LIST
  1908. ;;
  1909. --help|-h) show_help
  1910. ;;
  1911. *)
  1912. optname="${opt%%=*}"
  1913. optname="${optname#--}"
  1914. optname=$(echo "$optname" | sed 's/-/_/g')
  1915. if is_in $optname $CMDLINE_SET; then
  1916. eval $optname='$optval'
  1917. elif is_in $optname $CMDLINE_APPEND; then
  1918. append $optname "$optval"
  1919. else
  1920. die_unknown $opt
  1921. fi
  1922. ;;
  1923. esac
  1924. done
  1925. disabled logging && logfile=/dev/null
  1926. echo "# $0 $LIBAV_CONFIGURATION" > $logfile
  1927. set >> $logfile
  1928. test -n "$cross_prefix" && enable cross_compile
  1929. if enabled cross_compile; then
  1930. test -n "$arch" && test -n "$target_os" ||
  1931. die "Must specify target arch and OS when cross-compiling"
  1932. fi
  1933. ar_default="${cross_prefix}${ar_default}"
  1934. cc_default="${cross_prefix}${cc_default}"
  1935. nm_default="${cross_prefix}${nm_default}"
  1936. pkg_config_default="${cross_prefix}${pkg_config_default}"
  1937. ranlib="${cross_prefix}${ranlib}"
  1938. sysinclude_default="${sysroot}/usr/include"
  1939. case "$toolchain" in
  1940. clang-asan)
  1941. cc_default="clang"
  1942. add_cflags -faddress-sanitizer
  1943. add_ldflags -faddress-sanitizer
  1944. ;;
  1945. clang-tsan)
  1946. cc_default="clang"
  1947. add_cflags -fthread-sanitizer
  1948. add_ldflags -fthread-sanitizer
  1949. ;;
  1950. msvc)
  1951. cc_default="c99wrap cl"
  1952. ld_default="c99wrap link"
  1953. nm_default="dumpbin -symbols"
  1954. ar_default="lib"
  1955. target_os_default="win32"
  1956. ;;
  1957. ?*)
  1958. die "Unknown toolchain $toolchain"
  1959. ;;
  1960. esac
  1961. set_default arch cc pkg_config sysinclude target_os
  1962. enabled cross_compile || host_cc_default=$cc
  1963. set_default host_cc
  1964. if ! $pkg_config --version >/dev/null 2>&1; then
  1965. warn "$pkg_config not found, library detection may fail."
  1966. pkg_config=false
  1967. fi
  1968. exesuf() {
  1969. case $1 in
  1970. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  1971. esac
  1972. }
  1973. EXESUF=$(exesuf $target_os)
  1974. HOSTEXESUF=$(exesuf $host_os)
  1975. # set temporary file name
  1976. : ${TMPDIR:=$TEMPDIR}
  1977. : ${TMPDIR:=$TMP}
  1978. : ${TMPDIR:=/tmp}
  1979. if ! check_cmd mktemp -u XXXXXX; then
  1980. # simple replacement for missing mktemp
  1981. # NOT SAFE FOR GENERAL USE
  1982. mktemp(){
  1983. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  1984. }
  1985. fi
  1986. tmpfile(){
  1987. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1988. (set -C; exec > $tmp) 2>/dev/null ||
  1989. die "Unable to create temporary file in $TMPDIR."
  1990. append TMPFILES $tmp
  1991. eval $1=$tmp
  1992. }
  1993. trap 'rm -f -- $TMPFILES' EXIT
  1994. tmpfile TMPASM .asm
  1995. tmpfile TMPC .c
  1996. tmpfile TMPE $EXESUF
  1997. tmpfile TMPH .h
  1998. tmpfile TMPO .o
  1999. tmpfile TMPS .S
  2000. tmpfile TMPSH .sh
  2001. tmpfile TMPV .ver
  2002. unset -f mktemp
  2003. chmod +x $TMPE
  2004. # make sure we can execute files in $TMPDIR
  2005. cat > $TMPSH 2>> $logfile <<EOF
  2006. #! /bin/sh
  2007. EOF
  2008. chmod +x $TMPSH >> $logfile 2>&1
  2009. if ! $TMPSH >> $logfile 2>&1; then
  2010. cat <<EOF
  2011. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2012. variable to another directory and make sure that it is not mounted noexec.
  2013. EOF
  2014. die "Sanity test failed."
  2015. fi
  2016. ccc_flags(){
  2017. for flag; do
  2018. case $flag in
  2019. -std=c99) echo -c99 ;;
  2020. -mcpu=*) echo -arch ${flag#*=} ;;
  2021. -mieee) echo -ieee ;;
  2022. -O*|-fast) echo $flag ;;
  2023. -fno-math-errno) echo -assume nomath_errno ;;
  2024. -g) echo -g3 ;;
  2025. -Wall) echo -msg_enable level2 ;;
  2026. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2027. -Wl,*) echo $flag ;;
  2028. -f*|-W*) ;;
  2029. *) echo $flag ;;
  2030. esac
  2031. done
  2032. }
  2033. msvc_flags(){
  2034. for flag; do
  2035. case $flag in
  2036. -fomit-frame-pointer) echo -Oy ;;
  2037. -g) echo -Z7 ;;
  2038. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2039. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2040. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2041. -wd4996 -wd4273 ;;
  2042. -std=c99) ;;
  2043. -fno-math-errno) ;;
  2044. -fno-common) ;;
  2045. -fno-signed-zeros) ;;
  2046. -fPIC) ;;
  2047. -lz) echo zlib.lib ;;
  2048. -lavifil32) echo vfw32.lib ;;
  2049. -lavicap32) echo vfw32.lib user32.lib ;;
  2050. -l*) echo ${flag#-l}.lib ;;
  2051. *) echo $flag ;;
  2052. esac
  2053. done
  2054. }
  2055. pgi_flags(){
  2056. for flag; do
  2057. case $flag in
  2058. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2059. -fomit-frame-pointer) echo -Mnoframe ;;
  2060. -g) echo -gopt ;;
  2061. *) echo $flag ;;
  2062. esac
  2063. done
  2064. }
  2065. suncc_flags(){
  2066. for flag; do
  2067. case $flag in
  2068. -march=*|-mcpu=*)
  2069. case "${flag#*=}" in
  2070. native) echo -xtarget=native ;;
  2071. v9|niagara) echo -xarch=sparc ;;
  2072. ultrasparc) echo -xarch=sparcvis ;;
  2073. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2074. i586|pentium) echo -xchip=pentium ;;
  2075. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2076. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2077. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2078. pentium4*) echo -xtarget=pentium4 ;;
  2079. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2080. *-sse3) echo -xarch=sse3 ;;
  2081. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2082. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2083. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2084. amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
  2085. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2086. k8|opteron|athlon64|athlon-fx)
  2087. echo -xarch=sse2a ;;
  2088. athlon*) echo -xarch=pentium_proa ;;
  2089. esac
  2090. ;;
  2091. -std=c99) echo -xc99 ;;
  2092. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2093. -fPIC) echo -KPIC -xcode=pic32 ;;
  2094. -W*,*) echo $flag ;;
  2095. -f*-*|-W*|-mimpure-text) ;;
  2096. -shared) echo -G ;;
  2097. *) echo $flag ;;
  2098. esac
  2099. done
  2100. }
  2101. tms470_flags(){
  2102. for flag; do
  2103. case $flag in
  2104. -march=*|-mcpu=*)
  2105. case "${flag#*=}" in
  2106. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2107. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2108. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2109. armv6*|arm11*) echo -mv=6 ;;
  2110. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2111. echo -mv=5e ;;
  2112. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2113. esac
  2114. ;;
  2115. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2116. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2117. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2118. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2119. -msoft-float) echo --float_support=vfplib ;;
  2120. -O[0-3]|-mf=*) echo $flag ;;
  2121. -g) echo -g -mn ;;
  2122. -pds=*) echo $flag ;;
  2123. -D*|-I*) echo $flag ;;
  2124. --gcc|--abi=*) echo $flag ;;
  2125. -me) echo $flag ;;
  2126. esac
  2127. done
  2128. }
  2129. probe_cc(){
  2130. pfx=$1
  2131. _cc=$2
  2132. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2133. unset _ld_o _ldflags _ld_lib _ld_path
  2134. unset _depflags _DEPCMD _DEPFLAGS
  2135. _flags_filter=echo
  2136. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2137. _type=llvm_gcc
  2138. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2139. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2140. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2141. _cflags_speed='-O3'
  2142. _cflags_size='-Os'
  2143. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2144. _type=gcc
  2145. gcc_version=$($_cc --version | head -n1)
  2146. gcc_basever=$($_cc -dumpversion)
  2147. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2148. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2149. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2150. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2151. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2152. fi
  2153. _cflags_speed='-O3'
  2154. _cflags_size='-Os'
  2155. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2156. _type=icc
  2157. _ident=$($_cc --version | head -n1)
  2158. _depflags='-MMD'
  2159. _cflags_speed='-O3'
  2160. _cflags_size='-Os'
  2161. _cflags_noopt='-O1'
  2162. elif $_cc -v 2>&1 | grep -q xlc; then
  2163. _type=xlc
  2164. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2165. _cflags_speed='-O5'
  2166. _cflags_size='-O5 -qcompact'
  2167. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2168. _type=ccc
  2169. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2170. _DEPFLAGS='-M'
  2171. _cflags_speed='-fast'
  2172. _cflags_size='-O1'
  2173. _flags_filter=ccc_flags
  2174. elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  2175. test -d "$sysroot" || die "No valid sysroot specified."
  2176. _type=armcc
  2177. _ident=$($_cc --vsn | head -n1)
  2178. armcc_conf="$PWD/armcc.conf"
  2179. $_cc --arm_linux_configure \
  2180. --arm_linux_config_file="$armcc_conf" \
  2181. --configure_sysroot="$sysroot" \
  2182. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2183. die "Error creating armcc configuration file."
  2184. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2185. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2186. as_default="${cross_prefix}gcc"
  2187. _depflags='-MMD'
  2188. _cflags_speed='-O3'
  2189. _cflags_size='-Os'
  2190. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2191. _type=tms470
  2192. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2193. _flags='--gcc --abi=eabi -me'
  2194. _cc_e='-ppl -fe=$@'
  2195. _cc_o='-fe=$@'
  2196. _depflags='-ppa -ppd=$(@:.o=.d)'
  2197. _cflags_speed='-O3 -mf=5'
  2198. _cflags_size='-O3 -mf=2'
  2199. _flags_filter=tms470_flags
  2200. elif $_cc -v 2>&1 | grep -q clang; then
  2201. _type=clang
  2202. _ident=$($_cc --version | head -n1)
  2203. _depflags='-MMD'
  2204. _cflags_speed='-O3'
  2205. _cflags_size='-Os'
  2206. elif $_cc -V 2>&1 | grep -q Sun; then
  2207. _type=suncc
  2208. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2209. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2210. _DEPFLAGS='-xM1 -xc99'
  2211. _ldflags='-std=c99'
  2212. _cflags_speed='-O5'
  2213. _cflags_size='-O5 -xspace'
  2214. _flags_filter=suncc_flags
  2215. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2216. _type=pathscale
  2217. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2218. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2219. _cflags_speed='-O2'
  2220. _cflags_size='-Os'
  2221. _flags_filter='filter_out -Wdisabled-optimization'
  2222. elif $_cc -v 2>&1 | grep -q Open64; then
  2223. _type=open64
  2224. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2225. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2226. _cflags_speed='-O2'
  2227. _cflags_size='-Os'
  2228. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2229. elif $_cc -V 2>&1 | grep -q Portland; then
  2230. _type=pgi
  2231. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2232. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2233. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2234. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2235. _cflags_noopt="-O1"
  2236. _flags_filter=pgi_flags
  2237. elif $_cc 2>&1 | grep -q Microsoft; then
  2238. _type=msvc
  2239. _ident=$($cc 2>&1 | head -n1)
  2240. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2241. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2242. _cflags_speed="-O2"
  2243. _cflags_size="-O1"
  2244. # Nonstandard output options, to avoid msys path conversion issues, relies on wrapper to remap it
  2245. if $_cc 2>&1 | grep -q Linker; then
  2246. _ld_o='-out $@'
  2247. else
  2248. _ld_o='-Fe$@'
  2249. fi
  2250. _cc_o='-Fo $@'
  2251. _cc_e='-P -Fi $@'
  2252. _flags_filter=msvc_flags
  2253. _ld_lib='lib%.a'
  2254. _ld_path='-libpath:'
  2255. _flags='-nologo'
  2256. _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2257. if [ $pfx = hostcc ]; then
  2258. append _cflags -Dsnprintf=_snprintf
  2259. fi
  2260. fi
  2261. eval ${pfx}_type=\$_type
  2262. eval ${pfx}_ident=\$_ident
  2263. }
  2264. set_ccvars(){
  2265. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2266. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2267. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2268. if [ -n "$_depflags" ]; then
  2269. eval ${1}_DEPFLAGS=\$_depflags
  2270. else
  2271. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2272. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2273. eval DEP${1}FLAGS=\$_flags
  2274. fi
  2275. }
  2276. probe_cc cc "$cc"
  2277. cflags_filter=$_flags_filter
  2278. cflags_speed=$_cflags_speed
  2279. cflags_size=$_cflags_size
  2280. cflags_noopt=$_cflags_noopt
  2281. add_cflags $_flags $_cflags
  2282. cc_ldflags=$_ldflags
  2283. set_ccvars CC
  2284. probe_cc hostcc "$host_cc"
  2285. host_cflags_filter=$_flags_filter
  2286. add_host_cflags $_flags $_cflags
  2287. set_ccvars HOSTCC
  2288. test -n "$cc_type" && enable $cc_type ||
  2289. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2290. : ${as_default:=$cc}
  2291. : ${dep_cc_default:=$cc}
  2292. : ${ld_default:=$cc}
  2293. : ${host_ld_default:=$host_cc}
  2294. set_default ar as dep_cc ld host_ld
  2295. probe_cc as "$as"
  2296. asflags_filter=$_flags_filter
  2297. add_asflags $_flags $_cflags
  2298. set_ccvars AS
  2299. probe_cc ld "$ld"
  2300. ldflags_filter=$_flags_filter
  2301. add_ldflags $_flags $_ldflags
  2302. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2303. LD_O=${_ld_o-$LD_O}
  2304. LD_LIB=${_ld_lib-$LD_LIB}
  2305. LD_PATH=${_ld_path-$LD_PATH}
  2306. probe_cc hostld "$host_ld"
  2307. host_ldflags_filter=$_flags_filter
  2308. add_host_ldflags $_flags $_ldflags
  2309. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2310. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2311. probe_cc depcc "$dep_cc"
  2312. CCDEP=${_DEPCMD:-$DEPCMD}
  2313. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2314. DEPCCFLAGS=$_flags
  2315. fi
  2316. if $ar 2>&1 | grep -q Microsoft; then
  2317. arflags="-nologo"
  2318. ar_o='-out:$@'
  2319. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2320. arflags="rq"
  2321. ar_o='$@'
  2322. else
  2323. arflags="rc"
  2324. ar_o='$@'
  2325. fi
  2326. add_cflags $extra_cflags
  2327. add_asflags $extra_cflags
  2328. if test -n "$sysroot"; then
  2329. case "$cc_type" in
  2330. gcc|llvm_gcc|clang)
  2331. add_cppflags --sysroot="$sysroot"
  2332. add_ldflags --sysroot="$sysroot"
  2333. ;;
  2334. tms470)
  2335. add_cppflags -I"$sysinclude"
  2336. add_ldflags --sysroot="$sysroot"
  2337. ;;
  2338. esac
  2339. fi
  2340. if test "$cpu" = host; then
  2341. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  2342. case "$cc_type" in
  2343. gcc|llvm_gcc)
  2344. check_native(){
  2345. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2346. sed -n "/cc1.*$1=/{
  2347. s/.*$1=\\([^ ]*\\).*/\\1/
  2348. p
  2349. q
  2350. }" $TMPE
  2351. }
  2352. cpu=$(check_native -march || check_native -mcpu)
  2353. ;;
  2354. esac
  2355. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  2356. fi
  2357. # Deal with common $arch aliases
  2358. case "$arch" in
  2359. aarch64|arm64)
  2360. arch="aarch64"
  2361. ;;
  2362. arm*)
  2363. arch="arm"
  2364. ;;
  2365. mips*|IP*)
  2366. arch="mips"
  2367. ;;
  2368. parisc*|hppa*)
  2369. arch="parisc"
  2370. ;;
  2371. "Power Macintosh"|ppc*|powerpc*)
  2372. arch="ppc"
  2373. ;;
  2374. s390|s390x)
  2375. arch="s390"
  2376. ;;
  2377. sh4|sh)
  2378. arch="sh4"
  2379. ;;
  2380. sun4u|sparc*)
  2381. arch="sparc"
  2382. ;;
  2383. tilegx|tile-gx)
  2384. arch="tilegx"
  2385. ;;
  2386. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  2387. arch="x86"
  2388. ;;
  2389. esac
  2390. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2391. enable $arch
  2392. # Add processor-specific flags
  2393. if enabled aarch64; then
  2394. case $cpu in
  2395. armv*)
  2396. cpuflags="-march=$cpu"
  2397. ;;
  2398. *)
  2399. cpuflags="-mcpu=$cpu"
  2400. ;;
  2401. esac
  2402. elif enabled alpha; then
  2403. cpuflags="-mcpu=$cpu"
  2404. elif enabled arm; then
  2405. check_arm_arch() {
  2406. check_cpp_condition stddef.h \
  2407. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  2408. $cpuflags
  2409. }
  2410. probe_arm_arch() {
  2411. if check_arm_arch 4; then echo armv4;
  2412. elif check_arm_arch 4T; then echo armv4t;
  2413. elif check_arm_arch 5; then echo armv5;
  2414. elif check_arm_arch 5E; then echo armv5e;
  2415. elif check_arm_arch 5T; then echo armv5t;
  2416. elif check_arm_arch 5TE; then echo armv5te;
  2417. elif check_arm_arch 5TEJ; then echo armv5te;
  2418. elif check_arm_arch 6; then echo armv6;
  2419. elif check_arm_arch 6J; then echo armv6j;
  2420. elif check_arm_arch 6K; then echo armv6k;
  2421. elif check_arm_arch 6Z; then echo armv6z;
  2422. elif check_arm_arch 6ZK; then echo armv6zk;
  2423. elif check_arm_arch 6T2; then echo armv6t2;
  2424. elif check_arm_arch 7; then echo armv7;
  2425. elif check_arm_arch 7A 7_A; then echo armv7-a;
  2426. elif check_arm_arch 7R 7_R; then echo armv7-r;
  2427. elif check_arm_arch 7M 7_M; then echo armv7-m;
  2428. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  2429. elif check_arm_arch 8A 8_A; then echo armv8-a;
  2430. fi
  2431. }
  2432. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  2433. case $cpu in
  2434. armv*)
  2435. cpuflags="-march=$cpu"
  2436. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2437. ;;
  2438. *)
  2439. cpuflags="-mcpu=$cpu"
  2440. case $cpu in
  2441. cortex-a*) subarch=armv7a ;;
  2442. cortex-r*) subarch=armv7r ;;
  2443. cortex-m*) enable thumb; subarch=armv7m ;;
  2444. arm11*) subarch=armv6 ;;
  2445. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2446. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2447. *) subarch=$(probe_arm_arch) ;;
  2448. esac
  2449. ;;
  2450. esac
  2451. case "$subarch" in
  2452. armv5t*) enable fast_clz ;;
  2453. armv[6-8]*) enable fast_clz fast_unaligned ;;
  2454. esac
  2455. elif enabled avr32; then
  2456. case $cpu in
  2457. ap7[02]0[0-2])
  2458. subarch="avr32_ap"
  2459. cpuflags="-mpart=$cpu"
  2460. ;;
  2461. ap)
  2462. subarch="avr32_ap"
  2463. cpuflags="-march=$cpu"
  2464. ;;
  2465. uc3[ab]*)
  2466. subarch="avr32_uc"
  2467. cpuflags="-mcpu=$cpu"
  2468. ;;
  2469. uc)
  2470. subarch="avr32_uc"
  2471. cpuflags="-march=$cpu"
  2472. ;;
  2473. esac
  2474. elif enabled bfin; then
  2475. cpuflags="-mcpu=$cpu"
  2476. elif enabled mips; then
  2477. cpuflags="-march=$cpu"
  2478. elif enabled ppc; then
  2479. case $(tolower $cpu) in
  2480. 601|ppc601|powerpc601)
  2481. cpuflags="-mcpu=601"
  2482. disable altivec
  2483. ;;
  2484. 603*|ppc603*|powerpc603*)
  2485. cpuflags="-mcpu=603"
  2486. disable altivec
  2487. ;;
  2488. 604*|ppc604*|powerpc604*)
  2489. cpuflags="-mcpu=604"
  2490. disable altivec
  2491. ;;
  2492. g3|75*|ppc75*|powerpc75*)
  2493. cpuflags="-mcpu=750"
  2494. disable altivec
  2495. ;;
  2496. g4|745*|ppc745*|powerpc745*)
  2497. cpuflags="-mcpu=7450"
  2498. ;;
  2499. 74*|ppc74*|powerpc74*)
  2500. cpuflags="-mcpu=7400"
  2501. ;;
  2502. g5|970|ppc970|powerpc970)
  2503. cpuflags="-mcpu=970"
  2504. ;;
  2505. power[3-7]*)
  2506. cpuflags="-mcpu=$cpu"
  2507. ;;
  2508. cell)
  2509. cpuflags="-mcpu=cell"
  2510. enable ldbrx
  2511. ;;
  2512. e500mc)
  2513. cpuflags="-mcpu=e500mc"
  2514. disable altivec
  2515. ;;
  2516. e500v2)
  2517. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2518. disable altivec
  2519. ;;
  2520. e500)
  2521. cpuflags="-mcpu=8540 -mhard-float"
  2522. disable altivec
  2523. ;;
  2524. esac
  2525. elif enabled sparc; then
  2526. case $cpu in
  2527. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  2528. cpuflags="-mcpu=$cpu"
  2529. disable vis
  2530. ;;
  2531. ultrasparc*|niagara[234])
  2532. cpuflags="-mcpu=$cpu"
  2533. ;;
  2534. esac
  2535. elif enabled x86; then
  2536. case $cpu in
  2537. i[345]86|pentium)
  2538. cpuflags="-march=$cpu"
  2539. disable mmx
  2540. ;;
  2541. # targets that do NOT support conditional mov (cmov)
  2542. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2543. cpuflags="-march=$cpu"
  2544. disable cmov
  2545. ;;
  2546. # targets that do support conditional mov (cmov)
  2547. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|corei7*|amdfam10|barcelona|atom|bdver*)
  2548. cpuflags="-march=$cpu"
  2549. enable cmov
  2550. enable fast_cmov
  2551. ;;
  2552. # targets that do support conditional mov but on which it's slow
  2553. pentium4|pentium4m|prescott|nocona)
  2554. cpuflags="-march=$cpu"
  2555. enable cmov
  2556. disable fast_cmov
  2557. ;;
  2558. esac
  2559. fi
  2560. if [ "$cpu" != generic ]; then
  2561. add_cflags $cpuflags
  2562. add_asflags $cpuflags
  2563. fi
  2564. # compiler sanity check
  2565. check_exec <<EOF
  2566. int main(void){ return 0; }
  2567. EOF
  2568. if test "$?" != 0; then
  2569. echo "$cc is unable to create an executable file."
  2570. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2571. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2572. echo "Only do this if you know what cross compiling means."
  2573. fi
  2574. die "C compiler test failed."
  2575. fi
  2576. add_cppflags -D_ISOC99_SOURCE
  2577. check_cflags -std=c99
  2578. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2579. #include <stdlib.h>
  2580. EOF
  2581. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2582. #include <stdlib.h>
  2583. EOF
  2584. check_host_cflags -std=c99
  2585. check_host_cflags -Wall
  2586. check_64bit(){
  2587. arch32=$1
  2588. arch64=$2
  2589. expr=$3
  2590. check_code cc "" "int test[2*($expr) - 1]" &&
  2591. subarch=$arch64 || subarch=$arch32
  2592. }
  2593. case "$arch" in
  2594. aarch64|alpha|ia64)
  2595. spic=$shared
  2596. ;;
  2597. mips)
  2598. check_64bit mips mips64 '_MIPS_SIM > 1'
  2599. spic=$shared
  2600. ;;
  2601. parisc)
  2602. check_64bit parisc parisc64 'sizeof(void *) > 4'
  2603. spic=$shared
  2604. ;;
  2605. ppc)
  2606. check_64bit ppc ppc64 'sizeof(void *) > 4'
  2607. spic=$shared
  2608. ;;
  2609. sparc)
  2610. check_64bit sparc sparc64 'sizeof(void *) > 4'
  2611. spic=$shared
  2612. ;;
  2613. x86)
  2614. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  2615. if test "$subarch" = "x86_64"; then
  2616. spic=$shared
  2617. fi
  2618. ;;
  2619. esac
  2620. enable $subarch
  2621. enabled spic && enable pic
  2622. # OS specific
  2623. case $target_os in
  2624. haiku)
  2625. prefix_default="/boot/common"
  2626. network_extralibs="-lnetwork"
  2627. host_libs=
  2628. ;;
  2629. sunos)
  2630. AVSERVERLDFLAGS=""
  2631. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2632. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2633. network_extralibs="-lsocket -lnsl"
  2634. add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  2635. # When using suncc to build, the Solaris linker will mark
  2636. # an executable with each instruction set encountered by
  2637. # the Solaris assembler. As our libraries contain their own
  2638. # guards for processor-specific code, instead suppress
  2639. # generation of the HWCAPS ELF section on Solaris x86 only.
  2640. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  2641. nm_default='nm -P -g'
  2642. ;;
  2643. netbsd)
  2644. disable symver
  2645. oss_indev_extralibs="-lossaudio"
  2646. oss_outdev_extralibs="-lossaudio"
  2647. ;;
  2648. openbsd|bitrig)
  2649. disable symver
  2650. SHFLAGS='-shared'
  2651. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  2652. SLIB_INSTALL_LINKS=
  2653. oss_indev_extralibs="-lossaudio"
  2654. oss_outdev_extralibs="-lossaudio"
  2655. ;;
  2656. dragonfly)
  2657. disable symver
  2658. ;;
  2659. freebsd)
  2660. ;;
  2661. bsd/os)
  2662. add_extralibs -lpoll -lgnugetopt
  2663. ;;
  2664. darwin)
  2665. gas="gas-preprocessor.pl $cc"
  2666. enabled ppc && add_asflags -force_cpusubtype_ALL
  2667. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  2668. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  2669. add_ldflags -Wl,-dynamic,-search_paths_first
  2670. SLIBSUF=".dylib"
  2671. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2672. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2673. AVSERVERLDFLAGS=-Wl,-bind_at_load
  2674. objformat="macho"
  2675. enabled x86_64 && objformat="macho64"
  2676. enabled_any pic shared ||
  2677. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2678. ;;
  2679. mingw32*)
  2680. if test $target_os = "mingw32ce"; then
  2681. disable network
  2682. else
  2683. target_os=mingw32
  2684. fi
  2685. LIBTARGET=i386
  2686. if enabled x86_64; then
  2687. LIBTARGET="i386:x86-64"
  2688. elif enabled arm; then
  2689. LIBTARGET=arm-wince
  2690. fi
  2691. shlibdir_default="$bindir_default"
  2692. SLIBPREF=""
  2693. SLIBSUF=".dll"
  2694. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2695. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2696. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  2697. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2698. SLIB_INSTALL_LINKS=
  2699. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2700. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2701. SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
  2702. objformat="win32"
  2703. dlltool="${cross_prefix}dlltool"
  2704. ranlib=:
  2705. enable dos_paths
  2706. ;;
  2707. win32|win64)
  2708. if enabled shared; then
  2709. # Link to the import library instead of the normal static library
  2710. # for shared libs.
  2711. LD_LIB='%.lib'
  2712. # Cannot build shared and static libraries at the same time with
  2713. # MSVC.
  2714. disable static
  2715. fi
  2716. shlibdir_default="$bindir_default"
  2717. SLIBPREF=""
  2718. SLIBSUF=".dll"
  2719. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2720. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2721. SLIB_CREATE_DEF_CMD='makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  2722. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2723. SLIB_INSTALL_LINKS=
  2724. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2725. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2726. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  2727. objformat="win32"
  2728. ranlib=:
  2729. enable dos_paths
  2730. ;;
  2731. cygwin*)
  2732. target_os=cygwin
  2733. shlibdir_default="$bindir_default"
  2734. SLIBPREF="cyg"
  2735. SLIBSUF=".dll"
  2736. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2737. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2738. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2739. SLIB_INSTALL_LINKS=
  2740. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  2741. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  2742. objformat="win32"
  2743. enable dos_paths
  2744. ;;
  2745. *-dos|freedos|opendos)
  2746. network_extralibs="-lsocket"
  2747. objformat="coff"
  2748. enable dos_paths
  2749. add_cppflags -U__STRICT_ANSI__
  2750. ;;
  2751. linux)
  2752. enable dv1394
  2753. ;;
  2754. irix*)
  2755. target_os=irix
  2756. ranlib="echo ignoring ranlib"
  2757. ;;
  2758. os/2*)
  2759. ln_s="cp -f"
  2760. objformat="aout"
  2761. add_cppflags -D_GNU_SOURCE
  2762. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2763. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2764. AVSERVERLDFLAGS=""
  2765. LIBSUF="_s.a"
  2766. SLIBPREF=""
  2767. SLIBSUF=".dll"
  2768. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2769. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2770. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2771. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2772. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2773. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2774. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2775. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2776. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2777. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2778. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  2779. enable dos_paths
  2780. ;;
  2781. gnu/kfreebsd)
  2782. add_cppflags -D_BSD_SOURCE
  2783. ;;
  2784. gnu)
  2785. ;;
  2786. qnx)
  2787. add_cppflags -D_QNX_SOURCE
  2788. network_extralibs="-lsocket"
  2789. ;;
  2790. symbian)
  2791. SLIBSUF=".dll"
  2792. enable dos_paths
  2793. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  2794. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  2795. add_ldflags -Wl,--target1-abs,--no-undefined \
  2796. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  2797. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  2798. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  2799. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  2800. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  2801. ;;
  2802. osf1)
  2803. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  2804. AVSERVERLDFLAGS=
  2805. ;;
  2806. minix)
  2807. ;;
  2808. plan9)
  2809. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  2810. -D_REENTRANT_SOURCE \
  2811. -D_RESEARCH_SOURCE \
  2812. -DFD_SETSIZE=96 \
  2813. -DHAVE_SOCK_OPTS
  2814. add_compat strtod.o strtod=avpriv_strtod
  2815. network_extralibs='-lbsd'
  2816. exeobjs=compat/plan9/main.o
  2817. disable avserver
  2818. cp_f='cp'
  2819. ;;
  2820. none)
  2821. ;;
  2822. *)
  2823. die "Unknown OS '$target_os'."
  2824. ;;
  2825. esac
  2826. # determine libc flavour
  2827. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  2828. if check_cpp_condition features.h "defined __UCLIBC__"; then
  2829. libc_type=uclibc
  2830. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2831. elif check_cpp_condition features.h "defined __GLIBC__"; then
  2832. libc_type=glibc
  2833. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2834. # MinGW headers can be installed on Cygwin, so check for newlib first.
  2835. elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  2836. libc_type=newlib
  2837. add_cppflags -U__STRICT_ANSI__
  2838. elif check_header _mingw.h; then
  2839. libc_type=mingw
  2840. check_cpp_condition _mingw.h \
  2841. "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
  2842. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2843. die "ERROR: MinGW runtime version must be >= 3.15."
  2844. add_cppflags -U__STRICT_ANSI__
  2845. elif check_func_headers stdlib.h _get_doserrno; then
  2846. libc_type=msvcrt
  2847. add_compat strtod.o strtod=avpriv_strtod
  2848. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  2849. _snprintf=avpriv_snprintf \
  2850. vsnprintf=avpriv_vsnprintf
  2851. elif check_cpp_condition stddef.h "defined __KLIBC__"; then
  2852. libc_type=klibc
  2853. fi
  2854. test -n "$libc_type" && enable $libc_type
  2855. # hacks for compiler/libc/os combinations
  2856. if enabled_all tms470 glibc; then
  2857. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  2858. add_cppflags -D__USER_LABEL_PREFIX__=
  2859. add_cppflags -D__builtin_memset=memset
  2860. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  2861. add_cflags -pds=48 # incompatible redefinition of macro
  2862. fi
  2863. if enabled_all ccc glibc; then
  2864. add_ldflags -Wl,-z,now # calls to libots crash without this
  2865. fi
  2866. esc(){
  2867. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  2868. }
  2869. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
  2870. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2871. set_default $PATHS_LIST
  2872. set_default nm
  2873. # we need to build at least one lib type
  2874. if ! enabled_any static shared; then
  2875. cat <<EOF
  2876. At least one library type must be built.
  2877. Specify --enable-static to build the static libraries or --enable-shared to
  2878. build the shared libraries as well. To only build the shared libraries specify
  2879. --disable-static in addition to --enable-shared.
  2880. EOF
  2881. exit 1;
  2882. fi
  2883. die_license_disabled() {
  2884. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2885. }
  2886. die_license_disabled gpl libcdio
  2887. die_license_disabled gpl libx264
  2888. die_license_disabled gpl libxavs
  2889. die_license_disabled gpl libxvid
  2890. die_license_disabled gpl x11grab
  2891. die_license_disabled nonfree libfaac
  2892. die_license_disabled nonfree libfdk_aac
  2893. die_license_disabled nonfree openssl
  2894. die_license_disabled version3 libopencore_amrnb
  2895. die_license_disabled version3 libopencore_amrwb
  2896. die_license_disabled version3 libvo_aacenc
  2897. die_license_disabled version3 libvo_amrwbenc
  2898. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2899. disabled optimizations || check_cflags -fomit-frame-pointer
  2900. enable_pic() {
  2901. enable pic
  2902. add_cppflags -DPIC
  2903. add_cflags -fPIC
  2904. add_asflags -fPIC
  2905. }
  2906. enabled pic && enable_pic
  2907. check_cc <<EOF || die "Symbol mangling check failed."
  2908. int ff_extern;
  2909. EOF
  2910. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2911. extern_prefix=${sym%%ff_extern*}
  2912. check_cc <<EOF && enable_weak inline_asm
  2913. void foo(void) { __asm__ volatile ("" ::); }
  2914. EOF
  2915. _restrict=
  2916. for restrict_keyword in restrict __restrict__ __restrict; do
  2917. check_cc <<EOF && _restrict=$restrict_keyword && break
  2918. void foo(char * $restrict_keyword p);
  2919. EOF
  2920. done
  2921. check_cc <<EOF && enable attribute_packed
  2922. struct { int x; } __attribute__((packed)) x;
  2923. EOF
  2924. check_cc <<EOF && enable attribute_may_alias
  2925. union { int x; } __attribute__((may_alias)) x;
  2926. EOF
  2927. check_cc <<EOF || die "endian test failed"
  2928. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2929. EOF
  2930. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2931. if enabled alpha; then
  2932. check_cflags -mieee
  2933. elif enabled arm; then
  2934. check_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
  2935. enabled thumb && check_cflags -mthumb || check_cflags -marm
  2936. nogas=die
  2937. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2938. enable vfp_args
  2939. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2940. case "${cross_prefix:-$cc}" in
  2941. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2942. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2943. __asm__ (".eabi_attribute 28, 1");
  2944. int main(void) { return 0; }
  2945. EOF
  2946. esac
  2947. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2948. fi
  2949. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  2950. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  2951. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  2952. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  2953. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  2954. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  2955. [ $target_os = linux ] ||
  2956. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  2957. $ARCH_EXT_LIST_ARM
  2958. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  2959. check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  2960. enabled_all armv6t2 shared !pic && enable_pic
  2961. elif enabled mips; then
  2962. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  2963. elif enabled parisc; then
  2964. if enabled gcc; then
  2965. case $($cc -dumpversion) in
  2966. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  2967. esac
  2968. fi
  2969. elif enabled ppc; then
  2970. enable local_aligned_8 local_aligned_16
  2971. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2972. check_inline_asm ibm_asm '"add 0, 0, 0"'
  2973. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  2974. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2975. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2976. if enabled altivec; then
  2977. nogas=warn
  2978. check_cflags -maltivec -mabi=altivec &&
  2979. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2980. check_cflags -faltivec
  2981. # check if our compiler supports Motorola AltiVec C API
  2982. check_cc <<EOF || disable altivec
  2983. $inc_altivec_h
  2984. int main(void) {
  2985. vector signed int v1 = (vector signed int) { 0 };
  2986. vector signed int v2 = (vector signed int) { 1 };
  2987. v1 = vec_add(v1, v2);
  2988. return 0;
  2989. }
  2990. EOF
  2991. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  2992. fi
  2993. elif enabled sparc; then
  2994. enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
  2995. elif enabled x86; then
  2996. check_builtin rdtsc intrin.h "__rdtsc()"
  2997. check_builtin mm_empty mmintrin.h "_mm_empty()"
  2998. enable local_aligned_8 local_aligned_16
  2999. # check whether EBP is available on x86
  3000. # As 'i' is stored on the stack, this program will crash
  3001. # if the base pointer is used to access it because the
  3002. # base pointer is cleared in the inline assembly code.
  3003. check_exec_crash <<EOF && enable ebp_available
  3004. volatile int i=0;
  3005. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3006. return i;
  3007. EOF
  3008. # check whether EBX is available on x86
  3009. check_inline_asm ebx_available '""::"b"(0)' &&
  3010. check_inline_asm ebx_available '"":::"%ebx"'
  3011. # check whether xmm clobbers are supported
  3012. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3013. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3014. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3015. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3016. if ! disabled_any asm mmx yasm; then
  3017. if check_cmd $yasmexe --version; then
  3018. enabled x86_64 && yasm_extra="-m amd64"
  3019. yasm_debug="-g dwarf2"
  3020. elif check_cmd nasm -v; then
  3021. yasmexe=nasm
  3022. yasm_debug="-g -F dwarf"
  3023. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3024. fi
  3025. YASMFLAGS="-f $objformat $yasm_extra"
  3026. enabled pic && append YASMFLAGS "-DPIC"
  3027. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3028. case "$objformat" in
  3029. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3030. esac
  3031. check_yasm "vextractf128 xmm0, ymm0, 0" && enable yasm ||
  3032. die "yasm not found, use --disable-yasm for a crippled build"
  3033. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  3034. check_yasm "CPU amdnop" && enable cpunop
  3035. fi
  3036. case "$cpu" in
  3037. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  3038. disable fast_clz
  3039. ;;
  3040. esac
  3041. fi
  3042. if enabled asm; then
  3043. as=${gas:=$as}
  3044. check_as <<EOF && enable gnu_as || \
  3045. $nogas "GNU assembler not found, install gas-preprocessor"
  3046. .macro m n
  3047. \n: .int 0
  3048. .endm
  3049. m x
  3050. EOF
  3051. fi
  3052. check_ldflags -Wl,--as-needed
  3053. if check_func dlopen; then
  3054. ldl=
  3055. elif check_func dlopen -ldl; then
  3056. ldl=-ldl
  3057. fi
  3058. if ! disabled network; then
  3059. check_type "sys/types.h sys/socket.h" socklen_t
  3060. check_type netdb.h "struct addrinfo"
  3061. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3062. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3063. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3064. check_type netinet/in.h "struct sockaddr_in6"
  3065. check_type poll.h "struct pollfd"
  3066. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3067. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3068. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3069. check_func getaddrinfo $network_extralibs
  3070. check_func getservbyport $network_extralibs
  3071. # Prefer arpa/inet.h over winsock2
  3072. if check_header arpa/inet.h ; then
  3073. check_func closesocket
  3074. elif check_header winsock2.h ; then
  3075. check_func_headers winsock2.h closesocket -lws2 &&
  3076. network_extralibs="-lws2" ||
  3077. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3078. network_extralibs="-lws2_32"; }
  3079. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3080. check_type ws2tcpip.h socklen_t
  3081. check_type ws2tcpip.h "struct addrinfo"
  3082. check_type ws2tcpip.h "struct group_source_req"
  3083. check_type ws2tcpip.h "struct ip_mreq_source"
  3084. check_type ws2tcpip.h "struct ipv6_mreq"
  3085. check_type winsock2.h "struct pollfd"
  3086. check_type ws2tcpip.h "struct sockaddr_in6"
  3087. check_type ws2tcpip.h "struct sockaddr_storage"
  3088. check_struct winsock2.h "struct sockaddr" sa_len
  3089. else
  3090. disable network
  3091. fi
  3092. fi
  3093. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3094. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  3095. check_func fcntl
  3096. check_func fork
  3097. check_func gethrtime
  3098. check_func getopt
  3099. check_func getrusage
  3100. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3101. check_func gettimeofday
  3102. check_func inet_aton $network_extralibs
  3103. check_func isatty
  3104. check_func localtime_r
  3105. check_func ${malloc_prefix}memalign && enable memalign
  3106. check_func mkstemp
  3107. check_func mmap
  3108. check_func mprotect
  3109. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3110. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3111. check_func setrlimit
  3112. check_func strerror_r
  3113. check_func strptime
  3114. check_func strtok_r
  3115. check_func sched_getaffinity
  3116. check_func sysconf
  3117. check_func sysctl
  3118. check_func usleep
  3119. check_func_headers io.h setmode
  3120. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3121. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3122. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3123. check_func_headers windows.h GetProcessAffinityMask
  3124. check_func_headers windows.h GetProcessTimes
  3125. check_func_headers windows.h GetSystemTimeAsFileTime
  3126. check_func_headers windows.h MapViewOfFile
  3127. check_func_headers windows.h SetConsoleTextAttribute
  3128. check_func_headers windows.h Sleep
  3129. check_func_headers windows.h VirtualAlloc
  3130. check_header direct.h
  3131. check_header dlfcn.h
  3132. check_header dxva.h
  3133. check_header dxva2api.h
  3134. check_header io.h
  3135. check_header malloc.h
  3136. check_header poll.h
  3137. check_header sys/mman.h
  3138. check_header sys/param.h
  3139. check_header sys/resource.h
  3140. check_header sys/select.h
  3141. check_header sys/time.h
  3142. check_header unistd.h
  3143. check_header vdpau/vdpau.h
  3144. check_header vdpau/vdpau_x11.h
  3145. check_header VideoDecodeAcceleration/VDADecoder.h
  3146. check_header windows.h
  3147. check_header X11/extensions/XvMClib.h
  3148. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3149. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3150. if ! disabled w32threads && ! enabled pthreads; then
  3151. check_func_headers "windows.h process.h" _beginthreadex && enable w32threads
  3152. fi
  3153. # check for some common methods of building with pthread support
  3154. # do this before the optional library checks as some of them require pthreads
  3155. if ! disabled pthreads && ! enabled w32threads; then
  3156. enable pthreads
  3157. if check_func pthread_create; then
  3158. :
  3159. elif check_func pthread_create -pthread; then
  3160. add_cflags -pthread
  3161. add_extralibs -pthread
  3162. elif check_func pthread_create -pthreads; then
  3163. add_cflags -pthreads
  3164. add_extralibs -pthreads
  3165. elif check_func pthread_create -lpthreadGC2; then
  3166. add_extralibs -lpthreadGC2
  3167. elif ! check_lib pthread.h pthread_create -lpthread; then
  3168. disable pthreads
  3169. fi
  3170. fi
  3171. for thread in $THREADS_LIST; do
  3172. if enabled $thread; then
  3173. test -n "$thread_type" &&
  3174. die "ERROR: Only one thread type must be selected." ||
  3175. thread_type="$thread"
  3176. fi
  3177. done
  3178. check_lib math.h sin -lm && LIBM="-lm"
  3179. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  3180. atan2f_args=2
  3181. ldexpf_args=2
  3182. powf_args=2
  3183. for func in $MATH_FUNCS; do
  3184. eval check_mathfunc $func \${${func}_args:-1}
  3185. done
  3186. # these are off by default, so fail if requested and not available
  3187. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  3188. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3189. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3190. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  3191. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  3192. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  3193. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  3194. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  3195. done || die "ERROR: libgsm not found"; }
  3196. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  3197. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  3198. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  3199. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  3200. enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
  3201. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  3202. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  3203. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  3204. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  3205. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  3206. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  3207. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  3208. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  3209. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  3210. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  3211. enabled libvpx && {
  3212. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  3213. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  3214. enabled libvpx_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
  3215. die "ERROR: libvpx encoder version must be >=0.9.6"; }
  3216. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  3217. enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } }
  3218. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  3219. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  3220. die "ERROR: libx264 version must be >= 0.118."; }
  3221. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  3222. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  3223. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  3224. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  3225. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  3226. die "ERROR: openssl not found"; }
  3227. if enabled gnutls; then
  3228. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  3229. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  3230. fi
  3231. # libdc1394 check
  3232. if enabled libdc1394; then
  3233. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  3234. enable libdc1394_2; } ||
  3235. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  3236. enable libdc1394_1; } ||
  3237. die "ERROR: No version of libdc1394 found "
  3238. fi
  3239. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3240. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3241. enable sdl &&
  3242. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  3243. fi
  3244. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  3245. check_header linux/fb.h
  3246. check_header linux/videodev2.h
  3247. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  3248. check_header sys/videoio.h
  3249. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  3250. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  3251. # w32api 3.12 had it defined wrong
  3252. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  3253. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  3254. { check_header dev/bktr/ioctl_meteor.h &&
  3255. check_header dev/bktr/ioctl_bt848.h; } ||
  3256. { check_header machine/ioctl_meteor.h &&
  3257. check_header machine/ioctl_bt848.h; } ||
  3258. { check_header dev/video/meteor/ioctl_meteor.h &&
  3259. check_header dev/video/bktr/ioctl_bt848.h; } ||
  3260. check_header dev/ic/bt8xx.h
  3261. check_header sndio.h
  3262. check_header sys/soundcard.h
  3263. check_header soundcard.h
  3264. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  3265. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack &&
  3266. check_func jack_port_get_latency_range -ljack
  3267. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  3268. if enabled libcdio; then
  3269. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio
  3270. fi
  3271. enabled x11grab &&
  3272. require X11 X11/Xlib.h XOpenDisplay -lX11 &&
  3273. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  3274. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  3275. enabled vdpau &&
  3276. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  3277. disable vdpau
  3278. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  3279. # add some useful compiler flags if supported
  3280. check_cflags -Wdeclaration-after-statement
  3281. check_cflags -Wall
  3282. check_cflags -Wno-parentheses
  3283. check_cflags -Wno-switch
  3284. check_cflags -Wno-format-zero-length
  3285. check_cflags -Wdisabled-optimization
  3286. check_cflags -Wpointer-arith
  3287. check_cflags -Wredundant-decls
  3288. check_cflags -Wno-pointer-sign
  3289. check_cflags -Wcast-qual
  3290. check_cflags -Wwrite-strings
  3291. check_cflags -Wtype-limits
  3292. check_cflags -Wundef
  3293. check_cflags -Wmissing-prototypes
  3294. check_cflags -Wstrict-prototypes
  3295. enabled extra_warnings && check_cflags -Winline
  3296. # add some linker flags
  3297. check_ldflags -Wl,--warn-common
  3298. check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  3299. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  3300. enabled xmm_clobber_test &&
  3301. check_ldflags -Wl,--wrap,avcodec_open2 \
  3302. -Wl,--wrap,avcodec_decode_audio4 \
  3303. -Wl,--wrap,avcodec_decode_video2 \
  3304. -Wl,--wrap,avcodec_decode_subtitle2 \
  3305. -Wl,--wrap,avcodec_encode_audio2 \
  3306. -Wl,--wrap,avcodec_encode_video \
  3307. -Wl,--wrap,avcodec_encode_subtitle \
  3308. -Wl,--wrap,sws_scale ||
  3309. disable xmm_clobber_test
  3310. echo "X{};" > $TMPV
  3311. if test_ldflags -Wl,--version-script,$TMPV; then
  3312. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  3313. check_cc <<EOF && enable symver_asm_label
  3314. void ff_foo(void) __asm__ ("av_foo@VERSION");
  3315. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  3316. EOF
  3317. check_cc <<EOF && enable symver_gnu_asm
  3318. __asm__(".symver ff_foo,av_foo@VERSION");
  3319. void ff_foo(void) {}
  3320. EOF
  3321. fi
  3322. if [ -z "$optflags" ]; then
  3323. if enabled small; then
  3324. optflags=$cflags_size
  3325. elif enabled optimizations; then
  3326. optflags=$cflags_speed
  3327. else
  3328. optflags=$cflags_noopt
  3329. fi
  3330. fi
  3331. check_optflags(){
  3332. check_cflags "$@"
  3333. enabled lto && check_ldflags "$@"
  3334. }
  3335. if enabled lto; then
  3336. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  3337. check_cflags -flto
  3338. check_ldflags -flto $cpuflags
  3339. fi
  3340. check_optflags $optflags
  3341. check_optflags -fno-math-errno
  3342. check_optflags -fno-signed-zeros
  3343. if enabled icc; then
  3344. # Just warnings, no remarks
  3345. check_cflags -w1
  3346. # -wd: Disable following warnings
  3347. # 144, 167, 556: -Wno-pointer-sign
  3348. # 1292: attribute "foo" ignored
  3349. # 1419: external declaration in primary source file
  3350. # 10006: ignoring unknown option -fno-signed-zeros
  3351. # 10148: ignoring unknown option -Wno-parentheses
  3352. # 10156: ignoring option '-W'; no argument required
  3353. check_cflags -wd144,167,556,1292,1419,10006,10148,10156
  3354. # 11030: Warning unknown option --as-needed
  3355. # 10156: ignoring option '-export'; no argument required
  3356. check_ldflags -wd10156,11030
  3357. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  3358. enable ebp_available
  3359. if enabled x86_32; then
  3360. icc_version=$($cc -dumpversion)
  3361. test ${icc_version%%.*} -ge 11 &&
  3362. check_cflags -falign-stack=maintain-16-byte ||
  3363. disable aligned_stack
  3364. fi
  3365. elif enabled ccc; then
  3366. # disable some annoying warnings
  3367. add_cflags -msg_disable bitnotint
  3368. add_cflags -msg_disable mixfuncvoid
  3369. add_cflags -msg_disable nonstandcast
  3370. add_cflags -msg_disable unsupieee
  3371. elif enabled gcc; then
  3372. check_optflags -fno-tree-vectorize
  3373. check_cflags -Werror=implicit-function-declaration
  3374. check_cflags -Werror=missing-prototypes
  3375. check_cflags -Werror=return-type
  3376. check_cflags -Werror=declaration-after-statement
  3377. check_cflags -Werror=vla
  3378. elif enabled llvm_gcc; then
  3379. check_cflags -mllvm -stack-alignment=16
  3380. elif enabled clang; then
  3381. check_cflags -mllvm -stack-alignment=16
  3382. check_cflags -Qunused-arguments
  3383. check_cflags -Werror=implicit-function-declaration
  3384. check_cflags -Werror=missing-prototypes
  3385. check_cflags -Werror=return-type
  3386. elif enabled armcc; then
  3387. # 2523: use of inline assembler is deprecated
  3388. add_cflags -W${armcc_opt},--diag_suppress=2523
  3389. add_cflags -W${armcc_opt},--diag_suppress=1207
  3390. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  3391. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  3392. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  3393. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  3394. elif enabled tms470; then
  3395. add_cflags -pds=824 -pds=837
  3396. elif enabled pathscale; then
  3397. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  3398. elif enabled msvc; then
  3399. enabled x86_32 && disable aligned_stack
  3400. fi
  3401. case $target_os in
  3402. osf1)
  3403. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  3404. ;;
  3405. plan9)
  3406. add_cppflags -Dmain=plan9_main
  3407. ;;
  3408. esac
  3409. enabled_any $THREADS_LIST && enable threads
  3410. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  3411. check_deps $CONFIG_LIST \
  3412. $CONFIG_EXTRA \
  3413. $HAVE_LIST \
  3414. $ALL_COMPONENTS \
  3415. ! enabled_any memalign posix_memalign aligned_malloc &&
  3416. enabled_any $need_memalign && enable memalign_hack
  3417. echo "install prefix $prefix"
  3418. echo "source path $source_path"
  3419. echo "C compiler $cc"
  3420. echo "ARCH $arch ($cpu)"
  3421. if test "$build_suffix" != ""; then
  3422. echo "build suffix $build_suffix"
  3423. fi
  3424. if test "$extra_version" != ""; then
  3425. echo "version string suffix $extra_version"
  3426. fi
  3427. echo "big-endian ${bigendian-no}"
  3428. echo "runtime cpu detection ${runtime_cpudetect-no}"
  3429. if enabled x86; then
  3430. echo "${yasmexe} ${yasm-no}"
  3431. echo "MMX enabled ${mmx-no}"
  3432. echo "MMXEXT enabled ${mmxext-no}"
  3433. echo "3DNow! enabled ${amd3dnow-no}"
  3434. echo "3DNow! extended enabled ${amd3dnowext-no}"
  3435. echo "SSE enabled ${sse-no}"
  3436. echo "SSSE3 enabled ${ssse3-no}"
  3437. echo "AVX enabled ${avx-no}"
  3438. echo "FMA4 enabled ${fma4-no}"
  3439. echo "CMOV enabled ${cmov-no}"
  3440. echo "CMOV is fast ${fast_cmov-no}"
  3441. echo "EBX available ${ebx_available-no}"
  3442. echo "EBP available ${ebp_available-no}"
  3443. fi
  3444. if enabled arm; then
  3445. echo "ARMv5TE enabled ${armv5te-no}"
  3446. echo "ARMv6 enabled ${armv6-no}"
  3447. echo "ARMv6T2 enabled ${armv6t2-no}"
  3448. echo "VFP enabled ${vfp-no}"
  3449. echo "NEON enabled ${neon-no}"
  3450. fi
  3451. if enabled ppc; then
  3452. echo "AltiVec enabled ${altivec-no}"
  3453. echo "PPC 4xx optimizations ${ppc4xx-no}"
  3454. echo "dcbzl available ${dcbzl-no}"
  3455. fi
  3456. if enabled sparc; then
  3457. echo "VIS enabled ${vis-no}"
  3458. fi
  3459. echo "debug symbols ${debug-no}"
  3460. echo "optimize for size ${small-no}"
  3461. echo "optimizations ${optimizations-no}"
  3462. echo "static ${static-no}"
  3463. echo "shared ${shared-no}"
  3464. echo "new filter support ${avfilter-no}"
  3465. echo "network support ${network-no}"
  3466. echo "threading support ${thread_type-no}"
  3467. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  3468. echo "SDL support ${sdl-no}"
  3469. test -n "$random_seed" &&
  3470. echo "random seed ${random_seed}"
  3471. echo
  3472. echo "External libraries:"
  3473. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  3474. echo
  3475. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  3476. echo "Enabled ${type}s:"
  3477. eval list=\$$(toupper $type)_LIST
  3478. print_enabled '_*' $list | print_3_columns
  3479. echo
  3480. done
  3481. license="LGPL version 2.1 or later"
  3482. if enabled nonfree; then
  3483. license="nonfree and unredistributable"
  3484. elif enabled gplv3; then
  3485. license="GPL version 3 or later"
  3486. elif enabled lgplv3; then
  3487. license="LGPL version 3 or later"
  3488. elif enabled gpl; then
  3489. license="GPL version 2 or later"
  3490. fi
  3491. echo "License: $license"
  3492. echo "Creating config.mak and config.h..."
  3493. test -e Makefile || $ln_s "$source_path/Makefile" .
  3494. config_files="$TMPH config.mak"
  3495. cat > config.mak <<EOF
  3496. # Automatically generated by configure - do not modify!
  3497. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  3498. prefix=$prefix
  3499. LIBDIR=\$(DESTDIR)$libdir
  3500. SHLIBDIR=\$(DESTDIR)$shlibdir
  3501. INCDIR=\$(DESTDIR)$incdir
  3502. BINDIR=\$(DESTDIR)$bindir
  3503. DATADIR=\$(DESTDIR)$datadir
  3504. MANDIR=\$(DESTDIR)$mandir
  3505. SRC_PATH=$source_path
  3506. CC_IDENT=$cc_ident
  3507. ARCH=$arch
  3508. CC=$cc
  3509. AS=$as
  3510. LD=$ld
  3511. DEPCC=$dep_cc
  3512. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  3513. DEPAS=$as
  3514. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  3515. YASM=$yasmexe
  3516. DEPYASM=$yasmexe
  3517. AR=$ar
  3518. ARFLAGS=$arflags
  3519. AR_O=$ar_o
  3520. RANLIB=$ranlib
  3521. LN_S=$ln_s
  3522. CPPFLAGS=$CPPFLAGS
  3523. CFLAGS=$CFLAGS
  3524. ASFLAGS=$ASFLAGS
  3525. AS_C=$AS_C
  3526. AS_O=$AS_O
  3527. CC_C=$CC_C
  3528. CC_E=$CC_E
  3529. CC_O=$CC_O
  3530. LD_O=$LD_O
  3531. LD_LIB=$LD_LIB
  3532. LD_PATH=$LD_PATH
  3533. DLLTOOL=$dlltool
  3534. LDFLAGS=$LDFLAGS
  3535. LDFLAGS-avserver=$AVSERVERLDFLAGS
  3536. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  3537. YASMFLAGS=$YASMFLAGS
  3538. BUILDSUF=$build_suffix
  3539. FULLNAME=$FULLNAME
  3540. LIBPREF=$LIBPREF
  3541. LIBSUF=$LIBSUF
  3542. LIBNAME=$LIBNAME
  3543. SLIBPREF=$SLIBPREF
  3544. SLIBSUF=$SLIBSUF
  3545. EXESUF=$EXESUF
  3546. EXTRA_VERSION=$extra_version
  3547. CCDEP=$CCDEP
  3548. CCDEP_FLAGS=$CCDEP_FLAGS
  3549. ASDEP=$ASDEP
  3550. ASDEP_FLAGS=$ASDEP_FLAGS
  3551. CC_DEPFLAGS=$CC_DEPFLAGS
  3552. AS_DEPFLAGS=$AS_DEPFLAGS
  3553. HOSTCC=$host_cc
  3554. HOSTLD=$host_ld
  3555. HOSTCFLAGS=$host_cflags
  3556. HOSTCPPFLAGS=$host_cppflags
  3557. HOSTEXESUF=$HOSTEXESUF
  3558. HOSTLDFLAGS=$host_ldflags
  3559. HOSTLIBS=$host_libs
  3560. DEPHOSTCC=$host_cc
  3561. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  3562. HOSTCCDEP=$HOSTCCDEP
  3563. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  3564. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  3565. HOSTCC_C=$HOSTCC_C
  3566. HOSTCC_O=$HOSTCC_O
  3567. HOSTLD_O=$HOSTLD_O
  3568. TARGET_EXEC=$target_exec
  3569. TARGET_PATH=$target_path
  3570. LIBS-avplay=$sdl_libs
  3571. CFLAGS-avplay=$sdl_cflags
  3572. ZLIB=$($ldflags_filter -lz)
  3573. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  3574. EXTRALIBS=$extralibs
  3575. COMPAT_OBJS=$compat_objs
  3576. EXEOBJS=$exeobjs
  3577. INSTALL=install
  3578. LIBTARGET=${LIBTARGET}
  3579. SLIBNAME=${SLIBNAME}
  3580. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  3581. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  3582. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  3583. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  3584. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  3585. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  3586. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  3587. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  3588. SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
  3589. EOF
  3590. get_version(){
  3591. lcname=lib${1}
  3592. name=$(toupper $lcname)
  3593. file=$source_path/$lcname/version.h
  3594. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  3595. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  3596. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  3597. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  3598. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  3599. }
  3600. map 'get_version $v' $LIBRARY_LIST
  3601. cat > $TMPH <<EOF
  3602. /* Automatically generated by configure - do not modify! */
  3603. #ifndef LIBAV_CONFIG_H
  3604. #define LIBAV_CONFIG_H
  3605. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  3606. #define LIBAV_LICENSE "$(c_escape $license)"
  3607. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  3608. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  3609. #define restrict $_restrict
  3610. #define EXTERN_PREFIX "${extern_prefix}"
  3611. #define EXTERN_ASM ${extern_prefix}
  3612. #define SLIBSUF "$SLIBSUF"
  3613. EOF
  3614. test -n "$malloc_prefix" &&
  3615. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  3616. if enabled yasm; then
  3617. append config_files $TMPASM
  3618. printf '' >$TMPASM
  3619. fi
  3620. print_config ARCH_ "$config_files" $ARCH_LIST
  3621. print_config HAVE_ "$config_files" $HAVE_LIST
  3622. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  3623. $CONFIG_EXTRA \
  3624. $ALL_COMPONENTS \
  3625. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  3626. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3627. cp_if_changed $TMPH config.h
  3628. touch .config
  3629. enabled yasm && cp_if_changed $TMPASM config.asm
  3630. cat > $TMPH <<EOF
  3631. /* Generated by ffconf */
  3632. #ifndef AVUTIL_AVCONFIG_H
  3633. #define AVUTIL_AVCONFIG_H
  3634. EOF
  3635. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3636. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3637. cp_if_changed $TMPH libavutil/avconfig.h
  3638. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3639. # build pkg-config files
  3640. pkgconfig_generate(){
  3641. name=$1
  3642. shortname=${name#lib}${build_suffix}
  3643. comment=$2
  3644. version=$3
  3645. libs=$4
  3646. requires=$5
  3647. enabled ${name#lib} || return 0
  3648. mkdir -p $name
  3649. cat <<EOF > $name/$name.pc
  3650. prefix=$prefix
  3651. exec_prefix=\${prefix}
  3652. libdir=$libdir
  3653. includedir=$incdir
  3654. Name: $name
  3655. Description: $comment
  3656. Version: $version
  3657. Requires: $(enabled shared || echo $requires)
  3658. Requires.private: $(enabled shared && echo $requires)
  3659. Conflicts:
  3660. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3661. Libs.private: $(enabled shared && echo $libs)
  3662. Cflags: -I\${includedir}
  3663. EOF
  3664. cat <<EOF > $name/$name-uninstalled.pc
  3665. prefix=
  3666. exec_prefix=
  3667. libdir=\${pcfiledir}
  3668. includedir=${source_path}
  3669. Name: $name
  3670. Description: $comment
  3671. Version: $version
  3672. Requires: $requires
  3673. Conflicts:
  3674. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3675. Cflags: -I\${includedir}
  3676. EOF
  3677. }
  3678. pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  3679. pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3680. pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3681. pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3682. pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3683. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3684. pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"