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.

5270 lines
163KB

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