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.

5245 lines
163KB

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