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.

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