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.

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