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.

4516 lines
133KB

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