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.

5009 lines
153KB

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