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.

5277 lines
163KB

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