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.

4509 lines
133KB

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