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.

4462 lines
134KB

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