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.

5285 lines
164KB

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