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.

5265 lines
163KB

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