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.

4591 lines
136KB

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