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.

5248 lines
163KB

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