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.

5016 lines
154KB

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