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.

5295 lines
164KB

  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. avcodec_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. cpunop
  1304. fma4
  1305. i686
  1306. mmx
  1307. mmxext
  1308. sse
  1309. sse2
  1310. sse3
  1311. sse4
  1312. sse42
  1313. ssse3
  1314. xop
  1315. '
  1316. ARCH_EXT_LIST="
  1317. $ARCH_EXT_LIST_ARM
  1318. $ARCH_EXT_LIST_X86
  1319. altivec
  1320. ppc4xx
  1321. vis
  1322. mipsfpu
  1323. mips32r2
  1324. mipsdspr1
  1325. mipsdspr2
  1326. "
  1327. HAVE_LIST_CMDLINE='
  1328. inline_asm
  1329. symver
  1330. yasm
  1331. '
  1332. HAVE_LIST_PUB='
  1333. bigendian
  1334. fast_unaligned
  1335. incompatible_libav_abi
  1336. incompatible_fork_abi
  1337. '
  1338. MATH_FUNCS="
  1339. atanf
  1340. atan2f
  1341. cbrt
  1342. cbrtf
  1343. cosf
  1344. exp2
  1345. exp2f
  1346. expf
  1347. isinf
  1348. isnan
  1349. ldexpf
  1350. llrint
  1351. llrintf
  1352. log2
  1353. log2f
  1354. log10f
  1355. lrint
  1356. lrintf
  1357. powf
  1358. rint
  1359. round
  1360. roundf
  1361. sinf
  1362. trunc
  1363. truncf
  1364. "
  1365. HAVE_LIST="
  1366. $ARCH_EXT_LIST
  1367. $(add_suffix _external $ARCH_EXT_LIST)
  1368. $(add_suffix _inline $ARCH_EXT_LIST)
  1369. $HAVE_LIST_CMDLINE
  1370. $HAVE_LIST_PUB
  1371. $THREADS_LIST
  1372. $ATOMICS_LIST
  1373. $MATH_FUNCS
  1374. access
  1375. aligned_malloc
  1376. aligned_stack
  1377. alsa_asoundlib_h
  1378. altivec_h
  1379. arpa_inet_h
  1380. asm_mod_q
  1381. asm_mod_y
  1382. asm_types_h
  1383. atomic_cas_ptr
  1384. atomics_native
  1385. attribute_may_alias
  1386. attribute_packed
  1387. cdio_paranoia_h
  1388. cdio_paranoia_paranoia_h
  1389. CL_cl_h
  1390. clock_gettime
  1391. closesocket
  1392. CommandLineToArgvW
  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. w32threads_deps="atomics_native"
  1683. threads_if_any="$THREADS_LIST"
  1684. # subsystems
  1685. dct_select="rdft"
  1686. error_resilience_select="dsputil"
  1687. frame_thread_encoder_deps="encoders threads"
  1688. lpc_select="dsputil"
  1689. mdct_select="fft"
  1690. rdft_select="fft"
  1691. mpegaudio_select="mpegaudiodsp"
  1692. mpegaudiodsp_select="dct"
  1693. mpegvideo_select="dsputil h264chroma hpeldsp videodsp"
  1694. mpegvideoenc_select="mpegvideo"
  1695. # decoders / encoders
  1696. aac_decoder_select="mdct sinewin"
  1697. aac_encoder_select="audio_frame_queue mdct sinewin"
  1698. aac_latm_decoder_select="aac_decoder aac_latm_parser"
  1699. ac3_decoder_select="mdct ac3dsp ac3_parser dsputil"
  1700. ac3_encoder_select="mdct ac3dsp dsputil"
  1701. ac3_fixed_encoder_select="mdct ac3dsp dsputil"
  1702. aic_decoder_select="dsputil golomb"
  1703. alac_encoder_select="lpc"
  1704. als_decoder_select="dsputil"
  1705. amrnb_decoder_select="lsp"
  1706. amrwb_decoder_select="lsp"
  1707. amv_decoder_select="dsputil hpeldsp exif"
  1708. amv_encoder_select="aandcttables"
  1709. ape_decoder_select="dsputil"
  1710. asv1_decoder_select="dsputil"
  1711. asv1_encoder_select="dsputil"
  1712. asv2_decoder_select="dsputil"
  1713. asv2_encoder_select="dsputil"
  1714. atrac1_decoder_select="mdct sinewin"
  1715. atrac3_decoder_select="mdct"
  1716. atrac3p_decoder_select="mdct sinewin"
  1717. avrn_decoder_select="exif"
  1718. bink_decoder_select="dsputil hpeldsp"
  1719. binkaudio_dct_decoder_select="mdct rdft dct sinewin"
  1720. binkaudio_rdft_decoder_select="mdct rdft sinewin"
  1721. cavs_decoder_select="dsputil golomb h264chroma videodsp"
  1722. cllc_decoder_select="dsputil"
  1723. comfortnoise_encoder_select="lpc"
  1724. cook_decoder_select="dsputil mdct sinewin"
  1725. cscd_decoder_select="lzo"
  1726. cscd_decoder_suggest="zlib"
  1727. dca_decoder_select="mdct"
  1728. dirac_decoder_select="dsputil dwt golomb videodsp"
  1729. dnxhd_decoder_select="dsputil"
  1730. dnxhd_encoder_select="aandcttables dsputil mpegvideoenc"
  1731. dvvideo_decoder_select="dsputil"
  1732. dvvideo_encoder_select="dsputil"
  1733. dxa_decoder_select="zlib"
  1734. eac3_decoder_select="ac3_decoder"
  1735. eac3_encoder_select="ac3_encoder"
  1736. eamad_decoder_select="aandcttables dsputil mpegvideo"
  1737. eatgq_decoder_select="aandcttables"
  1738. eatqi_decoder_select="aandcttables error_resilience mpegvideo"
  1739. exr_decoder_select="zlib"
  1740. ffv1_decoder_select="dsputil golomb rangecoder"
  1741. ffv1_encoder_select="dsputil rangecoder"
  1742. ffvhuff_decoder_select="dsputil llviddsp"
  1743. ffvhuff_encoder_select="dsputil huffman llviddsp"
  1744. fic_decoder_select="dsputil golomb"
  1745. flac_decoder_select="golomb"
  1746. flac_encoder_select="dsputil golomb lpc"
  1747. flashsv_decoder_select="zlib"
  1748. flashsv_encoder_select="zlib"
  1749. flashsv2_encoder_select="zlib"
  1750. flashsv2_decoder_select="zlib"
  1751. flv_decoder_select="h263_decoder"
  1752. flv_encoder_select="h263_encoder"
  1753. fourxm_decoder_select="dsputil"
  1754. fraps_decoder_select="dsputil huffman"
  1755. g2m_decoder_select="dsputil zlib"
  1756. g729_decoder_select="dsputil"
  1757. h261_decoder_select="error_resilience mpegvideo"
  1758. h261_encoder_select="aandcttables mpegvideoenc"
  1759. h263_decoder_select="error_resilience h263_parser h263dsp mpegvideo"
  1760. h263_encoder_select="aandcttables h263dsp mpegvideoenc"
  1761. h263i_decoder_select="h263_decoder"
  1762. h263p_encoder_select="h263_encoder"
  1763. h264_decoder_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
  1764. h264_decoder_suggest="error_resilience"
  1765. hevc_decoder_select="dsputil golomb videodsp"
  1766. huffyuv_decoder_select="dsputil llviddsp"
  1767. huffyuv_encoder_select="dsputil huffman llviddsp"
  1768. iac_decoder_select="dsputil fft mdct sinewin"
  1769. imc_decoder_select="dsputil fft mdct sinewin"
  1770. indeo3_decoder_select="hpeldsp"
  1771. interplay_video_decoder_select="hpeldsp"
  1772. jpegls_decoder_select="dsputil golomb hpeldsp exif"
  1773. jpegls_encoder_select="golomb"
  1774. jv_decoder_select="dsputil"
  1775. lagarith_decoder_select="dsputil"
  1776. ljpeg_encoder_select="aandcttables mpegvideoenc"
  1777. loco_decoder_select="golomb"
  1778. mdec_decoder_select="dsputil error_resilience mpegvideo"
  1779. metasound_decoder_select="lsp mdct sinewin"
  1780. mimic_decoder_select="dsputil hpeldsp"
  1781. mjpeg_decoder_select="dsputil hpeldsp exif"
  1782. mjpegb_decoder_select="dsputil hpeldsp exif"
  1783. mjpeg_encoder_select="aandcttables dsputil mpegvideoenc"
  1784. mlp_decoder_select="dsputil mlp_parser"
  1785. motionpixels_decoder_select="dsputil"
  1786. mp1_decoder_select="mpegaudio"
  1787. mp1float_decoder_select="mpegaudio"
  1788. mp2_decoder_select="mpegaudio"
  1789. mp2float_decoder_select="mpegaudio"
  1790. mp3_decoder_select="mpegaudio"
  1791. mp3adu_decoder_select="mpegaudio"
  1792. mp3adufloat_decoder_select="mpegaudio"
  1793. mp3float_decoder_select="mpegaudio"
  1794. mp3on4_decoder_select="mpegaudio"
  1795. mp3on4float_decoder_select="mpegaudio"
  1796. mpc7_decoder_select="dsputil mpegaudiodsp"
  1797. mpc8_decoder_select="dsputil mpegaudiodsp"
  1798. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1799. mpeg_xvmc_decoder_select="mpeg2video_decoder"
  1800. mpeg1video_decoder_select="error_resilience mpegvideo"
  1801. mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp"
  1802. mpeg2video_decoder_select="error_resilience mpegvideo"
  1803. mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp"
  1804. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1805. mpeg4_encoder_select="h263_encoder"
  1806. msmpeg4v1_decoder_select="h263_decoder"
  1807. msmpeg4v2_decoder_select="h263_decoder"
  1808. msmpeg4v2_encoder_select="h263_encoder"
  1809. msmpeg4v3_decoder_select="h263_decoder"
  1810. msmpeg4v3_encoder_select="h263_encoder"
  1811. mss2_decoder_select="error_resilience vc1_decoder"
  1812. mxpeg_decoder_select="dsputil hpeldsp exif"
  1813. nellymoser_decoder_select="mdct sinewin"
  1814. nellymoser_encoder_select="audio_frame_queue mdct sinewin"
  1815. nuv_decoder_select="dsputil lzo"
  1816. png_decoder_select="zlib"
  1817. png_encoder_select="dsputil zlib"
  1818. prores_decoder_select="dsputil"
  1819. prores_encoder_select="dsputil"
  1820. qcelp_decoder_select="lsp"
  1821. qdm2_decoder_select="mdct rdft mpegaudiodsp"
  1822. ra_144_encoder_select="audio_frame_queue lpc"
  1823. ralf_decoder_select="golomb"
  1824. rtjpeg_decoder_select="dsputil"
  1825. rv10_decoder_select="error_resilience h263_decoder h263dsp"
  1826. rv10_encoder_select="h263_encoder"
  1827. rv20_decoder_select="error_resilience h263_decoder h263dsp"
  1828. rv20_encoder_select="h263_encoder"
  1829. rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
  1830. rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
  1831. shorten_decoder_select="golomb"
  1832. sipr_decoder_select="lsp"
  1833. snow_decoder_select="dsputil dwt h264qpel hpeldsp rangecoder"
  1834. snow_encoder_select="aandcttables dsputil dwt h264qpel hpeldsp mpegvideoenc rangecoder"
  1835. sonic_decoder_select="golomb rangecoder"
  1836. sonic_encoder_select="golomb rangecoder"
  1837. sonic_ls_encoder_select="golomb"
  1838. sp5x_decoder_select="dsputil hpeldsp exif"
  1839. svq1_decoder_select="hpeldsp"
  1840. svq1_encoder_select="aandcttables dsputil hpeldsp mpegvideoenc"
  1841. svq3_decoder_select="golomb h264chroma h264dsp h264pred h264qpel hpeldsp mpegvideo videodsp"
  1842. svq3_decoder_suggest="error_resilience zlib"
  1843. tak_decoder_select="dsputil"
  1844. theora_decoder_select="vp3_decoder"
  1845. tiff_decoder_suggest="zlib"
  1846. tiff_encoder_suggest="zlib"
  1847. thp_decoder_select="dsputil hpeldsp exif"
  1848. truehd_decoder_select="mlp_parser"
  1849. truemotion2_decoder_select="dsputil"
  1850. truespeech_decoder_select="dsputil"
  1851. tscc_decoder_select="zlib"
  1852. twinvq_decoder_select="mdct lsp sinewin"
  1853. utvideo_decoder_select="dsputil"
  1854. utvideo_encoder_select="dsputil huffman"
  1855. vble_decoder_select="dsputil"
  1856. vc1_decoder_select="error_resilience h263_decoder h264chroma h264qpel intrax8"
  1857. vc1image_decoder_select="vc1_decoder"
  1858. vorbis_decoder_select="mdct"
  1859. vorbis_encoder_select="mdct"
  1860. vp3_decoder_select="hpeldsp vp3dsp videodsp"
  1861. vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp"
  1862. vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
  1863. vp6a_decoder_select="vp6_decoder"
  1864. vp6f_decoder_select="vp6_decoder"
  1865. vp8_decoder_select="h264pred videodsp"
  1866. vp9_decoder_select="videodsp"
  1867. webp_decoder_select="vp8_decoder"
  1868. wmapro_decoder_select="mdct sinewin"
  1869. wmav1_decoder_select="mdct sinewin"
  1870. wmav1_encoder_select="mdct sinewin"
  1871. wmav2_decoder_select="mdct sinewin"
  1872. wmav2_encoder_select="mdct sinewin"
  1873. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1874. wmv1_decoder_select="h263_decoder"
  1875. wmv1_encoder_select="h263_encoder"
  1876. wmv2_decoder_select="h263_decoder intrax8 videodsp"
  1877. wmv2_encoder_select="h263_encoder"
  1878. wmv3_decoder_select="vc1_decoder"
  1879. wmv3image_decoder_select="wmv3_decoder"
  1880. zerocodec_decoder_select="zlib"
  1881. zlib_decoder_select="zlib"
  1882. zlib_encoder_select="zlib"
  1883. zmbv_decoder_select="zlib"
  1884. zmbv_encoder_select="zlib"
  1885. # hardware accelerators
  1886. crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
  1887. dxva2_deps="dxva2api_h"
  1888. vaapi_deps="va_va_h"
  1889. vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
  1890. vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
  1891. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1892. xvmc_deps="X11_extensions_XvMClib_h"
  1893. h263_vaapi_hwaccel_deps="vaapi"
  1894. h263_vaapi_hwaccel_select="h263_decoder"
  1895. h263_vdpau_hwaccel_deps="vdpau"
  1896. h263_vdpau_hwaccel_select="h263_decoder"
  1897. h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
  1898. h264_dxva2_hwaccel_deps="dxva2"
  1899. h264_dxva2_hwaccel_select="h264_decoder"
  1900. h264_vaapi_hwaccel_deps="vaapi"
  1901. h264_vaapi_hwaccel_select="h264_decoder"
  1902. h264_vda_decoder_deps="vda"
  1903. h264_vda_decoder_select="h264_decoder"
  1904. h264_vda_hwaccel_deps="vda"
  1905. h264_vda_hwaccel_select="h264_decoder"
  1906. h264_vdpau_decoder_deps="vdpau"
  1907. h264_vdpau_decoder_select="h264_decoder"
  1908. h264_vdpau_hwaccel_deps="vdpau"
  1909. h264_vdpau_hwaccel_select="h264_decoder"
  1910. mpeg_vdpau_decoder_deps="vdpau"
  1911. mpeg_vdpau_decoder_select="mpeg2video_decoder"
  1912. mpeg_xvmc_hwaccel_deps="xvmc"
  1913. mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
  1914. mpeg1_vdpau_decoder_deps="vdpau"
  1915. mpeg1_vdpau_decoder_select="mpeg1video_decoder"
  1916. mpeg1_vdpau_hwaccel_deps="vdpau"
  1917. mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
  1918. mpeg1_xvmc_hwaccel_deps="xvmc"
  1919. mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
  1920. mpeg2_crystalhd_decoder_select="crystalhd"
  1921. mpeg2_dxva2_hwaccel_deps="dxva2"
  1922. mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
  1923. mpeg2_vaapi_hwaccel_deps="vaapi"
  1924. mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
  1925. mpeg2_vdpau_hwaccel_deps="vdpau"
  1926. mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
  1927. mpeg2_xvmc_hwaccel_deps="xvmc"
  1928. mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
  1929. mpeg4_crystalhd_decoder_select="crystalhd"
  1930. mpeg4_vaapi_hwaccel_deps="vaapi"
  1931. mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
  1932. mpeg4_vdpau_decoder_deps="vdpau"
  1933. mpeg4_vdpau_decoder_select="mpeg4_decoder"
  1934. mpeg4_vdpau_hwaccel_deps="vdpau"
  1935. mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
  1936. msmpeg4_crystalhd_decoder_select="crystalhd"
  1937. vc1_crystalhd_decoder_select="crystalhd"
  1938. vc1_dxva2_hwaccel_deps="dxva2"
  1939. vc1_dxva2_hwaccel_select="vc1_decoder"
  1940. vc1_vaapi_hwaccel_deps="vaapi"
  1941. vc1_vaapi_hwaccel_select="vc1_decoder"
  1942. vc1_vdpau_decoder_deps="vdpau"
  1943. vc1_vdpau_decoder_select="vc1_decoder"
  1944. vc1_vdpau_hwaccel_deps="vdpau"
  1945. vc1_vdpau_hwaccel_select="vc1_decoder"
  1946. wmv3_crystalhd_decoder_select="crystalhd"
  1947. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1948. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1949. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1950. wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
  1951. # parsers
  1952. h264_parser_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
  1953. hevc_parser_select="hevc_decoder"
  1954. mpeg4video_parser_select="error_resilience h263dsp mpegvideo"
  1955. mpegvideo_parser_select="error_resilience mpegvideo"
  1956. vc1_parser_select="mpegvideo"
  1957. # external libraries
  1958. libaacplus_encoder_deps="libaacplus"
  1959. libcelt_decoder_deps="libcelt"
  1960. libfaac_encoder_deps="libfaac"
  1961. libfaac_encoder_select="audio_frame_queue"
  1962. libfdk_aac_decoder_deps="libfdk_aac"
  1963. libfdk_aac_encoder_deps="libfdk_aac"
  1964. libfdk_aac_encoder_select="audio_frame_queue"
  1965. libgme_demuxer_deps="libgme"
  1966. libgsm_decoder_deps="libgsm"
  1967. libgsm_encoder_deps="libgsm"
  1968. libgsm_ms_decoder_deps="libgsm"
  1969. libgsm_ms_encoder_deps="libgsm"
  1970. libilbc_decoder_deps="libilbc"
  1971. libilbc_encoder_deps="libilbc"
  1972. libmodplug_demuxer_deps="libmodplug"
  1973. libmp3lame_encoder_deps="libmp3lame"
  1974. libmp3lame_encoder_select="audio_frame_queue"
  1975. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1976. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1977. libopencore_amrnb_encoder_select="audio_frame_queue"
  1978. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1979. libopenjpeg_decoder_deps="libopenjpeg"
  1980. libopenjpeg_encoder_deps="libopenjpeg"
  1981. libopus_decoder_deps="libopus"
  1982. libopus_encoder_deps="libopus"
  1983. libopus_encoder_select="audio_frame_queue"
  1984. libquvi_demuxer_deps="libquvi"
  1985. libschroedinger_decoder_deps="libschroedinger"
  1986. libschroedinger_encoder_deps="libschroedinger"
  1987. libshine_encoder_deps="libshine"
  1988. libshine_encoder_select="audio_frame_queue"
  1989. libspeex_decoder_deps="libspeex"
  1990. libspeex_encoder_deps="libspeex"
  1991. libspeex_encoder_select="audio_frame_queue"
  1992. libstagefright_h264_decoder_deps="libstagefright_h264"
  1993. libtheora_encoder_deps="libtheora"
  1994. libtwolame_encoder_deps="libtwolame"
  1995. libvo_aacenc_encoder_deps="libvo_aacenc"
  1996. libvo_aacenc_encoder_select="audio_frame_queue"
  1997. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1998. libvorbis_decoder_deps="libvorbis"
  1999. libvorbis_encoder_deps="libvorbis"
  2000. libvorbis_encoder_select="audio_frame_queue"
  2001. libvpx_vp8_decoder_deps="libvpx"
  2002. libvpx_vp8_encoder_deps="libvpx"
  2003. libvpx_vp9_decoder_deps="libvpx"
  2004. libvpx_vp9_encoder_deps="libvpx"
  2005. libwavpack_encoder_deps="libwavpack"
  2006. libwebp_encoder_deps="libwebp"
  2007. libx264_encoder_deps="libx264"
  2008. libx264rgb_encoder_deps="libx264"
  2009. libx265_encoder_deps="libx265"
  2010. libxavs_encoder_deps="libxavs"
  2011. libxvid_encoder_deps="libxvid"
  2012. libutvideo_decoder_deps="libutvideo"
  2013. libutvideo_encoder_deps="libutvideo"
  2014. libzvbi_teletext_decoder_deps="libzvbi"
  2015. # demuxers / muxers
  2016. ac3_demuxer_select="ac3_parser"
  2017. asf_demuxer_select="riffdec"
  2018. asf_muxer_select="riffenc"
  2019. asf_stream_muxer_select="asf_muxer"
  2020. avi_demuxer_select="riffdec"
  2021. avi_muxer_select="riffenc"
  2022. avisynth_demuxer_deps="avisynth"
  2023. avisynth_demuxer_select="riffdec"
  2024. caf_demuxer_select="riffdec"
  2025. dirac_demuxer_select="dirac_parser"
  2026. dts_demuxer_select="dca_parser"
  2027. dtshd_demuxer_select="dca_parser"
  2028. dxa_demuxer_select="riffdec"
  2029. eac3_demuxer_select="ac3_parser"
  2030. f4v_muxer_select="mov_muxer"
  2031. flac_demuxer_select="flac_parser"
  2032. hds_muxer_select="flv_muxer"
  2033. hls_muxer_select="mpegts_muxer"
  2034. ipod_muxer_select="mov_muxer"
  2035. ismv_muxer_select="mov_muxer"
  2036. libnut_demuxer_deps="libnut"
  2037. libnut_muxer_deps="libnut"
  2038. matroska_audio_muxer_select="matroska_muxer"
  2039. matroska_demuxer_select="riffdec"
  2040. matroska_demuxer_suggest="bzlib lzo zlib"
  2041. matroska_muxer_select="riffenc"
  2042. mmf_muxer_select="riffenc"
  2043. mov_demuxer_select="riffdec"
  2044. mov_demuxer_suggest="zlib"
  2045. mov_muxer_select="riffenc rtpenc_chain"
  2046. mp3_demuxer_select="mpegaudio_parser"
  2047. mp4_muxer_select="mov_muxer"
  2048. mpegts_muxer_select="adts_muxer latm_muxer"
  2049. mpegtsraw_demuxer_select="mpegts_demuxer"
  2050. mxf_d10_muxer_select="mxf_muxer"
  2051. nut_muxer_select="riffenc"
  2052. nuv_demuxer_select="riffdec"
  2053. ogg_demuxer_select="golomb"
  2054. psp_muxer_select="mov_muxer"
  2055. rtp_demuxer_select="sdp_demuxer"
  2056. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  2057. rtsp_demuxer_select="http_protocol rtpdec"
  2058. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  2059. sap_demuxer_select="sdp_demuxer"
  2060. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  2061. sdp_demuxer_select="rtpdec"
  2062. smoothstreaming_muxer_select="ismv_muxer"
  2063. spdif_muxer_select="aac_parser"
  2064. tak_demuxer_select="tak_parser"
  2065. tg2_muxer_select="mov_muxer"
  2066. tgp_muxer_select="mov_muxer"
  2067. vobsub_demuxer_select="mpegps_demuxer"
  2068. w64_demuxer_select="wav_demuxer"
  2069. w64_muxer_select="wav_muxer"
  2070. wav_demuxer_select="riffdec"
  2071. wav_muxer_select="riffenc"
  2072. webm_muxer_select="riffenc"
  2073. wtv_demuxer_select="riffdec"
  2074. wtv_muxer_select="riffenc"
  2075. xmv_demuxer_select="riffdec"
  2076. xwma_demuxer_select="riffdec"
  2077. # indevs / outdevs
  2078. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  2079. alsa_outdev_deps="alsa_asoundlib_h"
  2080. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  2081. caca_outdev_deps="libcaca"
  2082. decklink_outdev_deps="decklink pthreads"
  2083. decklink_outdev_extralibs="-lstdc++"
  2084. dshow_indev_deps="IBaseFilter"
  2085. dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid"
  2086. dv1394_indev_deps="dv1394"
  2087. dv1394_indev_select="dv_demuxer"
  2088. fbdev_indev_deps="linux_fb_h"
  2089. fbdev_outdev_deps="linux_fb_h"
  2090. iec61883_indev_deps="libiec61883"
  2091. jack_indev_deps="jack_jack_h sem_timedwait"
  2092. lavfi_indev_deps="avfilter"
  2093. libcdio_indev_deps="libcdio"
  2094. libdc1394_indev_deps="libdc1394"
  2095. libv4l2_indev_deps="libv4l2"
  2096. openal_indev_deps="openal"
  2097. opengl_outdev_deps="opengl"
  2098. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  2099. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  2100. pulse_indev_deps="libpulse"
  2101. pulse_outdev_deps="libpulse"
  2102. sdl_outdev_deps="sdl"
  2103. sndio_indev_deps="sndio_h"
  2104. sndio_outdev_deps="sndio_h"
  2105. v4l_indev_deps="linux_videodev_h"
  2106. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  2107. v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
  2108. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  2109. vfwcap_indev_extralibs="-lavicap32"
  2110. xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
  2111. xv_outdev_extralibs="-lXv -lX11 -lXext"
  2112. x11grab_indev_deps="x11grab"
  2113. # protocols
  2114. bluray_protocol_deps="libbluray"
  2115. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  2116. ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
  2117. ffrtmpcrypt_protocol_select="tcp_protocol"
  2118. ffrtmphttp_protocol_deps="!librtmp_protocol"
  2119. ffrtmphttp_protocol_select="http_protocol"
  2120. ftp_protocol_select="tcp_protocol"
  2121. gopher_protocol_select="network"
  2122. httpproxy_protocol_select="tcp_protocol"
  2123. http_protocol_select="tcp_protocol"
  2124. https_protocol_select="tls_protocol"
  2125. librtmp_protocol_deps="librtmp"
  2126. librtmpe_protocol_deps="librtmp"
  2127. librtmps_protocol_deps="librtmp"
  2128. librtmpt_protocol_deps="librtmp"
  2129. librtmpte_protocol_deps="librtmp"
  2130. libssh_protocol_deps="libssh"
  2131. mmsh_protocol_select="http_protocol"
  2132. mmst_protocol_select="network"
  2133. rtmp_protocol_deps="!librtmp_protocol"
  2134. rtmp_protocol_select="tcp_protocol"
  2135. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  2136. rtmps_protocol_deps="!librtmp_protocol"
  2137. rtmps_protocol_select="tls_protocol"
  2138. rtmpt_protocol_select="ffrtmphttp_protocol"
  2139. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  2140. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  2141. rtp_protocol_select="udp_protocol"
  2142. sctp_protocol_deps="struct_sctp_event_subscribe"
  2143. sctp_protocol_select="network"
  2144. srtp_protocol_select="rtp_protocol"
  2145. tcp_protocol_select="network"
  2146. tls_protocol_deps_any="openssl gnutls"
  2147. tls_protocol_select="tcp_protocol"
  2148. udp_protocol_select="network"
  2149. unix_protocol_deps="sys_un_h"
  2150. unix_protocol_select="network"
  2151. # filters
  2152. aconvert_filter_deps="swresample"
  2153. amovie_filter_deps="avcodec avformat"
  2154. aresample_filter_deps="swresample"
  2155. ass_filter_deps="libass"
  2156. asyncts_filter_deps="avresample"
  2157. atempo_filter_deps="avcodec"
  2158. atempo_filter_select="rdft"
  2159. azmq_filter_deps="libzmq"
  2160. blackframe_filter_deps="gpl"
  2161. boxblur_filter_deps="gpl"
  2162. colormatrix_filter_deps="gpl"
  2163. cropdetect_filter_deps="gpl"
  2164. dctdnoiz_filter_deps="avcodec"
  2165. dctdnoiz_filter_select="dct"
  2166. delogo_filter_deps="gpl"
  2167. deshake_filter_deps="avcodec"
  2168. deshake_filter_select="dsputil"
  2169. drawtext_filter_deps="libfreetype"
  2170. ebur128_filter_deps="gpl"
  2171. flite_filter_deps="libflite"
  2172. frei0r_filter_deps="frei0r dlopen"
  2173. frei0r_filter_extralibs='$ldl'
  2174. frei0r_src_filter_deps="frei0r dlopen"
  2175. frei0r_src_filter_extralibs='$ldl'
  2176. geq_filter_deps="gpl"
  2177. histeq_filter_deps="gpl"
  2178. hqdn3d_filter_deps="gpl"
  2179. interlace_filter_deps="gpl"
  2180. kerndeint_filter_deps="gpl"
  2181. ladspa_filter_deps="ladspa dlopen"
  2182. mcdeint_filter_deps="avcodec gpl"
  2183. movie_filter_deps="avcodec avformat"
  2184. mp_filter_deps="gpl avcodec swscale inline_asm"
  2185. mpdecimate_filter_deps="gpl avcodec"
  2186. mptestsrc_filter_deps="gpl"
  2187. negate_filter_deps="lut_filter"
  2188. perspective_filter_deps="gpl"
  2189. resample_filter_deps="avresample"
  2190. ocv_filter_deps="libopencv"
  2191. owdenoise_filter_deps="gpl"
  2192. pan_filter_deps="swresample"
  2193. phase_filter_deps="gpl"
  2194. pp_filter_deps="gpl postproc"
  2195. pullup_filter_deps="gpl"
  2196. removelogo_filter_deps="avcodec avformat swscale"
  2197. sab_filter_deps="gpl swscale"
  2198. scale_filter_deps="swscale"
  2199. smartblur_filter_deps="gpl swscale"
  2200. showspectrum_filter_deps="avcodec"
  2201. showspectrum_filter_select="rdft"
  2202. spp_filter_deps="gpl avcodec"
  2203. spp_filter_select="fft"
  2204. stereo3d_filter_deps="gpl"
  2205. subtitles_filter_deps="avformat avcodec libass"
  2206. super2xsai_filter_deps="gpl"
  2207. tinterlace_filter_deps="gpl"
  2208. vidstabdetect_filter_deps="libvidstab"
  2209. vidstabtransform_filter_deps="libvidstab"
  2210. pixfmts_super2xsai_test_deps="super2xsai_filter"
  2211. tinterlace_merge_test_deps="tinterlace_filter"
  2212. tinterlace_pad_test_deps="tinterlace_filter"
  2213. zmq_filter_deps="libzmq"
  2214. # examples
  2215. avio_reading="avformat avcodec avutil"
  2216. avcodec_example_deps="avcodec avutil"
  2217. demuxing_decoding_example_deps="avcodec avformat avutil"
  2218. filtering_audio_example_deps="avfilter avcodec avformat avutil"
  2219. filtering_video_example_deps="avfilter avcodec avformat avutil"
  2220. metadata_example_deps="avformat avutil"
  2221. muxing_example_deps="avcodec avformat avutil swscale"
  2222. remuxing_example_deps="avcodec avformat avutil"
  2223. resampling_audio_example_deps="avutil swresample"
  2224. scaling_video_example_deps="avutil swscale"
  2225. transcode_aac_example_deps="avcodec avformat swresample"
  2226. # libraries
  2227. avcodec_deps="avutil"
  2228. avdevice_deps="avutil avcodec avformat"
  2229. avfilter_deps="avutil"
  2230. avformat_deps="avutil avcodec"
  2231. avresample_deps="avutil"
  2232. postproc_deps="avutil gpl"
  2233. swscale_deps="avutil"
  2234. # programs
  2235. ffmpeg_deps="avcodec avfilter avformat swresample"
  2236. ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
  2237. null_filter
  2238. setpts_filter trim_filter"
  2239. ffplay_deps="avcodec avformat swscale swresample sdl"
  2240. ffplay_libs='$sdl_libs'
  2241. ffplay_select="rdft crop_filter"
  2242. ffprobe_deps="avcodec avformat"
  2243. ffserver_deps="avformat fork sarestart"
  2244. ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
  2245. # documentation
  2246. podpages_deps="perl"
  2247. manpages_deps="perl pod2man"
  2248. htmlpages_deps="perl texi2html"
  2249. txtpages_deps="perl makeinfo"
  2250. doc_deps_any="manpages htmlpages podpages txtpages"
  2251. # default parameters
  2252. logfile="config.log"
  2253. # installation paths
  2254. prefix_default="/usr/local"
  2255. bindir_default='${prefix}/bin'
  2256. datadir_default='${prefix}/share/ffmpeg'
  2257. docdir_default='${prefix}/share/doc/ffmpeg'
  2258. incdir_default='${prefix}/include'
  2259. libdir_default='${prefix}/lib'
  2260. mandir_default='${prefix}/share/man'
  2261. shlibdir_default="$libdir_default"
  2262. # toolchain
  2263. ar_default="ar"
  2264. cc_default="gcc"
  2265. cxx_default="g++"
  2266. host_cc_default="gcc"
  2267. cp_f="cp -f"
  2268. install="install"
  2269. ln_s="ln -s -f"
  2270. nm_default="nm -g"
  2271. objformat="elf"
  2272. pkg_config_default=pkg-config
  2273. ranlib="ranlib"
  2274. strip_default="strip"
  2275. yasmexe_default="yasm"
  2276. windres_default="windres"
  2277. nogas=":"
  2278. # machine
  2279. arch_default=$(uname -m)
  2280. cpu="generic"
  2281. # OS
  2282. target_os_default=$(tolower $(uname -s))
  2283. host_os=$target_os_default
  2284. # configurable options
  2285. enable $PROGRAM_LIST
  2286. enable $DOCUMENT_LIST
  2287. enable $EXAMPLE_LIST
  2288. enable $(filter_out avresample $LIBRARY_LIST)
  2289. enable stripping
  2290. enable asm
  2291. enable debug
  2292. enable doc
  2293. enable optimizations
  2294. enable runtime_cpudetect
  2295. enable safe_bitstream_reader
  2296. enable static
  2297. enable swscale_alpha
  2298. # Enable hwaccels by default.
  2299. enable dxva2 vaapi vdpau xvmc
  2300. # build settings
  2301. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  2302. LIBPREF="lib"
  2303. LIBSUF=".a"
  2304. FULLNAME='$(NAME)$(BUILDSUF)'
  2305. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  2306. SLIBPREF="lib"
  2307. SLIBSUF=".so"
  2308. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  2309. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  2310. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  2311. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  2312. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  2313. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  2314. asflags_filter=echo
  2315. cflags_filter=echo
  2316. ldflags_filter=echo
  2317. AS_C='-c'
  2318. AS_O='-o $@'
  2319. CC_C='-c'
  2320. CC_E='-E -o $@'
  2321. CC_O='-o $@'
  2322. CXX_C='-c'
  2323. CXX_O='-o $@'
  2324. LD_O='-o $@'
  2325. LD_LIB='-l%'
  2326. LD_PATH='-L'
  2327. HOSTCC_C='-c'
  2328. HOSTCC_E='-E -o $@'
  2329. HOSTCC_O='-o $@'
  2330. HOSTLD_O='-o $@'
  2331. host_libs='-lm'
  2332. host_cflags_filter=echo
  2333. host_ldflags_filter=echo
  2334. target_path='$(CURDIR)'
  2335. # since the object filename is not given with the -MM flag, the compiler
  2336. # is only able to print the basename, and we must add the path ourselves
  2337. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  2338. DEPFLAGS='-MM'
  2339. # find source path
  2340. if test -f configure; then
  2341. source_path=.
  2342. else
  2343. source_path=$(cd $(dirname "$0"); pwd)
  2344. echo "$source_path" | grep -q '[[:blank:]]' &&
  2345. die "Out of tree builds are impossible with whitespace in source path."
  2346. test -e "$source_path/config.h" &&
  2347. die "Out of tree builds are impossible with config.h in source dir."
  2348. fi
  2349. for v in "$@"; do
  2350. r=${v#*=}
  2351. l=${v%"$r"}
  2352. r=$(sh_quote "$r")
  2353. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  2354. done
  2355. find_things(){
  2356. thing=$1
  2357. pattern=$2
  2358. file=$source_path/$3
  2359. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  2360. }
  2361. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  2362. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  2363. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  2364. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  2365. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  2366. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  2367. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  2368. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  2369. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  2370. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  2371. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  2372. ALL_COMPONENTS="
  2373. $BSF_LIST
  2374. $DECODER_LIST
  2375. $DEMUXER_LIST
  2376. $ENCODER_LIST
  2377. $FILTER_LIST
  2378. $HWACCEL_LIST
  2379. $INDEV_LIST
  2380. $MUXER_LIST
  2381. $OUTDEV_LIST
  2382. $PARSER_LIST
  2383. $PROTOCOL_LIST
  2384. "
  2385. for n in $COMPONENT_LIST; do
  2386. v=$(toupper ${n%s})_LIST
  2387. eval enable \$$v
  2388. eval ${n}_if_any="\$$v"
  2389. done
  2390. enable $ARCH_EXT_LIST
  2391. die_unknown(){
  2392. echo "Unknown option \"$1\"."
  2393. echo "See $0 --help for available options."
  2394. exit 1
  2395. }
  2396. print_3_columns() {
  2397. cat | tr ' ' '\n' | sort | pr -r -3 -t
  2398. }
  2399. show_list() {
  2400. suffix=_$1
  2401. shift
  2402. echo $* | sed s/$suffix//g | print_3_columns
  2403. exit 0
  2404. }
  2405. rand_list(){
  2406. IFS=', '
  2407. set -- $*
  2408. unset IFS
  2409. for thing; do
  2410. comp=${thing%:*}
  2411. prob=${thing#$comp}
  2412. prob=${prob#:}
  2413. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  2414. echo "prob ${prob:-0.5}"
  2415. printf '%s\n' $comp
  2416. done
  2417. }
  2418. do_random(){
  2419. action=$1
  2420. shift
  2421. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  2422. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  2423. }
  2424. for opt do
  2425. optval="${opt#*=}"
  2426. case "$opt" in
  2427. --extra-ldflags=*)
  2428. add_ldflags $optval
  2429. ;;
  2430. --extra-libs=*)
  2431. add_extralibs $optval
  2432. ;;
  2433. --disable-devices)
  2434. disable $INDEV_LIST $OUTDEV_LIST
  2435. ;;
  2436. --enable-debug=*)
  2437. debuglevel="$optval"
  2438. ;;
  2439. --disable-programs)
  2440. disable $PROGRAM_LIST
  2441. ;;
  2442. --disable-everything)
  2443. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2444. ;;
  2445. --disable-all)
  2446. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2447. disable $LIBRARY_LIST $PROGRAM_LIST doc
  2448. ;;
  2449. --enable-random|--disable-random)
  2450. action=${opt%%-random}
  2451. do_random ${action#--} $COMPONENT_LIST
  2452. ;;
  2453. --enable-random=*|--disable-random=*)
  2454. action=${opt%%-random=*}
  2455. do_random ${action#--} $optval
  2456. ;;
  2457. --enable-*=*|--disable-*=*)
  2458. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  2459. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  2460. eval list=\$$(toupper $thing)_LIST
  2461. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  2462. list=$(filter "$name" $list)
  2463. [ "$list" = "" ] && warn "Option $opt did not match anything"
  2464. $action $list
  2465. ;;
  2466. --enable-?*|--disable-?*)
  2467. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  2468. if is_in $option $COMPONENT_LIST; then
  2469. test $action = disable && action=unset
  2470. eval $action \$$(toupper ${option%s})_LIST
  2471. elif is_in $option $CMDLINE_SELECT; then
  2472. $action $option
  2473. else
  2474. die_unknown $opt
  2475. fi
  2476. ;;
  2477. --list-*)
  2478. NAME="${opt#--list-}"
  2479. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  2480. NAME=${NAME%s}
  2481. eval show_list $NAME \$$(toupper $NAME)_LIST
  2482. ;;
  2483. --help|-h) show_help
  2484. ;;
  2485. --fatal-warnings) enable fatal_warnings
  2486. ;;
  2487. *)
  2488. optname="${opt%%=*}"
  2489. optname="${optname#--}"
  2490. optname=$(echo "$optname" | sed 's/-/_/g')
  2491. if is_in $optname $CMDLINE_SET; then
  2492. eval $optname='$optval'
  2493. elif is_in $optname $CMDLINE_APPEND; then
  2494. append $optname "$optval"
  2495. else
  2496. die_unknown $opt
  2497. fi
  2498. ;;
  2499. esac
  2500. done
  2501. disabled logging && logfile=/dev/null
  2502. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  2503. set >> $logfile
  2504. test -n "$cross_prefix" && enable cross_compile
  2505. if enabled cross_compile; then
  2506. test -n "$arch" && test -n "$target_os" ||
  2507. die "Must specify target arch and OS when cross-compiling"
  2508. fi
  2509. ar_default="${cross_prefix}${ar_default}"
  2510. cc_default="${cross_prefix}${cc_default}"
  2511. cxx_default="${cross_prefix}${cxx_default}"
  2512. nm_default="${cross_prefix}${nm_default}"
  2513. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2514. ranlib="${cross_prefix}${ranlib}"
  2515. strip_default="${cross_prefix}${strip_default}"
  2516. windres_default="${cross_prefix}${windres_default}"
  2517. sysinclude_default="${sysroot}/usr/include"
  2518. test -n "$valgrind" && toolchain="valgrind-memcheck"
  2519. case "$toolchain" in
  2520. clang-asan)
  2521. cc_default="clang"
  2522. add_cflags -fsanitize=address
  2523. add_ldflags -fsanitize=address
  2524. ;;
  2525. clang-tsan)
  2526. cc_default="clang"
  2527. add_cflags -fsanitize=thread -pie
  2528. add_ldflags -fsanitize=thread -pie
  2529. ;;
  2530. clang-usan)
  2531. cc_default="clang"
  2532. add_cflags -fsanitize=undefined
  2533. add_ldflags -fsanitize=undefined
  2534. ;;
  2535. gcc-asan)
  2536. cc_default="gcc"
  2537. add_cflags -fsanitize=address
  2538. add_ldflags -fsanitize=address
  2539. ;;
  2540. gcc-tsan)
  2541. cc_default="gcc"
  2542. add_cflags -fsanitize=thread -pie -fPIC
  2543. add_ldflags -fsanitize=thread -pie -fPIC
  2544. ;;
  2545. gcc-usan)
  2546. cc_default="gcc"
  2547. add_cflags -fsanitize=undefined
  2548. add_ldflags -fsanitize=undefined
  2549. ;;
  2550. valgrind-massif)
  2551. target_exec_default=${valgrind:-"valgrind"}
  2552. 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"
  2553. ;;
  2554. valgrind-memcheck)
  2555. target_exec_default=${valgrind:-"valgrind"}
  2556. 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"
  2557. ;;
  2558. msvc)
  2559. # Check whether the current MSVC version needs the C99 converter.
  2560. # From MSVC 2013 (compiler major version 18) onwards, it does actually
  2561. # support enough of C99 to build ffmpeg. Default to the new
  2562. # behaviour if the regexp was unable to match anything, since this
  2563. # successfully parses the version number of existing supported
  2564. # versions that require the converter (MSVC 2010 and 2012).
  2565. cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
  2566. if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
  2567. cc_default="cl"
  2568. else
  2569. cc_default="c99wrap cl"
  2570. fi
  2571. ld_default="link"
  2572. nm_default="dumpbin -symbols"
  2573. ar_default="lib"
  2574. target_os_default="win32"
  2575. # Use a relative path for TMPDIR. This makes sure all the
  2576. # ffconf temp files are written with a relative path, avoiding
  2577. # issues with msys/win32 path conversion for MSVC parameters
  2578. # such as -Fo<file> or -out:<file>.
  2579. TMPDIR=.
  2580. ;;
  2581. icl)
  2582. cc_default="icl"
  2583. ld_default="xilink"
  2584. nm_default="dumpbin -symbols"
  2585. ar_default="xilib"
  2586. target_os_default="win32"
  2587. TMPDIR=.
  2588. ;;
  2589. gcov)
  2590. add_cflags -fprofile-arcs -ftest-coverage
  2591. add_ldflags -fprofile-arcs -ftest-coverage
  2592. ;;
  2593. hardened)
  2594. add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all
  2595. add_ldflags -Wl,-z,relro -Wl,-z,now
  2596. ;;
  2597. ?*)
  2598. die "Unknown toolchain $toolchain"
  2599. ;;
  2600. esac
  2601. set_default arch cc cxx pkg_config strip sysinclude target_exec target_os yasmexe
  2602. enabled cross_compile || host_cc_default=$cc
  2603. set_default host_cc
  2604. if ! $pkg_config --version >/dev/null 2>&1; then
  2605. warn "$pkg_config not found, library detection may fail."
  2606. pkg_config=false
  2607. fi
  2608. exesuf() {
  2609. case $1 in
  2610. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2611. esac
  2612. }
  2613. EXESUF=$(exesuf $target_os)
  2614. HOSTEXESUF=$(exesuf $host_os)
  2615. # set temporary file name
  2616. : ${TMPDIR:=$TEMPDIR}
  2617. : ${TMPDIR:=$TMP}
  2618. : ${TMPDIR:=/tmp}
  2619. if [ -n "$tempprefix" ] ; then
  2620. mktemp(){
  2621. echo $tempprefix.${HOSTNAME}.${UID}
  2622. }
  2623. elif ! check_cmd mktemp -u XXXXXX; then
  2624. # simple replacement for missing mktemp
  2625. # NOT SAFE FOR GENERAL USE
  2626. mktemp(){
  2627. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2628. }
  2629. fi
  2630. tmpfile(){
  2631. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2632. (set -C; exec > $tmp) 2>/dev/null ||
  2633. die "Unable to create temporary file in $TMPDIR."
  2634. append TMPFILES $tmp
  2635. eval $1=$tmp
  2636. }
  2637. trap 'rm -f -- $TMPFILES' EXIT
  2638. tmpfile TMPASM .asm
  2639. tmpfile TMPC .c
  2640. tmpfile TMPCPP .cpp
  2641. tmpfile TMPE $EXESUF
  2642. tmpfile TMPH .h
  2643. tmpfile TMPO .o
  2644. tmpfile TMPS .S
  2645. tmpfile TMPSH .sh
  2646. tmpfile TMPV .ver
  2647. unset -f mktemp
  2648. chmod +x $TMPE
  2649. # make sure we can execute files in $TMPDIR
  2650. cat > $TMPSH 2>> $logfile <<EOF
  2651. #! /bin/sh
  2652. EOF
  2653. chmod +x $TMPSH >> $logfile 2>&1
  2654. if ! $TMPSH >> $logfile 2>&1; then
  2655. cat <<EOF
  2656. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2657. variable to another directory and make sure that it is not mounted noexec.
  2658. EOF
  2659. die "Sanity test failed."
  2660. fi
  2661. ccc_flags(){
  2662. for flag; do
  2663. case $flag in
  2664. -std=c99) echo -c99 ;;
  2665. -mcpu=*) echo -arch ${flag#*=} ;;
  2666. -mieee) echo -ieee ;;
  2667. -O*|-fast) echo $flag ;;
  2668. -fno-math-errno) echo -assume nomath_errno ;;
  2669. -g) echo -g3 ;;
  2670. -Wall) echo -msg_enable level2 ;;
  2671. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2672. -Wl,*) echo $flag ;;
  2673. -f*|-W*) ;;
  2674. *) echo $flag ;;
  2675. esac
  2676. done
  2677. }
  2678. cparser_flags(){
  2679. for flag; do
  2680. case $flag in
  2681. -Wno-switch) echo -Wno-switch-enum ;;
  2682. -Wno-format-zero-length) ;;
  2683. -Wdisabled-optimization) ;;
  2684. -Wno-pointer-sign) echo -Wno-other ;;
  2685. *) echo $flag ;;
  2686. esac
  2687. done
  2688. }
  2689. msvc_common_flags(){
  2690. for flag; do
  2691. case $flag in
  2692. # In addition to specifying certain flags under the compiler
  2693. # specific filters, they must be specified here as well or else the
  2694. # generic catch all at the bottom will print the original flag.
  2695. -Wall) ;;
  2696. -std=c99) ;;
  2697. # Common flags
  2698. -fomit-frame-pointer) ;;
  2699. -g) echo -Z7 ;;
  2700. -fno-math-errno) ;;
  2701. -fno-common) ;;
  2702. -fno-signed-zeros) ;;
  2703. -fPIC) ;;
  2704. -mthumb) ;;
  2705. -march=*) ;;
  2706. -lz) echo zlib.lib ;;
  2707. -lavifil32) echo vfw32.lib ;;
  2708. -lavicap32) echo vfw32.lib user32.lib ;;
  2709. -l*) echo ${flag#-l}.lib ;;
  2710. *) echo $flag ;;
  2711. esac
  2712. done
  2713. }
  2714. msvc_flags(){
  2715. msvc_common_flags "$@"
  2716. for flag; do
  2717. case $flag in
  2718. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2719. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2720. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2721. -wd4554 \
  2722. -wd4273 ;;
  2723. esac
  2724. done
  2725. }
  2726. icl_flags(){
  2727. msvc_common_flags "$@"
  2728. for flag; do
  2729. case $flag in
  2730. # Despite what Intel's documentation says -Wall, which is supported
  2731. # on Windows, does enable remarks so disable them here.
  2732. -Wall) echo $flag -Qdiag-disable:remark ;;
  2733. -std=c99) echo -Qstd=c99 ;;
  2734. esac
  2735. done
  2736. }
  2737. pgi_flags(){
  2738. for flag; do
  2739. case $flag in
  2740. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2741. -fomit-frame-pointer) echo -Mnoframe ;;
  2742. -g) echo -gopt ;;
  2743. *) echo $flag ;;
  2744. esac
  2745. done
  2746. }
  2747. suncc_flags(){
  2748. for flag; do
  2749. case $flag in
  2750. -march=*|-mcpu=*)
  2751. case "${flag#*=}" in
  2752. native) echo -xtarget=native ;;
  2753. v9|niagara) echo -xarch=sparc ;;
  2754. ultrasparc) echo -xarch=sparcvis ;;
  2755. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2756. i586|pentium) echo -xchip=pentium ;;
  2757. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2758. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2759. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2760. pentium4*) echo -xtarget=pentium4 ;;
  2761. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2762. *-sse3) echo -xarch=sse3 ;;
  2763. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2764. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2765. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2766. amdfam10|barcelona) echo -xtarget=barcelona ;;
  2767. bdver*) echo -xarch=avx ;;
  2768. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2769. k8|opteron|athlon64|athlon-fx)
  2770. echo -xarch=sse2a ;;
  2771. athlon*) echo -xarch=pentium_proa ;;
  2772. esac
  2773. ;;
  2774. -std=c99) echo -xc99 ;;
  2775. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2776. -fPIC) echo -KPIC -xcode=pic32 ;;
  2777. -W*,*) echo $flag ;;
  2778. -f*-*|-W*|-mimpure-text) ;;
  2779. -shared) echo -G ;;
  2780. *) echo $flag ;;
  2781. esac
  2782. done
  2783. }
  2784. tms470_flags(){
  2785. for flag; do
  2786. case $flag in
  2787. -march=*|-mcpu=*)
  2788. case "${flag#*=}" in
  2789. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2790. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2791. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2792. armv6*|arm11*) echo -mv=6 ;;
  2793. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2794. echo -mv=5e ;;
  2795. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2796. esac
  2797. ;;
  2798. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2799. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2800. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2801. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2802. -msoft-float) echo --float_support=vfplib ;;
  2803. -O[0-3]|-mf=*) echo $flag ;;
  2804. -g) echo -g -mn ;;
  2805. -pds=*) echo $flag ;;
  2806. -D*|-I*) echo $flag ;;
  2807. --gcc|--abi=*) echo $flag ;;
  2808. -me) echo $flag ;;
  2809. esac
  2810. done
  2811. }
  2812. probe_cc(){
  2813. pfx=$1
  2814. _cc=$2
  2815. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2816. unset _ld_o _ldflags _ld_lib _ld_path
  2817. unset _depflags _DEPCMD _DEPFLAGS
  2818. _flags_filter=echo
  2819. if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
  2820. true # no-op to avoid reading stdin in following checks
  2821. elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2822. _type=llvm_gcc
  2823. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2824. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2825. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2826. _cflags_speed='-O3'
  2827. _cflags_size='-Os'
  2828. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2829. _type=gcc
  2830. gcc_version=$($_cc --version | head -n1)
  2831. gcc_basever=$($_cc -dumpversion)
  2832. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2833. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2834. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2835. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2836. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2837. fi
  2838. _cflags_speed='-O3'
  2839. _cflags_size='-Os'
  2840. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2841. _type=icc
  2842. _ident=$($_cc --version | head -n1)
  2843. _depflags='-MMD'
  2844. _cflags_speed='-O3'
  2845. _cflags_size='-Os'
  2846. _cflags_noopt='-O1'
  2847. elif $_cc -v 2>&1 | grep -q xlc; then
  2848. _type=xlc
  2849. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2850. _cflags_speed='-O5'
  2851. _cflags_size='-O5 -qcompact'
  2852. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2853. _type=ccc
  2854. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2855. _DEPFLAGS='-M'
  2856. _cflags_speed='-fast'
  2857. _cflags_size='-O1'
  2858. _flags_filter=ccc_flags
  2859. elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  2860. test -d "$sysroot" || die "No valid sysroot specified."
  2861. _type=armcc
  2862. _ident=$($_cc --vsn | head -n1)
  2863. armcc_conf="$PWD/armcc.conf"
  2864. $_cc --arm_linux_configure \
  2865. --arm_linux_config_file="$armcc_conf" \
  2866. --configure_sysroot="$sysroot" \
  2867. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2868. die "Error creating armcc configuration file."
  2869. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2870. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2871. as_default="${cross_prefix}gcc"
  2872. _depflags='-MMD'
  2873. _cflags_speed='-O3'
  2874. _cflags_size='-Os'
  2875. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2876. _type=tms470
  2877. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2878. _flags='--gcc --abi=eabi -me'
  2879. _cc_e='-ppl -fe=$@'
  2880. _cc_o='-fe=$@'
  2881. _depflags='-ppa -ppd=$(@:.o=.d)'
  2882. _cflags_speed='-O3 -mf=5'
  2883. _cflags_size='-O3 -mf=2'
  2884. _flags_filter=tms470_flags
  2885. elif $_cc -v 2>&1 | grep -q clang; then
  2886. _type=clang
  2887. _ident=$($_cc --version | head -n1)
  2888. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2889. _cflags_speed='-O3'
  2890. _cflags_size='-Os'
  2891. elif $_cc -V 2>&1 | grep -q Sun; then
  2892. _type=suncc
  2893. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2894. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2895. _DEPFLAGS='-xM1 -xc99'
  2896. _ldflags='-std=c99'
  2897. _cflags_speed='-O5'
  2898. _cflags_size='-O5 -xspace'
  2899. _flags_filter=suncc_flags
  2900. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2901. _type=pathscale
  2902. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2903. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2904. _cflags_speed='-O2'
  2905. _cflags_size='-Os'
  2906. _flags_filter='filter_out -Wdisabled-optimization'
  2907. elif $_cc -v 2>&1 | grep -q Open64; then
  2908. _type=open64
  2909. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2910. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2911. _cflags_speed='-O2'
  2912. _cflags_size='-Os'
  2913. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2914. elif $_cc -V 2>&1 | grep -q Portland; then
  2915. _type=pgi
  2916. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2917. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2918. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2919. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2920. _cflags_noopt="-O"
  2921. _flags_filter=pgi_flags
  2922. elif $_cc 2>&1 | grep -q Microsoft; then
  2923. _type=msvc
  2924. _ident=$($cc 2>&1 | head -n1)
  2925. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2926. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2927. _cflags_speed="-O2"
  2928. _cflags_size="-O1"
  2929. if $_cc 2>&1 | grep -q Linker; then
  2930. _ld_o='-out:$@'
  2931. else
  2932. _ld_o='-Fe$@'
  2933. fi
  2934. _cc_o='-Fo$@'
  2935. _cc_e='-P -Fi$@'
  2936. _flags_filter=msvc_flags
  2937. _ld_lib='lib%.a'
  2938. _ld_path='-libpath:'
  2939. _flags='-nologo'
  2940. _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2941. if [ $pfx = hostcc ]; then
  2942. append _cflags -Dsnprintf=_snprintf
  2943. fi
  2944. disable stripping
  2945. elif $_cc 2>&1 | grep -q Intel; then
  2946. _type=icl
  2947. _ident=$($cc 2>&1 | head -n1)
  2948. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  2949. # Not only is O3 broken on 13.x+ but it is slower on all previous
  2950. # versions (tested) as well.
  2951. _cflags_speed="-O2"
  2952. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  2953. if $_cc 2>&1 | grep -q Linker; then
  2954. _ld_o='-out:$@'
  2955. else
  2956. _ld_o='-Fe$@'
  2957. fi
  2958. _cc_o='-Fo$@'
  2959. _cc_e='-P'
  2960. _flags_filter=icl_flags
  2961. _ld_lib='lib%.a'
  2962. _ld_path='-libpath:'
  2963. # -Qdiag-error to make icl error when seeing certain unknown arguments
  2964. _flags='-nologo -Qdiag-error:4044,10157'
  2965. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
  2966. # with MSVC which enables it by default.
  2967. _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
  2968. if [ $pfx = hostcc ]; then
  2969. append _cflags -Dsnprintf=_snprintf
  2970. fi
  2971. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  2972. _type=cparser
  2973. _ident=$($_cc --version | head -n1)
  2974. _depflags='-MMD'
  2975. _cflags_speed='-O4'
  2976. _cflags_size='-O2'
  2977. _flags_filter=cparser_flags
  2978. fi
  2979. eval ${pfx}_type=\$_type
  2980. eval ${pfx}_ident=\$_ident
  2981. }
  2982. set_ccvars(){
  2983. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2984. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2985. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2986. if [ -n "$_depflags" ]; then
  2987. eval ${1}_DEPFLAGS=\$_depflags
  2988. else
  2989. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2990. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2991. eval DEP${1}FLAGS=\$_flags
  2992. fi
  2993. }
  2994. probe_cc cc "$cc"
  2995. cflags_filter=$_flags_filter
  2996. cflags_speed=$_cflags_speed
  2997. cflags_size=$_cflags_size
  2998. cflags_noopt=$_cflags_noopt
  2999. add_cflags $_flags $_cflags
  3000. cc_ldflags=$_ldflags
  3001. set_ccvars CC
  3002. probe_cc hostcc "$host_cc"
  3003. host_cflags_filter=$_flags_filter
  3004. add_host_cflags $_flags $_cflags
  3005. set_ccvars HOSTCC
  3006. test -n "$cc_type" && enable $cc_type ||
  3007. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  3008. : ${as_default:=$cc}
  3009. : ${dep_cc_default:=$cc}
  3010. : ${ld_default:=$cc}
  3011. : ${host_ld_default:=$host_cc}
  3012. set_default ar as dep_cc ld host_ld windres
  3013. probe_cc as "$as"
  3014. asflags_filter=$_flags_filter
  3015. add_asflags $_flags $_cflags
  3016. set_ccvars AS
  3017. probe_cc ld "$ld"
  3018. ldflags_filter=$_flags_filter
  3019. add_ldflags $_flags $_ldflags
  3020. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  3021. LD_O=${_ld_o-$LD_O}
  3022. LD_LIB=${_ld_lib-$LD_LIB}
  3023. LD_PATH=${_ld_path-$LD_PATH}
  3024. probe_cc hostld "$host_ld"
  3025. host_ldflags_filter=$_flags_filter
  3026. add_host_ldflags $_flags $_ldflags
  3027. HOSTLD_O=${_ld_o-$HOSTLD_O}
  3028. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  3029. probe_cc depcc "$dep_cc"
  3030. CCDEP=${_DEPCMD:-$DEPCMD}
  3031. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  3032. DEPCCFLAGS=$_flags
  3033. fi
  3034. if $ar 2>&1 | grep -q Microsoft; then
  3035. arflags="-nologo"
  3036. ar_o='-out:$@'
  3037. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  3038. arflags="rq"
  3039. ar_o='$@'
  3040. elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
  3041. arflags='-Xany -r -c'
  3042. ar_o='$@'
  3043. else
  3044. arflags="rc"
  3045. ar_o='$@'
  3046. fi
  3047. add_cflags $extra_cflags
  3048. add_cxxflags $extra_cxxflags
  3049. add_asflags $extra_cflags
  3050. if test -n "$sysroot"; then
  3051. case "$cc_type" in
  3052. gcc|llvm_gcc|clang)
  3053. add_cppflags --sysroot="$sysroot"
  3054. add_ldflags --sysroot="$sysroot"
  3055. ;;
  3056. tms470)
  3057. add_cppflags -I"$sysinclude"
  3058. add_ldflags --sysroot="$sysroot"
  3059. ;;
  3060. esac
  3061. fi
  3062. if test "$cpu" = host; then
  3063. enabled cross_compile &&
  3064. die "--cpu=host makes no sense when cross-compiling."
  3065. case "$cc_type" in
  3066. gcc|llvm_gcc)
  3067. check_native(){
  3068. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  3069. sed -n "/cc1.*$1=/{
  3070. s/.*$1=\\([^ ]*\\).*/\\1/
  3071. p
  3072. q
  3073. }" $TMPE
  3074. }
  3075. cpu=$(check_native -march || check_native -mcpu)
  3076. ;;
  3077. esac
  3078. test "${cpu:-host}" = host &&
  3079. die "--cpu=host not supported with compiler $cc"
  3080. fi
  3081. # Deal with common $arch aliases
  3082. case "$arch" in
  3083. aarch64|arm64)
  3084. arch="aarch64"
  3085. ;;
  3086. arm*|iPad*|iPhone*)
  3087. arch="arm"
  3088. ;;
  3089. mips*|IP*)
  3090. arch="mips"
  3091. ;;
  3092. parisc*|hppa*)
  3093. arch="parisc"
  3094. ;;
  3095. "Power Macintosh"|ppc*|powerpc*)
  3096. arch="ppc"
  3097. ;;
  3098. s390|s390x)
  3099. arch="s390"
  3100. ;;
  3101. sh4|sh)
  3102. arch="sh4"
  3103. ;;
  3104. sun4u|sparc*)
  3105. arch="sparc"
  3106. ;;
  3107. tilegx|tile-gx)
  3108. arch="tilegx"
  3109. ;;
  3110. i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  3111. arch="x86"
  3112. ;;
  3113. esac
  3114. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  3115. enable $arch
  3116. # Add processor-specific flags
  3117. if enabled aarch64; then
  3118. case $cpu in
  3119. armv*)
  3120. cpuflags="-march=$cpu"
  3121. ;;
  3122. *)
  3123. cpuflags="-mcpu=$cpu"
  3124. ;;
  3125. esac
  3126. elif enabled alpha; then
  3127. cpuflags="-mcpu=$cpu"
  3128. elif enabled arm; then
  3129. check_arm_arch() {
  3130. check_cpp_condition stddef.h \
  3131. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  3132. $cpuflags
  3133. }
  3134. probe_arm_arch() {
  3135. if check_arm_arch 4; then echo armv4;
  3136. elif check_arm_arch 4T; then echo armv4t;
  3137. elif check_arm_arch 5; then echo armv5;
  3138. elif check_arm_arch 5E; then echo armv5e;
  3139. elif check_arm_arch 5T; then echo armv5t;
  3140. elif check_arm_arch 5TE; then echo armv5te;
  3141. elif check_arm_arch 5TEJ; then echo armv5te;
  3142. elif check_arm_arch 6; then echo armv6;
  3143. elif check_arm_arch 6J; then echo armv6j;
  3144. elif check_arm_arch 6K; then echo armv6k;
  3145. elif check_arm_arch 6Z; then echo armv6z;
  3146. elif check_arm_arch 6ZK; then echo armv6zk;
  3147. elif check_arm_arch 6T2; then echo armv6t2;
  3148. elif check_arm_arch 7; then echo armv7;
  3149. elif check_arm_arch 7A 7_A; then echo armv7-a;
  3150. elif check_arm_arch 7R 7_R; then echo armv7-r;
  3151. elif check_arm_arch 7M 7_M; then echo armv7-m;
  3152. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  3153. elif check_arm_arch 8A 8_A; then echo armv8-a;
  3154. fi
  3155. }
  3156. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  3157. case $cpu in
  3158. armv*)
  3159. cpuflags="-march=$cpu"
  3160. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  3161. ;;
  3162. *)
  3163. cpuflags="-mcpu=$cpu"
  3164. case $cpu in
  3165. cortex-a*) subarch=armv7a ;;
  3166. cortex-r*) subarch=armv7r ;;
  3167. cortex-m*) enable thumb; subarch=armv7m ;;
  3168. arm11*) subarch=armv6 ;;
  3169. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  3170. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  3171. *) subarch=$(probe_arm_arch) ;;
  3172. esac
  3173. ;;
  3174. esac
  3175. case "$subarch" in
  3176. armv5t*) enable fast_clz ;;
  3177. armv[6-8]*) enable fast_clz fast_unaligned ;;
  3178. esac
  3179. elif enabled avr32; then
  3180. case $cpu in
  3181. ap7[02]0[0-2])
  3182. subarch="avr32_ap"
  3183. cpuflags="-mpart=$cpu"
  3184. ;;
  3185. ap)
  3186. subarch="avr32_ap"
  3187. cpuflags="-march=$cpu"
  3188. ;;
  3189. uc3[ab]*)
  3190. subarch="avr32_uc"
  3191. cpuflags="-mcpu=$cpu"
  3192. ;;
  3193. uc)
  3194. subarch="avr32_uc"
  3195. cpuflags="-march=$cpu"
  3196. ;;
  3197. esac
  3198. elif enabled bfin; then
  3199. cpuflags="-mcpu=$cpu"
  3200. elif enabled mips; then
  3201. cpuflags="-march=$cpu"
  3202. case $cpu in
  3203. 24kc)
  3204. disable mipsfpu
  3205. disable mipsdspr1
  3206. disable mipsdspr2
  3207. ;;
  3208. 24kf*)
  3209. disable mipsdspr1
  3210. disable mipsdspr2
  3211. ;;
  3212. 24kec|34kc|1004kc)
  3213. disable mipsfpu
  3214. disable mipsdspr2
  3215. ;;
  3216. 24kef*|34kf*|1004kf*)
  3217. disable mipsdspr2
  3218. ;;
  3219. 74kc)
  3220. disable mipsfpu
  3221. ;;
  3222. esac
  3223. elif enabled ppc; then
  3224. case $(tolower $cpu) in
  3225. 601|ppc601|powerpc601)
  3226. cpuflags="-mcpu=601"
  3227. disable altivec
  3228. ;;
  3229. 603*|ppc603*|powerpc603*)
  3230. cpuflags="-mcpu=603"
  3231. disable altivec
  3232. ;;
  3233. 604*|ppc604*|powerpc604*)
  3234. cpuflags="-mcpu=604"
  3235. disable altivec
  3236. ;;
  3237. g3|75*|ppc75*|powerpc75*)
  3238. cpuflags="-mcpu=750"
  3239. disable altivec
  3240. ;;
  3241. g4|745*|ppc745*|powerpc745*)
  3242. cpuflags="-mcpu=7450"
  3243. ;;
  3244. 74*|ppc74*|powerpc74*)
  3245. cpuflags="-mcpu=7400"
  3246. ;;
  3247. g5|970|ppc970|powerpc970)
  3248. cpuflags="-mcpu=970"
  3249. ;;
  3250. power[3-7]*)
  3251. cpuflags="-mcpu=$cpu"
  3252. ;;
  3253. cell)
  3254. cpuflags="-mcpu=cell"
  3255. enable ldbrx
  3256. ;;
  3257. e500mc)
  3258. cpuflags="-mcpu=e500mc"
  3259. disable altivec
  3260. ;;
  3261. e500v2)
  3262. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  3263. disable altivec
  3264. ;;
  3265. e500)
  3266. cpuflags="-mcpu=8540 -mhard-float"
  3267. disable altivec
  3268. ;;
  3269. esac
  3270. elif enabled sparc; then
  3271. case $cpu in
  3272. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  3273. cpuflags="-mcpu=$cpu"
  3274. disable vis
  3275. ;;
  3276. ultrasparc*|niagara[234])
  3277. cpuflags="-mcpu=$cpu"
  3278. ;;
  3279. esac
  3280. elif enabled x86; then
  3281. case $cpu in
  3282. i[345]86|pentium)
  3283. cpuflags="-march=$cpu"
  3284. disable mmx
  3285. ;;
  3286. # targets that do NOT support nopl and conditional mov (cmov)
  3287. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  3288. cpuflags="-march=$cpu"
  3289. disable i686
  3290. ;;
  3291. # targets that do support nopl and conditional mov (cmov)
  3292. 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*)
  3293. cpuflags="-march=$cpu"
  3294. enable i686
  3295. enable fast_cmov
  3296. ;;
  3297. # targets that do support conditional mov but on which it's slow
  3298. pentium4|pentium4m|prescott|nocona)
  3299. cpuflags="-march=$cpu"
  3300. enable i686
  3301. disable fast_cmov
  3302. ;;
  3303. esac
  3304. fi
  3305. if [ "$cpu" != generic ]; then
  3306. add_cflags $cpuflags
  3307. add_asflags $cpuflags
  3308. fi
  3309. # compiler sanity check
  3310. check_exec <<EOF
  3311. int main(void){ return 0; }
  3312. EOF
  3313. if test "$?" != 0; then
  3314. echo "$cc is unable to create an executable file."
  3315. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3316. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3317. echo "Only do this if you know what cross compiling means."
  3318. fi
  3319. die "C compiler test failed."
  3320. fi
  3321. add_cppflags -D_ISOC99_SOURCE
  3322. add_cxxflags -D__STDC_CONSTANT_MACROS
  3323. check_cflags -std=c99
  3324. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  3325. #include <stdlib.h>
  3326. EOF
  3327. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  3328. #include <stdlib.h>
  3329. EOF
  3330. add_host_cppflags -D_ISOC99_SOURCE
  3331. check_host_cflags -std=c99
  3332. check_host_cflags -Wall
  3333. check_host_cflags -O3
  3334. check_64bit(){
  3335. arch32=$1
  3336. arch64=$2
  3337. expr=$3
  3338. check_code cc "" "int test[2*($expr) - 1]" &&
  3339. subarch=$arch64 || subarch=$arch32
  3340. }
  3341. case "$arch" in
  3342. aarch64|alpha|ia64)
  3343. spic=$shared
  3344. ;;
  3345. mips)
  3346. check_64bit mips mips64 '_MIPS_SIM > 1'
  3347. spic=$shared
  3348. ;;
  3349. parisc)
  3350. check_64bit parisc parisc64 'sizeof(void *) > 4'
  3351. spic=$shared
  3352. ;;
  3353. ppc)
  3354. check_64bit ppc ppc64 'sizeof(void *) > 4'
  3355. spic=$shared
  3356. ;;
  3357. sparc)
  3358. check_64bit sparc sparc64 'sizeof(void *) > 4'
  3359. spic=$shared
  3360. ;;
  3361. x86)
  3362. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  3363. if test "$subarch" = "x86_64"; then
  3364. spic=$shared
  3365. fi
  3366. ;;
  3367. ppc)
  3368. check_cc <<EOF && subarch="ppc64"
  3369. int test[(int)sizeof(char*) - 7];
  3370. EOF
  3371. ;;
  3372. esac
  3373. enable $subarch
  3374. enabled spic && enable_weak pic
  3375. # OS specific
  3376. case $target_os in
  3377. aix)
  3378. SHFLAGS=-shared
  3379. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  3380. enabled shared && add_ldflags -Wl,-brtl
  3381. ;;
  3382. haiku)
  3383. prefix_default="/boot/common"
  3384. network_extralibs="-lnetwork"
  3385. host_libs=
  3386. ;;
  3387. sunos)
  3388. SHFLAGS='-shared -Wl,-h,$$(@F)'
  3389. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  3390. network_extralibs="-lsocket -lnsl"
  3391. # When using suncc to build, the Solaris linker will mark
  3392. # an executable with each instruction set encountered by
  3393. # the Solaris assembler. As our libraries contain their own
  3394. # guards for processor-specific code, instead suppress
  3395. # generation of the HWCAPS ELF section on Solaris x86 only.
  3396. enabled_all suncc x86 &&
  3397. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  3398. add_ldflags -Wl,-M,mapfile
  3399. nm_default='nm -P -g'
  3400. ;;
  3401. netbsd)
  3402. disable symver
  3403. oss_indev_extralibs="-lossaudio"
  3404. oss_outdev_extralibs="-lossaudio"
  3405. enabled gcc || check_ldflags -Wl,-zmuldefs
  3406. ;;
  3407. openbsd|bitrig)
  3408. disable symver
  3409. SHFLAGS='-shared'
  3410. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3411. SLIB_INSTALL_LINKS=
  3412. oss_indev_extralibs="-lossaudio"
  3413. oss_outdev_extralibs="-lossaudio"
  3414. ;;
  3415. dragonfly)
  3416. disable symver
  3417. ;;
  3418. freebsd)
  3419. ;;
  3420. bsd/os)
  3421. add_extralibs -lpoll -lgnugetopt
  3422. strip="strip -d"
  3423. ;;
  3424. darwin)
  3425. gas="gas-preprocessor.pl $cc"
  3426. enabled ppc && add_asflags -force_cpusubtype_ALL
  3427. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3428. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3429. strip="${strip} -x"
  3430. add_ldflags -Wl,-dynamic,-search_paths_first
  3431. SLIBSUF=".dylib"
  3432. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  3433. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  3434. objformat="macho"
  3435. enabled x86_64 && objformat="macho64"
  3436. enabled_any pic shared ||
  3437. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3438. ;;
  3439. mingw32*)
  3440. if test $target_os = "mingw32ce"; then
  3441. disable network
  3442. else
  3443. target_os=mingw32
  3444. fi
  3445. LIBTARGET=i386
  3446. if enabled x86_64; then
  3447. LIBTARGET="i386:x86-64"
  3448. elif enabled arm; then
  3449. LIBTARGET=arm-wince
  3450. fi
  3451. enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
  3452. check_ldflags -Wl,--nxcompat
  3453. check_ldflags -Wl,--dynamicbase
  3454. shlibdir_default="$bindir_default"
  3455. SLIBPREF=""
  3456. SLIBSUF=".dll"
  3457. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3458. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3459. dlltool="${cross_prefix}dlltool"
  3460. if check_cmd lib.exe -list; then
  3461. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3462. if enabled x86_64; then
  3463. LIBTARGET=x64
  3464. fi
  3465. elif check_cmd $dlltool --version; then
  3466. 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)'
  3467. fi
  3468. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3469. SLIB_INSTALL_LINKS=
  3470. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3471. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3472. 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'
  3473. objformat="win32"
  3474. ranlib=:
  3475. enable dos_paths
  3476. ;;
  3477. win32|win64)
  3478. disable symver
  3479. if enabled shared; then
  3480. # Link to the import library instead of the normal static library
  3481. # for shared libs.
  3482. LD_LIB='%.lib'
  3483. # Cannot build both shared and static libs with MSVC or icl.
  3484. disable static
  3485. fi
  3486. shlibdir_default="$bindir_default"
  3487. SLIBPREF=""
  3488. SLIBSUF=".dll"
  3489. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3490. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3491. SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3492. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3493. SLIB_INSTALL_LINKS=
  3494. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3495. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3496. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3497. objformat="win32"
  3498. ranlib=:
  3499. enable dos_paths
  3500. ;;
  3501. cygwin*)
  3502. target_os=cygwin
  3503. shlibdir_default="$bindir_default"
  3504. SLIBPREF="cyg"
  3505. SLIBSUF=".dll"
  3506. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3507. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3508. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3509. SLIB_INSTALL_LINKS=
  3510. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  3511. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  3512. objformat="win32"
  3513. enable dos_paths
  3514. enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
  3515. ;;
  3516. *-dos|freedos|opendos)
  3517. network_extralibs="-lsocket"
  3518. objformat="coff"
  3519. enable dos_paths
  3520. add_cppflags -U__STRICT_ANSI__
  3521. ;;
  3522. linux)
  3523. enable dv1394
  3524. ;;
  3525. irix*)
  3526. target_os=irix
  3527. ranlib="echo ignoring ranlib"
  3528. ;;
  3529. os/2*)
  3530. strip="lxlite -CS"
  3531. ln_s="cp -f"
  3532. objformat="aout"
  3533. add_cppflags -D_GNU_SOURCE
  3534. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  3535. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3536. LIBSUF="_s.a"
  3537. SLIBPREF=""
  3538. SLIBSUF=".dll"
  3539. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3540. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3541. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3542. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  3543. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3544. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3545. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3546. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  3547. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3548. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3549. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3550. enable dos_paths
  3551. enable_weak os2threads
  3552. ;;
  3553. gnu/kfreebsd)
  3554. add_cppflags -D_BSD_SOURCE
  3555. ;;
  3556. gnu)
  3557. ;;
  3558. qnx)
  3559. add_cppflags -D_QNX_SOURCE
  3560. network_extralibs="-lsocket"
  3561. ;;
  3562. symbian)
  3563. SLIBSUF=".dll"
  3564. enable dos_paths
  3565. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3566. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3567. add_ldflags -Wl,--target1-abs,--no-undefined \
  3568. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3569. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3570. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3571. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3572. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3573. ;;
  3574. osf1)
  3575. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  3576. ;;
  3577. minix)
  3578. ;;
  3579. plan9)
  3580. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  3581. -D_REENTRANT_SOURCE \
  3582. -D_RESEARCH_SOURCE \
  3583. -DFD_SETSIZE=96 \
  3584. -DHAVE_SOCK_OPTS
  3585. add_compat strtod.o strtod=avpriv_strtod
  3586. network_extralibs='-lbsd'
  3587. exeobjs=compat/plan9/main.o
  3588. disable ffserver
  3589. cp_f='cp'
  3590. ;;
  3591. none)
  3592. ;;
  3593. *)
  3594. die "Unknown OS '$target_os'."
  3595. ;;
  3596. esac
  3597. # determine libc flavour
  3598. probe_libc(){
  3599. pfx=$1
  3600. pfx_no_=${pfx%_}
  3601. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3602. if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
  3603. eval ${pfx}libc_type=uclibc
  3604. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3605. elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
  3606. eval ${pfx}libc_type=glibc
  3607. add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3608. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3609. elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3610. eval ${pfx}libc_type=newlib
  3611. add_${pfx}cppflags -U__STRICT_ANSI__
  3612. # MinGW64 is backwards compatible with MinGW32, so check for it first.
  3613. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
  3614. eval ${pfx}libc_type=mingw64
  3615. if check_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
  3616. add_compat msvcrt/snprintf.o
  3617. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  3618. fi
  3619. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3620. eval test \$${pfx_no_}cc_type = "gcc" &&
  3621. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3622. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
  3623. check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
  3624. eval ${pfx}libc_type=mingw32
  3625. check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
  3626. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3627. die "ERROR: MinGW32 runtime version must be >= 3.15."
  3628. add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
  3629. eval test \$${pfx_no_}cc_type = "gcc" &&
  3630. add_${pfx}cppflags -D__printf__=__gnu_printf__
  3631. elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
  3632. eval ${pfx}libc_type=msvcrt
  3633. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  3634. # 0x601 by default unless something else is set by the user.
  3635. # This can easily lead to us detecting functions only present
  3636. # in such new versions and producing binaries requiring windows 7.0.
  3637. # Therefore explicitly set the default to XP unless the user has
  3638. # set something else on the command line.
  3639. check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
  3640. add_${pfx}cppflags -D_WIN32_WINNT=0x0502
  3641. elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
  3642. eval ${pfx}libc_type=klibc
  3643. elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3644. eval ${pfx}libc_type=bionic
  3645. elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
  3646. eval ${pfx}libc_type=solaris
  3647. add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  3648. fi
  3649. }
  3650. probe_libc
  3651. test -n "$libc_type" && enable libc_$libc_type
  3652. probe_libc host_
  3653. test -n "$host_libc_type" && enable host_libc_$host_libc_type
  3654. case $libc_type in
  3655. bionic)
  3656. add_compat strtod.o strtod=avpriv_strtod
  3657. ;;
  3658. msvcrt)
  3659. add_compat strtod.o strtod=avpriv_strtod
  3660. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3661. _snprintf=avpriv_snprintf \
  3662. vsnprintf=avpriv_vsnprintf
  3663. ;;
  3664. esac
  3665. # hacks for compiler/libc/os combinations
  3666. if enabled_all tms470 libc_glibc; then
  3667. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3668. add_cppflags -D__USER_LABEL_PREFIX__=
  3669. add_cppflags -D__builtin_memset=memset
  3670. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3671. add_cflags -pds=48 # incompatible redefinition of macro
  3672. fi
  3673. if enabled_all ccc libc_glibc; then
  3674. add_ldflags -Wl,-z,now # calls to libots crash without this
  3675. fi
  3676. esc(){
  3677. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3678. }
  3679. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
  3680. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3681. set_default $PATHS_LIST
  3682. set_default nm
  3683. # we need to build at least one lib type
  3684. if ! enabled_any static shared; then
  3685. cat <<EOF
  3686. At least one library type must be built.
  3687. Specify --enable-static to build the static libraries or --enable-shared to
  3688. build the shared libraries as well. To only build the shared libraries specify
  3689. --disable-static in addition to --enable-shared.
  3690. EOF
  3691. exit 1;
  3692. fi
  3693. # backward compatibility layer for incompatible_libav/fork_abi
  3694. enabled incompatible_fork_abi && enable incompatible_libav_abi
  3695. enabled incompatible_libav_abi && enable incompatible_fork_abi
  3696. die_license_disabled() {
  3697. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  3698. }
  3699. die_license_disabled_gpl() {
  3700. enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; }
  3701. }
  3702. die_license_disabled gpl frei0r
  3703. die_license_disabled gpl libcdio
  3704. die_license_disabled gpl libutvideo
  3705. die_license_disabled gpl libvidstab
  3706. die_license_disabled gpl libx264
  3707. die_license_disabled gpl libx265
  3708. die_license_disabled gpl libxavs
  3709. die_license_disabled gpl libxvid
  3710. die_license_disabled gpl libzvbi
  3711. die_license_disabled gpl x11grab
  3712. die_license_disabled nonfree libaacplus
  3713. die_license_disabled nonfree libfaac
  3714. enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
  3715. enabled gpl && die_license_disabled_gpl nonfree openssl
  3716. die_license_disabled version3 libopencore_amrnb
  3717. die_license_disabled version3 libopencore_amrwb
  3718. die_license_disabled version3 libvo_aacenc
  3719. die_license_disabled version3 libvo_amrwbenc
  3720. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3721. disabled optimizations || check_cflags -fomit-frame-pointer
  3722. enable_weak_pic() {
  3723. disabled pic && return
  3724. enable pic
  3725. add_cppflags -DPIC
  3726. case "$target_os" in
  3727. mingw*|cygwin*)
  3728. ;;
  3729. *)
  3730. add_cflags -fPIC
  3731. ;;
  3732. esac
  3733. add_asflags -fPIC
  3734. }
  3735. enabled pic && enable_weak_pic
  3736. check_cc <<EOF || die "Symbol mangling check failed."
  3737. int ff_extern;
  3738. EOF
  3739. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3740. extern_prefix=${sym%%ff_extern*}
  3741. check_cc <<EOF && enable_weak inline_asm
  3742. void foo(void) { __asm__ volatile ("" ::); }
  3743. EOF
  3744. _restrict=
  3745. for restrict_keyword in restrict __restrict__ __restrict; do
  3746. check_cc <<EOF && _restrict=$restrict_keyword && break
  3747. void foo(char * $restrict_keyword p);
  3748. EOF
  3749. done
  3750. check_cc <<EOF && enable pragma_deprecated
  3751. void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
  3752. EOF
  3753. check_cc <<EOF && enable attribute_packed
  3754. struct { int x; } __attribute__((packed)) x;
  3755. EOF
  3756. check_cc <<EOF && enable attribute_may_alias
  3757. union { int x; } __attribute__((may_alias)) x;
  3758. EOF
  3759. check_cc <<EOF || die "endian test failed"
  3760. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3761. EOF
  3762. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3763. check_inline_asm inline_asm_labels '"1:\n"'
  3764. if enabled aarch64; then
  3765. # internal assembler in clang 3.3 does not support this instruction
  3766. enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
  3767. enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
  3768. map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
  3769. elif enabled alpha; then
  3770. check_cflags -mieee
  3771. elif enabled arm; then
  3772. check_cpp_condition stddef.h "defined __thumb__" && check_cc <<EOF && enable_weak thumb
  3773. float func(float a, float b){ return a+b; }
  3774. EOF
  3775. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3776. nogas=die
  3777. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3778. enable vfp_args
  3779. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  3780. case "${cross_prefix:-$cc}" in
  3781. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3782. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3783. __asm__ (".eabi_attribute 28, 1");
  3784. int main(void) { return 0; }
  3785. EOF
  3786. esac
  3787. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3788. fi
  3789. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3790. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3791. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3792. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3793. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3794. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3795. [ $target_os = linux ] ||
  3796. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3797. $ARCH_EXT_LIST_ARM
  3798. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3799. check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  3800. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  3801. elif enabled mips; then
  3802. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3803. enabled mips32r2 && add_cflags "-mips32r2" && add_asflags "-mips32r2" &&
  3804. check_inline_asm mips32r2 '"rotr $t0, $t1, 1"'
  3805. enabled mipsdspr1 && add_cflags "-mdsp" && add_asflags "-mdsp" &&
  3806. check_inline_asm mipsdspr1 '"addu.qb $t0, $t1, $t2"'
  3807. enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
  3808. check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
  3809. enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
  3810. check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"'
  3811. elif enabled parisc; then
  3812. if enabled gcc; then
  3813. case $($cc -dumpversion) in
  3814. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3815. esac
  3816. fi
  3817. elif enabled ppc; then
  3818. enable local_aligned_8 local_aligned_16
  3819. [ $cpu != e500 -a $cpu != e500v2 ] &&
  3820. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3821. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3822. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3823. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3824. # AltiVec flags: The FSF version of GCC differs from the Apple version
  3825. if enabled altivec; then
  3826. if ! enabled_any pic ppc64; then
  3827. nogas=warn
  3828. fi
  3829. check_cflags -maltivec -mabi=altivec &&
  3830. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  3831. check_cflags -faltivec
  3832. # check if our compiler supports Motorola AltiVec C API
  3833. check_cc <<EOF || disable altivec
  3834. $inc_altivec_h
  3835. int main(void) {
  3836. vector signed int v1 = (vector signed int) { 0 };
  3837. vector signed int v2 = (vector signed int) { 1 };
  3838. v1 = vec_add(v1, v2);
  3839. return 0;
  3840. }
  3841. EOF
  3842. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3843. fi
  3844. elif enabled sparc; then
  3845. enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
  3846. elif enabled x86; then
  3847. check_builtin rdtsc intrin.h "__rdtsc()"
  3848. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3849. enable local_aligned_8 local_aligned_16
  3850. # check whether EBP is available on x86
  3851. # As 'i' is stored on the stack, this program will crash
  3852. # if the base pointer is used to access it because the
  3853. # base pointer is cleared in the inline assembly code.
  3854. check_exec_crash <<EOF && enable ebp_available
  3855. volatile int i=0;
  3856. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3857. return i;
  3858. EOF
  3859. # check whether EBX is available on x86
  3860. check_inline_asm ebx_available '""::"b"(0)' &&
  3861. check_inline_asm ebx_available '"":::"%ebx"'
  3862. # check whether xmm clobbers are supported
  3863. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3864. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3865. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3866. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3867. if ! disabled_any asm mmx yasm; then
  3868. if check_cmd $yasmexe --version; then
  3869. enabled x86_64 && yasm_extra="-m amd64"
  3870. yasm_debug="-g dwarf2"
  3871. elif check_cmd nasm -v; then
  3872. yasmexe=nasm
  3873. yasm_debug="-g -F dwarf"
  3874. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3875. fi
  3876. YASMFLAGS="-f $objformat $yasm_extra"
  3877. enabled pic && append YASMFLAGS "-DPIC"
  3878. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3879. case "$objformat" in
  3880. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3881. esac
  3882. check_yasm "movbe ecx, [5]" && enable yasm ||
  3883. die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
  3884. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx_external avresample
  3885. check_yasm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
  3886. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  3887. check_yasm "CPU amdnop" && enable cpunop
  3888. fi
  3889. case "$cpu" in
  3890. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  3891. disable fast_clz
  3892. ;;
  3893. esac
  3894. fi
  3895. if enabled asm; then
  3896. as=${gas:=$as}
  3897. check_as <<EOF && enable gnu_as || \
  3898. $nogas "GNU assembler not found, install gas-preprocessor"
  3899. .macro m n
  3900. \n: .int 0
  3901. .endm
  3902. m x
  3903. EOF
  3904. fi
  3905. check_ldflags -Wl,--as-needed
  3906. if check_func dlopen; then
  3907. ldl=
  3908. elif check_func dlopen -ldl; then
  3909. ldl=-ldl
  3910. fi
  3911. if ! disabled network; then
  3912. check_type "sys/types.h sys/socket.h" socklen_t
  3913. check_type netdb.h "struct addrinfo"
  3914. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3915. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3916. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3917. check_type netinet/in.h "struct sockaddr_in6"
  3918. check_type poll.h "struct pollfd"
  3919. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3920. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3921. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3922. check_func getaddrinfo $network_extralibs
  3923. check_func getservbyport $network_extralibs
  3924. check_func inet_aton $network_extralibs
  3925. # Prefer arpa/inet.h over winsock2
  3926. if check_header arpa/inet.h ; then
  3927. check_func closesocket
  3928. elif check_header winsock2.h ; then
  3929. check_func_headers winsock2.h closesocket -lws2 &&
  3930. network_extralibs="-lws2" ||
  3931. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3932. network_extralibs="-lws2_32"; } || disable winsock2_h network
  3933. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3934. check_type ws2tcpip.h socklen_t
  3935. check_type ws2tcpip.h "struct addrinfo"
  3936. check_type ws2tcpip.h "struct group_source_req"
  3937. check_type ws2tcpip.h "struct ip_mreq_source"
  3938. check_type ws2tcpip.h "struct ipv6_mreq"
  3939. check_type winsock2.h "struct pollfd"
  3940. check_type ws2tcpip.h "struct sockaddr_in6"
  3941. check_type ws2tcpip.h "struct sockaddr_storage"
  3942. check_struct winsock2.h "struct sockaddr" sa_len
  3943. else
  3944. disable network
  3945. fi
  3946. fi
  3947. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3948. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  3949. check_func access
  3950. check_func clock_gettime || { check_func clock_gettime -lrt && add_extralibs -lrt; }
  3951. check_func fcntl
  3952. check_func fork
  3953. check_func_headers stdlib.h getenv
  3954. check_func gethrtime
  3955. check_func getopt
  3956. check_func getrusage
  3957. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3958. check_func gettimeofday
  3959. check_func isatty
  3960. check_func localtime_r
  3961. check_func ${malloc_prefix}memalign && enable memalign
  3962. check_func mkstemp
  3963. check_func mmap
  3964. check_func mprotect
  3965. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3966. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3967. check_func setrlimit
  3968. check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  3969. check_func strerror_r
  3970. check_func sched_getaffinity
  3971. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  3972. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  3973. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  3974. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  3975. check_builtin sarestart signal.h "SA_RESTART"
  3976. check_func sysconf
  3977. check_func sysctl
  3978. check_func usleep
  3979. check_func_headers conio.h kbhit
  3980. check_func_headers windows.h PeekNamedPipe
  3981. check_func_headers io.h setmode
  3982. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  3983. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3984. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3985. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3986. check_func_headers windows.h GetProcessAffinityMask
  3987. check_func_headers windows.h GetProcessTimes
  3988. check_func_headers windows.h GetSystemTimeAsFileTime
  3989. check_func_headers windows.h MapViewOfFile
  3990. check_func_headers windows.h SetConsoleTextAttribute
  3991. check_func_headers windows.h Sleep
  3992. check_func_headers windows.h VirtualAlloc
  3993. check_func_headers glob.h glob
  3994. check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
  3995. check_header cl/cl.h
  3996. check_header direct.h
  3997. check_header dlfcn.h
  3998. check_header dxva.h
  3999. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  4000. check_header io.h
  4001. check_header libcrystalhd/libcrystalhd_if.h
  4002. check_header malloc.h
  4003. check_header poll.h
  4004. check_header sys/mman.h
  4005. check_header sys/param.h
  4006. check_header sys/resource.h
  4007. check_header sys/select.h
  4008. check_header sys/time.h
  4009. check_header sys/un.h
  4010. check_header termios.h
  4011. check_header unistd.h
  4012. check_header vdpau/vdpau.h
  4013. check_header vdpau/vdpau_x11.h
  4014. check_header VideoDecodeAcceleration/VDADecoder.h
  4015. check_header windows.h
  4016. check_header X11/extensions/XvMClib.h
  4017. check_header asm/types.h
  4018. if ! disabled w32threads && ! enabled pthreads; then
  4019. check_func_headers "windows.h process.h" _beginthreadex &&
  4020. enable w32threads || disable w32threads
  4021. fi
  4022. # check for some common methods of building with pthread support
  4023. # do this before the optional library checks as some of them require pthreads
  4024. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  4025. enable pthreads
  4026. if check_func pthread_join -pthread && check_func pthread_create -pthread; then
  4027. add_cflags -pthread
  4028. add_extralibs -pthread
  4029. elif check_func pthread_join -pthreads && check_func pthread_create -pthreads; then
  4030. add_cflags -pthreads
  4031. add_extralibs -pthreads
  4032. elif check_func pthread_join -lpthreadGC2 && check_func pthread_create -lpthreadGC2; then
  4033. add_extralibs -lpthreadGC2
  4034. elif check_lib pthread.h pthread_join -lpthread && check_lib pthread.h pthread_create -lpthread; then
  4035. :
  4036. elif ! check_func pthread_join && ! check_func pthread_create; then
  4037. disable pthreads
  4038. fi
  4039. check_code cc "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER" || disable pthreads
  4040. fi
  4041. for thread in $THREADS_LIST; do
  4042. if enabled $thread; then
  4043. test -n "$thread_type" &&
  4044. die "ERROR: Only one thread type must be selected." ||
  4045. thread_type="$thread"
  4046. fi
  4047. done
  4048. if enabled pthreads; then
  4049. check_func pthread_cancel
  4050. fi
  4051. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  4052. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  4053. check_lib math.h sin -lm && LIBM="-lm"
  4054. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  4055. atan2f_args=2
  4056. ldexpf_args=2
  4057. powf_args=2
  4058. for func in $MATH_FUNCS; do
  4059. eval check_mathfunc $func \${${func}_args:-1}
  4060. done
  4061. # these are off by default, so fail if requested and not available
  4062. enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } ||
  4063. { check_lib2 "dlfcn.h" dlopen -ldl; } ||
  4064. die "ERROR: LoadLibrary/dlopen not found for avisynth"; }
  4065. enabled decklink && { check_header DeckLinkAPI.h || die "ERROR: DeckLinkAPI.h header not found"; }
  4066. enabled fontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  4067. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  4068. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  4069. enabled ladspa && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; }
  4070. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  4071. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  4072. enabled libass && require_pkg_config libass ass/ass.h ass_library_init
  4073. enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray
  4074. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  4075. { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
  4076. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  4077. enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
  4078. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  4079. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  4080. 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"
  4081. enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
  4082. enabled libfreetype && require_libfreetype
  4083. enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++
  4084. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  4085. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  4086. done || die "ERROR: libgsm not found"; }
  4087. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  4088. enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
  4089. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  4090. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  4091. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  4092. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  4093. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  4094. enabled libopenjpeg && { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg ||
  4095. check_lib openjpeg.h opj_version -lopenjpeg ||
  4096. die "ERROR: libopenjpeg not found"; }
  4097. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  4098. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  4099. enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
  4100. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  4101. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  4102. enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer
  4103. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  4104. enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
  4105. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  4106. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  4107. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  4108. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
  4109. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  4110. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  4111. { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  4112. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  4113. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  4114. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  4115. enabled libvidstab && require_pkg_config "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
  4116. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  4117. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  4118. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  4119. enabled libvpx && {
  4120. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  4121. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  4122. 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 ||
  4123. die "ERROR: libvpx encoder version must be >=0.9.7"; }
  4124. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  4125. 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; } }
  4126. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  4127. enabled libwebp && require_pkg_config libwebp webp/encode.h WebPGetEncoderVersion
  4128. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  4129. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  4130. die "ERROR: libx264 must be installed and version must be >= 0.118."; }
  4131. enabled libx265 && require_pkg_config x265 x265.h x265_encoder_encode &&
  4132. { check_cpp_condition x265.h "X265_BUILD >= 5" ||
  4133. die "ERROR: libx265 version must be >= 5."; }
  4134. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  4135. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  4136. enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new
  4137. enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi
  4138. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  4139. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  4140. die "ERROR: openal not found"; } &&
  4141. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  4142. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  4143. enabled opencl && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
  4144. check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
  4145. die "ERROR: opencl not found"; } &&
  4146. { ! enabled_any w32threads os2threads ||
  4147. die "opencl currently needs --enable-pthreads or --disable-w32threads"; } &&
  4148. { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
  4149. check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
  4150. die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
  4151. enabled opengl && { check_lib GL/glx.h glXGetProcAddress "-lGL" ||
  4152. check_lib2 windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
  4153. check_lib2 OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
  4154. check_lib2 ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
  4155. die "ERROR: opengl not found."
  4156. }
  4157. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  4158. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  4159. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  4160. die "ERROR: openssl not found"; }
  4161. if enabled gnutls; then
  4162. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  4163. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  4164. fi
  4165. # libdc1394 check
  4166. if enabled libdc1394; then
  4167. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  4168. enable libdc1394_2; } ||
  4169. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  4170. enable libdc1394_1; } ||
  4171. die "ERROR: No version of libdc1394 found "
  4172. fi
  4173. SDL_CONFIG="${cross_prefix}sdl-config"
  4174. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  4175. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  4176. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  4177. enable sdl
  4178. else
  4179. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  4180. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  4181. sdl_libs=$("${SDL_CONFIG}" --libs)
  4182. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  4183. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  4184. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  4185. enable sdl
  4186. fi
  4187. fi
  4188. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  4189. texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  4190. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  4191. perl -v > /dev/null 2>&1 && enable perl || disable perl
  4192. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  4193. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  4194. check_header linux/fb.h
  4195. check_header linux/videodev.h
  4196. check_header linux/videodev2.h
  4197. check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  4198. check_header sys/videoio.h
  4199. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  4200. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  4201. # w32api 3.12 had it defined wrong
  4202. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  4203. check_type "dshow.h" IBaseFilter
  4204. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  4205. { check_header dev/bktr/ioctl_meteor.h &&
  4206. check_header dev/bktr/ioctl_bt848.h; } ||
  4207. { check_header machine/ioctl_meteor.h &&
  4208. check_header machine/ioctl_bt848.h; } ||
  4209. { check_header dev/video/meteor/ioctl_meteor.h &&
  4210. check_header dev/video/bktr/ioctl_bt848.h; } ||
  4211. check_header dev/ic/bt8xx.h
  4212. check_header sndio.h
  4213. if check_struct sys/soundcard.h audio_buf_info bytes; then
  4214. enable_safe sys/soundcard.h
  4215. else
  4216. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  4217. #include <sys/soundcard.h>
  4218. audio_buf_info abc;
  4219. EOF
  4220. fi
  4221. check_header soundcard.h
  4222. enabled_any alsa_indev alsa_outdev &&
  4223. check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  4224. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait &&
  4225. check_func jack_port_get_latency_range -ljack
  4226. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  4227. if enabled libcdio; then
  4228. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4229. check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4230. die "ERROR: libcdio-paranoia not found"
  4231. fi
  4232. check_lib X11/Xlib.h XOpenDisplay -lX11 && enable xlib
  4233. enabled x11grab &&
  4234. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  4235. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes &&
  4236. { enabled xlib || die "ERROR: Xlib not found"; }
  4237. enabled vaapi &&
  4238. check_lib va/va.h vaInitialize -lva ||
  4239. disable vaapi
  4240. enabled vdpau &&
  4241. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  4242. disable vdpau
  4243. enabled vdpau && enabled xlib &&
  4244. check_func_headers "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
  4245. prepend ffmpeg_libs $($ldflags_filter "-lvdpau") &&
  4246. enable vdpau_x11
  4247. # Funny iconv installations are not unusual, so check it after all flags have been set
  4248. disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv
  4249. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  4250. # add some useful compiler flags if supported
  4251. check_cflags -Wdeclaration-after-statement
  4252. check_cflags -Wall
  4253. check_cflags -Wdisabled-optimization
  4254. check_cflags -Wpointer-arith
  4255. check_cflags -Wredundant-decls
  4256. check_cflags -Wwrite-strings
  4257. check_cflags -Wtype-limits
  4258. check_cflags -Wundef
  4259. check_cflags -Wmissing-prototypes
  4260. check_cflags -Wno-pointer-to-int-cast
  4261. check_cflags -Wstrict-prototypes
  4262. enabled extra_warnings && check_cflags -Winline
  4263. check_disable_warning(){
  4264. warning_flag=-W${1#-Wno-}
  4265. test_cflags $warning_flag && add_cflags $1
  4266. }
  4267. check_disable_warning -Wno-parentheses
  4268. check_disable_warning -Wno-switch
  4269. check_disable_warning -Wno-format-zero-length
  4270. check_disable_warning -Wno-pointer-sign
  4271. # add some linker flags
  4272. check_ldflags -Wl,--warn-common
  4273. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  4274. enabled rpath && add_ldflags -Wl,-rpath=$libdir
  4275. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  4276. # add some strip flags
  4277. # -wN '..@*' is more selective than -x, but not available everywhere.
  4278. check_stripflags -wN \'..@*\' || check_stripflags -x
  4279. enabled neon_clobber_test &&
  4280. check_ldflags -Wl,--wrap,avcodec_open2 \
  4281. -Wl,--wrap,avcodec_decode_audio4 \
  4282. -Wl,--wrap,avcodec_decode_video2 \
  4283. -Wl,--wrap,avcodec_decode_subtitle2 \
  4284. -Wl,--wrap,avcodec_encode_audio2 \
  4285. -Wl,--wrap,avcodec_encode_video2 \
  4286. -Wl,--wrap,avcodec_encode_subtitle \
  4287. -Wl,--wrap,swr_convert \
  4288. -Wl,--wrap,avresample_convert ||
  4289. disable neon_clobber_test
  4290. enabled xmm_clobber_test &&
  4291. check_ldflags -Wl,--wrap,avcodec_open2 \
  4292. -Wl,--wrap,avcodec_decode_audio4 \
  4293. -Wl,--wrap,avcodec_decode_video2 \
  4294. -Wl,--wrap,avcodec_decode_subtitle2 \
  4295. -Wl,--wrap,avcodec_encode_audio2 \
  4296. -Wl,--wrap,avcodec_encode_video \
  4297. -Wl,--wrap,avcodec_encode_video2 \
  4298. -Wl,--wrap,avcodec_encode_subtitle \
  4299. -Wl,--wrap,swr_convert \
  4300. -Wl,--wrap,avresample_convert \
  4301. -Wl,--wrap,sws_scale ||
  4302. disable xmm_clobber_test
  4303. echo "X{};" > $TMPV
  4304. if test_ldflags -Wl,--version-script,$TMPV; then
  4305. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  4306. check_cc <<EOF && enable symver_asm_label
  4307. void ff_foo(void) __asm__ ("av_foo@VERSION");
  4308. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  4309. EOF
  4310. check_cc <<EOF && enable symver_gnu_asm
  4311. __asm__(".symver ff_foo,av_foo@VERSION");
  4312. void ff_foo(void) {}
  4313. EOF
  4314. fi
  4315. if [ -z "$optflags" ]; then
  4316. if enabled small; then
  4317. optflags=$cflags_size
  4318. elif enabled optimizations; then
  4319. optflags=$cflags_speed
  4320. else
  4321. optflags=$cflags_noopt
  4322. fi
  4323. fi
  4324. check_optflags(){
  4325. check_cflags "$@"
  4326. enabled lto && check_ldflags "$@"
  4327. }
  4328. if enabled lto; then
  4329. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  4330. check_cflags -flto
  4331. check_ldflags -flto $cpuflags
  4332. fi
  4333. check_optflags $optflags
  4334. check_optflags -fno-math-errno
  4335. check_optflags -fno-signed-zeros
  4336. enabled ftrapv && check_cflags -ftrapv
  4337. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  4338. int x;
  4339. EOF
  4340. if enabled icc; then
  4341. # Just warnings, no remarks
  4342. check_cflags -w1
  4343. # -wd: Disable following warnings
  4344. # 144, 167, 556: -Wno-pointer-sign
  4345. # 188: enumerated type mixed with another type
  4346. # 1292: attribute "foo" ignored
  4347. # 1419: external declaration in primary source file
  4348. # 10006: ignoring unknown option -fno-signed-zeros
  4349. # 10148: ignoring unknown option -Wno-parentheses
  4350. # 10156: ignoring option '-W'; no argument required
  4351. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156
  4352. # 11030: Warning unknown option --as-needed
  4353. # 10156: ignoring option '-export'; no argument required
  4354. check_ldflags -wd10156,11030
  4355. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  4356. enable ebp_available
  4357. if enabled x86_32; then
  4358. icc_version=$($cc -dumpversion)
  4359. test ${icc_version%%.*} -ge 11 &&
  4360. check_cflags -falign-stack=maintain-16-byte ||
  4361. disable aligned_stack
  4362. fi
  4363. elif enabled ccc; then
  4364. # disable some annoying warnings
  4365. add_cflags -msg_disable bitnotint
  4366. add_cflags -msg_disable mixfuncvoid
  4367. add_cflags -msg_disable nonstandcast
  4368. add_cflags -msg_disable unsupieee
  4369. elif enabled gcc; then
  4370. check_optflags -fno-tree-vectorize
  4371. check_cflags -Werror=implicit-function-declaration
  4372. check_cflags -Werror=missing-prototypes
  4373. check_cflags -Werror=return-type
  4374. check_cflags -Werror=vla
  4375. enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
  4376. elif enabled llvm_gcc; then
  4377. check_cflags -mllvm -stack-alignment=16
  4378. elif enabled clang; then
  4379. check_cflags -mllvm -stack-alignment=16
  4380. check_cflags -Qunused-arguments
  4381. check_cflags -Werror=implicit-function-declaration
  4382. check_cflags -Werror=missing-prototypes
  4383. check_cflags -Werror=return-type
  4384. elif enabled cparser; then
  4385. add_cflags -Wno-missing-variable-declarations
  4386. add_cflags -Wno-empty-statement
  4387. elif enabled armcc; then
  4388. # 2523: use of inline assembler is deprecated
  4389. add_cflags -W${armcc_opt},--diag_suppress=2523
  4390. add_cflags -W${armcc_opt},--diag_suppress=1207
  4391. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  4392. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  4393. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  4394. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  4395. elif enabled tms470; then
  4396. add_cflags -pds=824 -pds=837
  4397. disable inline_asm
  4398. elif enabled pathscale; then
  4399. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  4400. elif enabled_any msvc icl; then
  4401. enabled x86_32 && disable aligned_stack
  4402. enabled_all x86_32 debug && add_cflags -Oy-
  4403. enabled debug && add_ldflags -debug
  4404. enable pragma_deprecated
  4405. if enabled icl; then
  4406. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  4407. # (correctly) on icl 13.x.
  4408. check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  4409. add_cflags -Qansi-alias
  4410. # icl will pass the inline asm tests but inline asm is currently
  4411. # not supported (build will fail)
  4412. disabled inline_asm || warn "inline asm disabled due to issues with it in ICL"
  4413. disable inline_asm
  4414. fi
  4415. fi
  4416. case $as_type in
  4417. clang)
  4418. add_asflags -Qunused-arguments
  4419. ;;
  4420. esac
  4421. case $ld_type in
  4422. clang)
  4423. check_ldflags -Qunused-arguments
  4424. ;;
  4425. esac
  4426. case $target_os in
  4427. osf1)
  4428. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  4429. ;;
  4430. plan9)
  4431. add_cppflags -Dmain=plan9_main
  4432. ;;
  4433. esac
  4434. enable frame_thread_encoder
  4435. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  4436. check_deps $CONFIG_LIST \
  4437. $CONFIG_EXTRA \
  4438. $HAVE_LIST \
  4439. $ALL_COMPONENTS \
  4440. 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"
  4441. if test $target_os = "haiku"; then
  4442. disable memalign
  4443. disable posix_memalign
  4444. fi
  4445. ! enabled_any memalign posix_memalign aligned_malloc &&
  4446. enabled_any $need_memalign && enable memalign_hack
  4447. # add_dep lib dep
  4448. # -> enable ${lib}_deps_${dep}
  4449. # -> add $dep to ${lib}_deps only once
  4450. add_dep() {
  4451. lib=$1
  4452. dep=$2
  4453. enabled "${lib}_deps_${dep}" && return 0
  4454. enable "${lib}_deps_${dep}"
  4455. prepend "${lib}_deps" $dep
  4456. }
  4457. # merge deps lib components
  4458. # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
  4459. merge_deps() {
  4460. lib=$1
  4461. shift
  4462. for comp in $*; do
  4463. enabled $comp || continue
  4464. eval "dep=\"\$${comp}_deps\""
  4465. for d in $dep; do
  4466. add_dep $lib $d
  4467. done
  4468. done
  4469. }
  4470. merge_deps libavfilter $FILTER_LIST
  4471. echo "install prefix $prefix"
  4472. echo "source path $source_path"
  4473. echo "C compiler $cc"
  4474. echo "C library $libc_type"
  4475. if test "$host_cc" != "$cc"; then
  4476. echo "host C compiler $host_cc"
  4477. echo "host C library $host_libc_type"
  4478. fi
  4479. echo "ARCH $arch ($cpu)"
  4480. if test "$build_suffix" != ""; then
  4481. echo "build suffix $build_suffix"
  4482. fi
  4483. if test "$progs_suffix" != ""; then
  4484. echo "progs suffix $progs_suffix"
  4485. fi
  4486. if test "$extra_version" != ""; then
  4487. echo "version string suffix $extra_version"
  4488. fi
  4489. echo "big-endian ${bigendian-no}"
  4490. echo "runtime cpu detection ${runtime_cpudetect-no}"
  4491. if enabled x86; then
  4492. echo "${yasmexe} ${yasm-no}"
  4493. echo "MMX enabled ${mmx-no}"
  4494. echo "MMXEXT enabled ${mmxext-no}"
  4495. echo "3DNow! enabled ${amd3dnow-no}"
  4496. echo "3DNow! extended enabled ${amd3dnowext-no}"
  4497. echo "SSE enabled ${sse-no}"
  4498. echo "SSSE3 enabled ${ssse3-no}"
  4499. echo "AVX enabled ${avx-no}"
  4500. echo "XOP enabled ${xop-no}"
  4501. echo "FMA4 enabled ${fma4-no}"
  4502. echo "i686 features enabled ${i686-no}"
  4503. echo "CMOV is fast ${fast_cmov-no}"
  4504. echo "EBX available ${ebx_available-no}"
  4505. echo "EBP available ${ebp_available-no}"
  4506. fi
  4507. if enabled aarch64; then
  4508. echo "NEON enabled ${neon-no}"
  4509. echo "VFP enabled ${vfp-no}"
  4510. fi
  4511. if enabled arm; then
  4512. echo "ARMv5TE enabled ${armv5te-no}"
  4513. echo "ARMv6 enabled ${armv6-no}"
  4514. echo "ARMv6T2 enabled ${armv6t2-no}"
  4515. echo "VFP enabled ${vfp-no}"
  4516. echo "NEON enabled ${neon-no}"
  4517. echo "THUMB enabled ${thumb-no}"
  4518. fi
  4519. if enabled mips; then
  4520. echo "MIPS FPU enabled ${mipsfpu-no}"
  4521. echo "MIPS32R2 enabled ${mips32r2-no}"
  4522. echo "MIPS DSP R1 enabled ${mipsdspr1-no}"
  4523. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  4524. fi
  4525. if enabled ppc; then
  4526. echo "AltiVec enabled ${altivec-no}"
  4527. echo "PPC 4xx optimizations ${ppc4xx-no}"
  4528. echo "dcbzl available ${dcbzl-no}"
  4529. fi
  4530. if enabled sparc; then
  4531. echo "VIS enabled ${vis-no}"
  4532. fi
  4533. echo "debug symbols ${debug-no}"
  4534. echo "strip symbols ${stripping-no}"
  4535. echo "optimize for size ${small-no}"
  4536. echo "optimizations ${optimizations-no}"
  4537. echo "static ${static-no}"
  4538. echo "shared ${shared-no}"
  4539. echo "postprocessing support ${postproc-no}"
  4540. echo "new filter support ${avfilter-no}"
  4541. echo "network support ${network-no}"
  4542. echo "threading support ${thread_type-no}"
  4543. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  4544. echo "SDL support ${sdl-no}"
  4545. echo "opencl enabled ${opencl-no}"
  4546. echo "libzvbi enabled ${libzvbi-no}"
  4547. echo "texi2html enabled ${texi2html-no}"
  4548. echo "perl enabled ${perl-no}"
  4549. echo "pod2man enabled ${pod2man-no}"
  4550. echo "makeinfo enabled ${makeinfo-no}"
  4551. test -n "$random_seed" &&
  4552. echo "random seed ${random_seed}"
  4553. echo
  4554. echo "External libraries:"
  4555. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4556. echo
  4557. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  4558. echo "Enabled ${type}s:"
  4559. eval list=\$$(toupper $type)_LIST
  4560. print_enabled '_*' $list | print_3_columns
  4561. echo
  4562. done
  4563. license="LGPL version 2.1 or later"
  4564. if enabled nonfree; then
  4565. license="nonfree and unredistributable"
  4566. elif enabled gplv3; then
  4567. license="GPL version 3 or later"
  4568. elif enabled lgplv3; then
  4569. license="LGPL version 3 or later"
  4570. elif enabled gpl; then
  4571. license="GPL version 2 or later"
  4572. fi
  4573. echo "License: $license"
  4574. echo "Creating config.mak, config.h, and doc/config.texi..."
  4575. test -e Makefile || echo "include $source_path/Makefile" > Makefile
  4576. enabled stripping || strip="echo skipping strip"
  4577. config_files="$TMPH config.mak doc/config.texi"
  4578. cat > config.mak <<EOF
  4579. # Automatically generated by configure - do not modify!
  4580. ifndef FFMPEG_CONFIG_MAK
  4581. FFMPEG_CONFIG_MAK=1
  4582. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  4583. prefix=$prefix
  4584. LIBDIR=\$(DESTDIR)$libdir
  4585. SHLIBDIR=\$(DESTDIR)$shlibdir
  4586. INCDIR=\$(DESTDIR)$incdir
  4587. BINDIR=\$(DESTDIR)$bindir
  4588. DATADIR=\$(DESTDIR)$datadir
  4589. DOCDIR=\$(DESTDIR)$docdir
  4590. MANDIR=\$(DESTDIR)$mandir
  4591. SRC_PATH=$source_path
  4592. ifndef MAIN_MAKEFILE
  4593. SRC_PATH:=\$(SRC_PATH:.%=..%)
  4594. endif
  4595. CC_IDENT=$cc_ident
  4596. ARCH=$arch
  4597. CC=$cc
  4598. CXX=$cxx
  4599. AS=$as
  4600. LD=$ld
  4601. DEPCC=$dep_cc
  4602. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4603. DEPAS=$as
  4604. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4605. YASM=$yasmexe
  4606. DEPYASM=$yasmexe
  4607. AR=$ar
  4608. ARFLAGS=$arflags
  4609. AR_O=$ar_o
  4610. RANLIB=$ranlib
  4611. STRIP=$strip
  4612. CP=cp -p
  4613. LN_S=$ln_s
  4614. CPPFLAGS=$CPPFLAGS
  4615. CFLAGS=$CFLAGS
  4616. CXXFLAGS=$CXXFLAGS
  4617. ASFLAGS=$ASFLAGS
  4618. AS_C=$AS_C
  4619. AS_O=$AS_O
  4620. CC_C=$CC_C
  4621. CC_E=$CC_E
  4622. CC_O=$CC_O
  4623. CXX_C=$CXX_C
  4624. CXX_O=$CXX_O
  4625. LD_O=$LD_O
  4626. LD_LIB=$LD_LIB
  4627. LD_PATH=$LD_PATH
  4628. DLLTOOL=$dlltool
  4629. WINDRES=$windres
  4630. DEPWINDRES=$dep_cc
  4631. LDFLAGS=$LDFLAGS
  4632. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4633. ASMSTRIPFLAGS=$ASMSTRIPFLAGS
  4634. YASMFLAGS=$YASMFLAGS
  4635. BUILDSUF=$build_suffix
  4636. PROGSSUF=$progs_suffix
  4637. FULLNAME=$FULLNAME
  4638. LIBPREF=$LIBPREF
  4639. LIBSUF=$LIBSUF
  4640. LIBNAME=$LIBNAME
  4641. SLIBPREF=$SLIBPREF
  4642. SLIBSUF=$SLIBSUF
  4643. EXESUF=$EXESUF
  4644. EXTRA_VERSION=$extra_version
  4645. CCDEP=$CCDEP
  4646. CXXDEP=$CXXDEP
  4647. CCDEP_FLAGS=$CCDEP_FLAGS
  4648. ASDEP=$ASDEP
  4649. ASDEP_FLAGS=$ASDEP_FLAGS
  4650. CC_DEPFLAGS=$CC_DEPFLAGS
  4651. AS_DEPFLAGS=$AS_DEPFLAGS
  4652. HOSTCC=$host_cc
  4653. HOSTLD=$host_ld
  4654. HOSTCFLAGS=$host_cflags
  4655. HOSTCPPFLAGS=$host_cppflags
  4656. HOSTEXESUF=$HOSTEXESUF
  4657. HOSTLDFLAGS=$host_ldflags
  4658. HOSTLIBS=$host_libs
  4659. DEPHOSTCC=$host_cc
  4660. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4661. HOSTCCDEP=$HOSTCCDEP
  4662. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4663. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4664. HOSTCC_C=$HOSTCC_C
  4665. HOSTCC_O=$HOSTCC_O
  4666. HOSTLD_O=$HOSTLD_O
  4667. TARGET_EXEC=$target_exec $target_exec_args
  4668. TARGET_PATH=$target_path
  4669. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  4670. CFLAGS-ffplay=$sdl_cflags
  4671. ZLIB=$($ldflags_filter -lz)
  4672. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4673. EXTRALIBS=$extralibs
  4674. COMPAT_OBJS=$compat_objs
  4675. EXEOBJS=$exeobjs
  4676. INSTALL=$install
  4677. LIBTARGET=${LIBTARGET}
  4678. SLIBNAME=${SLIBNAME}
  4679. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4680. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4681. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4682. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4683. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4684. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4685. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4686. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4687. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  4688. NOREDZONE_FLAGS=$noredzone_flags
  4689. EOF
  4690. get_version(){
  4691. lcname=lib${1}
  4692. name=$(toupper $lcname)
  4693. file=$source_path/$lcname/version.h
  4694. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  4695. enabled raise_major && eval ${name}_VERSION_MAJOR=$((${name}_VERSION_MAJOR+100))
  4696. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  4697. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  4698. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  4699. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  4700. }
  4701. map 'get_version $v' $LIBRARY_LIST
  4702. print_program_libs(){
  4703. eval "program_libs=\$${1}_libs"
  4704. eval echo "LIBS-${1}=${program_libs}" >> config.mak
  4705. }
  4706. map 'print_program_libs $v' $PROGRAM_LIST
  4707. cat > $TMPH <<EOF
  4708. /* Automatically generated by configure - do not modify! */
  4709. #ifndef FFMPEG_CONFIG_H
  4710. #define FFMPEG_CONFIG_H
  4711. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  4712. #define FFMPEG_LICENSE "$(c_escape $license)"
  4713. #define CONFIG_THIS_YEAR 2014
  4714. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  4715. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4716. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4717. #define av_restrict $_restrict
  4718. #define EXTERN_PREFIX "${extern_prefix}"
  4719. #define EXTERN_ASM ${extern_prefix}
  4720. #define BUILDSUF "$build_suffix"
  4721. #define SLIBSUF "$SLIBSUF"
  4722. #define HAVE_MMX2 HAVE_MMXEXT
  4723. EOF
  4724. test -n "$assert_level" &&
  4725. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  4726. test -n "$malloc_prefix" &&
  4727. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4728. if enabled yasm; then
  4729. append config_files $TMPASM
  4730. printf '' >$TMPASM
  4731. fi
  4732. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  4733. mkdir -p doc
  4734. echo "@c auto-generated by configure" > doc/config.texi
  4735. print_config ARCH_ "$config_files" $ARCH_LIST
  4736. print_config HAVE_ "$config_files" $HAVE_LIST
  4737. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4738. $CONFIG_EXTRA \
  4739. $ALL_COMPONENTS \
  4740. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  4741. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  4742. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4743. cp_if_changed $TMPH config.h
  4744. touch .config
  4745. enabled yasm && cp_if_changed $TMPASM config.asm
  4746. cat > $TMPH <<EOF
  4747. /* Generated by ffconf */
  4748. #ifndef AVUTIL_AVCONFIG_H
  4749. #define AVUTIL_AVCONFIG_H
  4750. EOF
  4751. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4752. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4753. cp_if_changed $TMPH libavutil/avconfig.h
  4754. if test -n "$WARNINGS"; then
  4755. printf "\n$WARNINGS"
  4756. enabled fatal_warnings && exit 1
  4757. fi
  4758. # build pkg-config files
  4759. pkgconfig_generate(){
  4760. name=$1
  4761. shortname=${name#lib}${build_suffix}
  4762. comment=$2
  4763. version=$3
  4764. libs=$4
  4765. requires=$5
  4766. enabled ${name#lib} || return 0
  4767. mkdir -p $name
  4768. cat <<EOF > $name/$name${build_suffix}.pc
  4769. prefix=$prefix
  4770. exec_prefix=\${prefix}
  4771. libdir=$libdir
  4772. includedir=$incdir
  4773. Name: $name
  4774. Description: $comment
  4775. Version: $version
  4776. Requires: $(enabled shared || echo $requires)
  4777. Requires.private: $(enabled shared && echo $requires)
  4778. Conflicts:
  4779. Libs: -L\${libdir} $(enabled rpath && echo "-Wl,-rpath,\${libdir}") -l${shortname} $(enabled shared || echo $libs)
  4780. Libs.private: $(enabled shared && echo $libs)
  4781. Cflags: -I\${includedir}
  4782. EOF
  4783. mkdir -p doc/examples/pc-uninstalled
  4784. includedir=${source_path}
  4785. [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
  4786. cat <<EOF > doc/examples/pc-uninstalled/$name.pc
  4787. prefix=
  4788. exec_prefix=
  4789. libdir=\${pcfiledir}/../../../$name
  4790. includedir=${includedir}
  4791. Name: $name
  4792. Description: $comment
  4793. Version: $version
  4794. Requires: $requires
  4795. Conflicts:
  4796. Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4797. Cflags: -I\${includedir}
  4798. EOF
  4799. }
  4800. lavfi_libs="libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4801. enabled libavfilter_deps_avcodec && prepend lavfi_libs "libavcodec${build_suffix} = $LIBAVCODEC_VERSION,"
  4802. enabled libavfilter_deps_avformat && prepend lavfi_libs "libavformat${build_suffix} = $LIBAVFORMAT_VERSION,"
  4803. enabled libavfilter_deps_avresample && prepend lavfi_libs "libavresample${build_suffix} = $LIBAVRESAMPLE_VERSION,"
  4804. enabled libavfilter_deps_swscale && prepend lavfi_libs "libswscale${build_suffix} = $LIBSWSCALE_VERSION,"
  4805. enabled libavfilter_deps_swresample && prepend lavfi_libs "libswresample${build_suffix} = $LIBSWRESAMPLE_VERSION,"
  4806. enabled libavfilter_deps_postproc && prepend lavfi_libs "libpostproc${build_suffix} = $LIBPOSTPROC_VERSION,"
  4807. lavfi_libs=${lavfi_libs%, }
  4808. lavd_libs="libavformat${build_suffix} = $LIBAVFORMAT_VERSION"
  4809. enabled lavfi_indev && prepend lavd_libs "libavfilter${build_suffix} = $LIBAVFILTER_VERSION,"
  4810. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  4811. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4812. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec${build_suffix} = $LIBAVCODEC_VERSION"
  4813. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$lavd_libs"
  4814. pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs"
  4815. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4816. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4817. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4818. pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"