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.

4622 lines
136KB

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