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.

4486 lines
135KB

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