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.

4682 lines
137KB

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