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.

4543 lines
134KB

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