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.

4461 lines
134KB

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