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.

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