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.

4571 lines
135KB

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