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.

4575 lines
135KB

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