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.

4544 lines
134KB

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