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.

5246 lines
163KB

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