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.

5021 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. hardened)
  2418. add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all
  2419. add_ldflags -Wl,-z,relro -Wl,-z,now
  2420. ;;
  2421. ?*)
  2422. die "Unknown toolchain $toolchain"
  2423. ;;
  2424. esac
  2425. set_default arch cc cxx pkg_config strip sysinclude target_exec target_os yasmexe
  2426. enabled cross_compile || host_cc_default=$cc
  2427. set_default host_cc
  2428. if ! $pkg_config --version >/dev/null 2>&1; then
  2429. warn "$pkg_config not found, library detection may fail."
  2430. pkg_config=false
  2431. fi
  2432. exesuf() {
  2433. case $1 in
  2434. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2435. esac
  2436. }
  2437. EXESUF=$(exesuf $target_os)
  2438. HOSTEXESUF=$(exesuf $host_os)
  2439. # set temporary file name
  2440. : ${TMPDIR:=$TEMPDIR}
  2441. : ${TMPDIR:=$TMP}
  2442. : ${TMPDIR:=/tmp}
  2443. if [ -n "$tempprefix" ] ; then
  2444. mktemp(){
  2445. echo $tempprefix.${HOSTNAME}.${UID}
  2446. }
  2447. elif ! check_cmd mktemp -u XXXXXX; then
  2448. # simple replacement for missing mktemp
  2449. # NOT SAFE FOR GENERAL USE
  2450. mktemp(){
  2451. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2452. }
  2453. fi
  2454. tmpfile(){
  2455. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2456. (set -C; exec > $tmp) 2>/dev/null ||
  2457. die "Unable to create temporary file in $TMPDIR."
  2458. append TMPFILES $tmp
  2459. eval $1=$tmp
  2460. }
  2461. trap 'rm -f -- $TMPFILES' EXIT
  2462. tmpfile TMPASM .asm
  2463. tmpfile TMPC .c
  2464. tmpfile TMPCPP .cpp
  2465. tmpfile TMPE $EXESUF
  2466. tmpfile TMPH .h
  2467. tmpfile TMPO .o
  2468. tmpfile TMPS .S
  2469. tmpfile TMPSH .sh
  2470. tmpfile TMPV .ver
  2471. unset -f mktemp
  2472. chmod +x $TMPE
  2473. # make sure we can execute files in $TMPDIR
  2474. cat > $TMPSH 2>> $logfile <<EOF
  2475. #! /bin/sh
  2476. EOF
  2477. chmod +x $TMPSH >> $logfile 2>&1
  2478. if ! $TMPSH >> $logfile 2>&1; then
  2479. cat <<EOF
  2480. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2481. variable to another directory and make sure that it is not mounted noexec.
  2482. EOF
  2483. die "Sanity test failed."
  2484. fi
  2485. ccc_flags(){
  2486. for flag; do
  2487. case $flag in
  2488. -std=c99) echo -c99 ;;
  2489. -mcpu=*) echo -arch ${flag#*=} ;;
  2490. -mieee) echo -ieee ;;
  2491. -O*|-fast) echo $flag ;;
  2492. -fno-math-errno) echo -assume nomath_errno ;;
  2493. -g) echo -g3 ;;
  2494. -Wall) echo -msg_enable level2 ;;
  2495. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2496. -Wl,*) echo $flag ;;
  2497. -f*|-W*) ;;
  2498. *) echo $flag ;;
  2499. esac
  2500. done
  2501. }
  2502. cparser_flags(){
  2503. for flag; do
  2504. case $flag in
  2505. -Wno-switch) echo -Wno-switch-enum ;;
  2506. -Wno-format-zero-length) ;;
  2507. -Wdisabled-optimization) ;;
  2508. -Wno-pointer-sign) echo -Wno-other ;;
  2509. *) echo $flag ;;
  2510. esac
  2511. done
  2512. }
  2513. msvc_common_flags(){
  2514. for flag; do
  2515. case $flag in
  2516. # In addition to specifying certain flags under the compiler
  2517. # specific filters, they must be specified here as well or else the
  2518. # generic catch all at the bottom will print the original flag.
  2519. -Wall) ;;
  2520. -std=c99) ;;
  2521. # Common flags
  2522. -fomit-frame-pointer) ;;
  2523. -g) echo -Z7 ;;
  2524. -fno-math-errno) ;;
  2525. -fno-common) ;;
  2526. -fno-signed-zeros) ;;
  2527. -fPIC) ;;
  2528. -mthumb) ;;
  2529. -march=*) ;;
  2530. -lz) echo zlib.lib ;;
  2531. -lavifil32) echo vfw32.lib ;;
  2532. -lavicap32) echo vfw32.lib user32.lib ;;
  2533. -l*) echo ${flag#-l}.lib ;;
  2534. *) echo $flag ;;
  2535. esac
  2536. done
  2537. }
  2538. msvc_flags(){
  2539. msvc_common_flags "$@"
  2540. for flag; do
  2541. case $flag in
  2542. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2543. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2544. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2545. -wd4554 \
  2546. -wd4273 ;;
  2547. esac
  2548. done
  2549. }
  2550. icl_flags(){
  2551. msvc_common_flags "$@"
  2552. for flag; do
  2553. case $flag in
  2554. # Despite what Intel's documentation says -Wall, which is supported
  2555. # on Windows, does enable remarks so disable them here.
  2556. -Wall) echo $flag -Qdiag-disable:remark ;;
  2557. -std=c99) echo -Qstd=c99 ;;
  2558. esac
  2559. done
  2560. }
  2561. pgi_flags(){
  2562. for flag; do
  2563. case $flag in
  2564. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2565. -fomit-frame-pointer) echo -Mnoframe ;;
  2566. -g) echo -gopt ;;
  2567. *) echo $flag ;;
  2568. esac
  2569. done
  2570. }
  2571. suncc_flags(){
  2572. for flag; do
  2573. case $flag in
  2574. -march=*|-mcpu=*)
  2575. case "${flag#*=}" in
  2576. native) echo -xtarget=native ;;
  2577. v9|niagara) echo -xarch=sparc ;;
  2578. ultrasparc) echo -xarch=sparcvis ;;
  2579. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2580. i586|pentium) echo -xchip=pentium ;;
  2581. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2582. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2583. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2584. pentium4*) echo -xtarget=pentium4 ;;
  2585. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2586. *-sse3) echo -xarch=sse3 ;;
  2587. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2588. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2589. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2590. amdfam10|barcelona) echo -xtarget=barcelona ;;
  2591. bdver*) echo -xarch=avx ;;
  2592. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2593. k8|opteron|athlon64|athlon-fx)
  2594. echo -xarch=sse2a ;;
  2595. athlon*) echo -xarch=pentium_proa ;;
  2596. esac
  2597. ;;
  2598. -std=c99) echo -xc99 ;;
  2599. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2600. -fPIC) echo -KPIC -xcode=pic32 ;;
  2601. -W*,*) echo $flag ;;
  2602. -f*-*|-W*|-mimpure-text) ;;
  2603. -shared) echo -G ;;
  2604. *) echo $flag ;;
  2605. esac
  2606. done
  2607. }
  2608. tms470_flags(){
  2609. for flag; do
  2610. case $flag in
  2611. -march=*|-mcpu=*)
  2612. case "${flag#*=}" in
  2613. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2614. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2615. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2616. armv6*|arm11*) echo -mv=6 ;;
  2617. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2618. echo -mv=5e ;;
  2619. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2620. esac
  2621. ;;
  2622. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2623. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2624. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2625. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2626. -msoft-float) echo --float_support=vfplib ;;
  2627. -O[0-3]|-mf=*) echo $flag ;;
  2628. -g) echo -g -mn ;;
  2629. -pds=*) echo $flag ;;
  2630. -D*|-I*) echo $flag ;;
  2631. --gcc|--abi=*) echo $flag ;;
  2632. -me) echo $flag ;;
  2633. esac
  2634. done
  2635. }
  2636. probe_cc(){
  2637. pfx=$1
  2638. _cc=$2
  2639. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2640. unset _ld_o _ldflags _ld_lib _ld_path
  2641. unset _depflags _DEPCMD _DEPFLAGS
  2642. _flags_filter=echo
  2643. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2644. _type=llvm_gcc
  2645. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2646. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2647. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2648. _cflags_speed='-O3'
  2649. _cflags_size='-Os'
  2650. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2651. _type=gcc
  2652. gcc_version=$($_cc --version | head -n1)
  2653. gcc_basever=$($_cc -dumpversion)
  2654. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2655. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2656. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2657. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2658. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2659. fi
  2660. _cflags_speed='-O3'
  2661. _cflags_size='-Os'
  2662. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2663. _type=icc
  2664. _ident=$($_cc --version | head -n1)
  2665. _depflags='-MMD'
  2666. _cflags_speed='-O3'
  2667. _cflags_size='-Os'
  2668. _cflags_noopt='-O1'
  2669. elif $_cc -v 2>&1 | grep -q xlc; then
  2670. _type=xlc
  2671. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2672. _cflags_speed='-O5'
  2673. _cflags_size='-O5 -qcompact'
  2674. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2675. _type=ccc
  2676. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2677. _DEPFLAGS='-M'
  2678. _cflags_speed='-fast'
  2679. _cflags_size='-O1'
  2680. _flags_filter=ccc_flags
  2681. elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  2682. test -d "$sysroot" || die "No valid sysroot specified."
  2683. _type=armcc
  2684. _ident=$($_cc --vsn | head -n1)
  2685. armcc_conf="$PWD/armcc.conf"
  2686. $_cc --arm_linux_configure \
  2687. --arm_linux_config_file="$armcc_conf" \
  2688. --configure_sysroot="$sysroot" \
  2689. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2690. die "Error creating armcc configuration file."
  2691. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2692. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2693. as_default="${cross_prefix}gcc"
  2694. _depflags='-MMD'
  2695. _cflags_speed='-O3'
  2696. _cflags_size='-Os'
  2697. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2698. _type=tms470
  2699. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2700. _flags='--gcc --abi=eabi -me'
  2701. _cc_e='-ppl -fe=$@'
  2702. _cc_o='-fe=$@'
  2703. _depflags='-ppa -ppd=$(@:.o=.d)'
  2704. _cflags_speed='-O3 -mf=5'
  2705. _cflags_size='-O3 -mf=2'
  2706. _flags_filter=tms470_flags
  2707. elif $_cc -v 2>&1 | grep -q clang; then
  2708. _type=clang
  2709. _ident=$($_cc --version | head -n1)
  2710. _depflags='-MMD'
  2711. _cflags_speed='-O3'
  2712. _cflags_size='-Os'
  2713. elif $_cc -V 2>&1 | grep -q Sun; then
  2714. _type=suncc
  2715. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2716. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2717. _DEPFLAGS='-xM1 -xc99'
  2718. _ldflags='-std=c99'
  2719. _cflags_speed='-O5'
  2720. _cflags_size='-O5 -xspace'
  2721. _flags_filter=suncc_flags
  2722. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2723. _type=pathscale
  2724. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2725. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2726. _cflags_speed='-O2'
  2727. _cflags_size='-Os'
  2728. _flags_filter='filter_out -Wdisabled-optimization'
  2729. elif $_cc -v 2>&1 | grep -q Open64; then
  2730. _type=open64
  2731. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2732. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2733. _cflags_speed='-O2'
  2734. _cflags_size='-Os'
  2735. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2736. elif $_cc -V 2>&1 | grep -q Portland; then
  2737. _type=pgi
  2738. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2739. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2740. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2741. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2742. _cflags_noopt="-O"
  2743. _flags_filter=pgi_flags
  2744. elif $_cc 2>&1 | grep -q Microsoft; then
  2745. _type=msvc
  2746. _ident=$($cc 2>&1 | head -n1)
  2747. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2748. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2749. _cflags_speed="-O2"
  2750. _cflags_size="-O1"
  2751. # Nonstandard output options, to avoid msys path conversion issues.
  2752. # Relies on wrapper to remap it.
  2753. if $_cc 2>&1 | grep -q Linker; then
  2754. _ld_o='-out $@'
  2755. else
  2756. _ld_o='-Fe$@'
  2757. fi
  2758. _cc_o='-Fo $@'
  2759. _cc_e='-P -Fi $@'
  2760. _flags_filter=msvc_flags
  2761. _ld_lib='lib%.a'
  2762. _ld_path='-libpath:'
  2763. _flags='-nologo'
  2764. _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2765. if [ $pfx = hostcc ]; then
  2766. append _cflags -Dsnprintf=_snprintf
  2767. fi
  2768. disable stripping
  2769. elif $_cc 2>&1 | grep -q Intel; then
  2770. _type=icl
  2771. _ident=$($cc 2>&1 | head -n1)
  2772. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  2773. # Not only is O3 broken on 13.x+ but it is slower on all previous
  2774. # versions (tested) as well.
  2775. _cflags_speed="-O2"
  2776. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  2777. # Nonstandard output options, to avoid msys path conversion issues.
  2778. # Relies on wrapper to remap it.
  2779. if $_cc 2>&1 | grep -q Linker; then
  2780. _ld_o='-out $@'
  2781. else
  2782. _ld_o='-Fe$@'
  2783. fi
  2784. _cc_o='-Fo $@'
  2785. _cc_e='-P'
  2786. _flags_filter=icl_flags
  2787. _ld_lib='lib%.a'
  2788. _ld_path='-libpath:'
  2789. # -Qdiag-error to make icl error when seeing certain unknown arguments
  2790. _flags='-nologo -Qdiag-error:4044,10157'
  2791. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
  2792. # with MSVC which enables it by default.
  2793. _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
  2794. if [ $pfx = hostcc ]; then
  2795. append _cflags -Dsnprintf=_snprintf
  2796. fi
  2797. elif $_cc --version 2>/dev/null | grep -q ^cparser; then
  2798. _type=cparser
  2799. _ident=$($_cc --version | head -n1)
  2800. _depflags='-MMD'
  2801. _cflags_speed='-O4'
  2802. _cflags_size='-O2'
  2803. _flags_filter=cparser_flags
  2804. fi
  2805. eval ${pfx}_type=\$_type
  2806. eval ${pfx}_ident=\$_ident
  2807. }
  2808. set_ccvars(){
  2809. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2810. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2811. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2812. if [ -n "$_depflags" ]; then
  2813. eval ${1}_DEPFLAGS=\$_depflags
  2814. else
  2815. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2816. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2817. eval DEP${1}FLAGS=\$_flags
  2818. fi
  2819. }
  2820. probe_cc cc "$cc"
  2821. cflags_filter=$_flags_filter
  2822. cflags_speed=$_cflags_speed
  2823. cflags_size=$_cflags_size
  2824. cflags_noopt=$_cflags_noopt
  2825. add_cflags $_flags $_cflags
  2826. cc_ldflags=$_ldflags
  2827. set_ccvars CC
  2828. probe_cc hostcc "$host_cc"
  2829. host_cflags_filter=$_flags_filter
  2830. add_host_cflags $_flags $_cflags
  2831. set_ccvars HOSTCC
  2832. test -n "$cc_type" && enable $cc_type ||
  2833. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2834. : ${as_default:=$cc}
  2835. : ${dep_cc_default:=$cc}
  2836. : ${ld_default:=$cc}
  2837. : ${host_ld_default:=$host_cc}
  2838. set_default ar as dep_cc ld host_ld
  2839. probe_cc as "$as"
  2840. asflags_filter=$_flags_filter
  2841. add_asflags $_flags $_cflags
  2842. set_ccvars AS
  2843. probe_cc ld "$ld"
  2844. ldflags_filter=$_flags_filter
  2845. add_ldflags $_flags $_ldflags
  2846. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2847. LD_O=${_ld_o-$LD_O}
  2848. LD_LIB=${_ld_lib-$LD_LIB}
  2849. LD_PATH=${_ld_path-$LD_PATH}
  2850. probe_cc hostld "$host_ld"
  2851. host_ldflags_filter=$_flags_filter
  2852. add_host_ldflags $_flags $_ldflags
  2853. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2854. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2855. probe_cc depcc "$dep_cc"
  2856. CCDEP=${_DEPCMD:-$DEPCMD}
  2857. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2858. DEPCCFLAGS=$_flags
  2859. fi
  2860. if $ar 2>&1 | grep -q Microsoft; then
  2861. arflags="-nologo"
  2862. ar_o='-out:$@'
  2863. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2864. arflags="rq"
  2865. ar_o='$@'
  2866. elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
  2867. arflags='-Xany -r -c'
  2868. ar_o='$@'
  2869. else
  2870. arflags="rc"
  2871. ar_o='$@'
  2872. fi
  2873. add_cflags $extra_cflags
  2874. add_cxxflags $extra_cxxflags
  2875. add_asflags $extra_cflags
  2876. if test -n "$sysroot"; then
  2877. case "$cc_type" in
  2878. gcc|llvm_gcc|clang)
  2879. add_cppflags --sysroot="$sysroot"
  2880. add_ldflags --sysroot="$sysroot"
  2881. ;;
  2882. tms470)
  2883. add_cppflags -I"$sysinclude"
  2884. add_ldflags --sysroot="$sysroot"
  2885. ;;
  2886. esac
  2887. fi
  2888. if test "$cpu" = host; then
  2889. enabled cross_compile &&
  2890. die "--cpu=host makes no sense when cross-compiling."
  2891. case "$cc_type" in
  2892. gcc|llvm_gcc)
  2893. check_native(){
  2894. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2895. sed -n "/cc1.*$1=/{
  2896. s/.*$1=\\([^ ]*\\).*/\\1/
  2897. p
  2898. q
  2899. }" $TMPE
  2900. }
  2901. cpu=$(check_native -march || check_native -mcpu)
  2902. ;;
  2903. esac
  2904. test "${cpu:-host}" = host &&
  2905. die "--cpu=host not supported with compiler $cc"
  2906. fi
  2907. # Deal with common $arch aliases
  2908. case "$arch" in
  2909. aarch64|arm64)
  2910. arch="aarch64"
  2911. ;;
  2912. arm*|iPad*|iPhone*)
  2913. arch="arm"
  2914. ;;
  2915. mips*|IP*)
  2916. arch="mips"
  2917. ;;
  2918. parisc*|hppa*)
  2919. arch="parisc"
  2920. ;;
  2921. "Power Macintosh"|ppc*|powerpc*)
  2922. arch="ppc"
  2923. ;;
  2924. s390|s390x)
  2925. arch="s390"
  2926. ;;
  2927. sh4|sh)
  2928. arch="sh4"
  2929. ;;
  2930. sun4u|sparc*)
  2931. arch="sparc"
  2932. ;;
  2933. tilegx|tile-gx)
  2934. arch="tilegx"
  2935. ;;
  2936. i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  2937. arch="x86"
  2938. ;;
  2939. esac
  2940. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2941. enable $arch
  2942. # Add processor-specific flags
  2943. if enabled aarch64; then
  2944. case $cpu in
  2945. armv*)
  2946. cpuflags="-march=$cpu"
  2947. ;;
  2948. *)
  2949. cpuflags="-mcpu=$cpu"
  2950. ;;
  2951. esac
  2952. elif enabled alpha; then
  2953. cpuflags="-mcpu=$cpu"
  2954. elif enabled arm; then
  2955. check_arm_arch() {
  2956. check_cpp_condition stddef.h \
  2957. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  2958. $cpuflags
  2959. }
  2960. probe_arm_arch() {
  2961. if check_arm_arch 4; then echo armv4;
  2962. elif check_arm_arch 4T; then echo armv4t;
  2963. elif check_arm_arch 5; then echo armv5;
  2964. elif check_arm_arch 5E; then echo armv5e;
  2965. elif check_arm_arch 5T; then echo armv5t;
  2966. elif check_arm_arch 5TE; then echo armv5te;
  2967. elif check_arm_arch 5TEJ; then echo armv5te;
  2968. elif check_arm_arch 6; then echo armv6;
  2969. elif check_arm_arch 6J; then echo armv6j;
  2970. elif check_arm_arch 6K; then echo armv6k;
  2971. elif check_arm_arch 6Z; then echo armv6z;
  2972. elif check_arm_arch 6ZK; then echo armv6zk;
  2973. elif check_arm_arch 6T2; then echo armv6t2;
  2974. elif check_arm_arch 7; then echo armv7;
  2975. elif check_arm_arch 7A 7_A; then echo armv7-a;
  2976. elif check_arm_arch 7R 7_R; then echo armv7-r;
  2977. elif check_arm_arch 7M 7_M; then echo armv7-m;
  2978. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  2979. elif check_arm_arch 8A 8_A; then echo armv8-a;
  2980. fi
  2981. }
  2982. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  2983. case $cpu in
  2984. armv*)
  2985. cpuflags="-march=$cpu"
  2986. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2987. ;;
  2988. *)
  2989. cpuflags="-mcpu=$cpu"
  2990. case $cpu in
  2991. cortex-a*) subarch=armv7a ;;
  2992. cortex-r*) subarch=armv7r ;;
  2993. cortex-m*) enable thumb; subarch=armv7m ;;
  2994. arm11*) subarch=armv6 ;;
  2995. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2996. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2997. *) subarch=$(probe_arm_arch) ;;
  2998. esac
  2999. ;;
  3000. esac
  3001. case "$subarch" in
  3002. armv5t*) enable fast_clz ;;
  3003. armv[6-8]*) enable fast_clz fast_unaligned ;;
  3004. esac
  3005. elif enabled avr32; then
  3006. case $cpu in
  3007. ap7[02]0[0-2])
  3008. subarch="avr32_ap"
  3009. cpuflags="-mpart=$cpu"
  3010. ;;
  3011. ap)
  3012. subarch="avr32_ap"
  3013. cpuflags="-march=$cpu"
  3014. ;;
  3015. uc3[ab]*)
  3016. subarch="avr32_uc"
  3017. cpuflags="-mcpu=$cpu"
  3018. ;;
  3019. uc)
  3020. subarch="avr32_uc"
  3021. cpuflags="-march=$cpu"
  3022. ;;
  3023. esac
  3024. elif enabled bfin; then
  3025. cpuflags="-mcpu=$cpu"
  3026. elif enabled mips; then
  3027. cpuflags="-march=$cpu"
  3028. case $cpu in
  3029. 24kc)
  3030. disable mipsfpu
  3031. disable mipsdspr1
  3032. disable mipsdspr2
  3033. ;;
  3034. 24kf*)
  3035. disable mipsdspr1
  3036. disable mipsdspr2
  3037. ;;
  3038. 24kec|34kc|1004kc)
  3039. disable mipsfpu
  3040. disable mipsdspr2
  3041. ;;
  3042. 24kef*|34kf*|1004kf*)
  3043. disable mipsdspr2
  3044. ;;
  3045. 74kc)
  3046. disable mipsfpu
  3047. ;;
  3048. esac
  3049. elif enabled ppc; then
  3050. case $(tolower $cpu) in
  3051. 601|ppc601|powerpc601)
  3052. cpuflags="-mcpu=601"
  3053. disable altivec
  3054. ;;
  3055. 603*|ppc603*|powerpc603*)
  3056. cpuflags="-mcpu=603"
  3057. disable altivec
  3058. ;;
  3059. 604*|ppc604*|powerpc604*)
  3060. cpuflags="-mcpu=604"
  3061. disable altivec
  3062. ;;
  3063. g3|75*|ppc75*|powerpc75*)
  3064. cpuflags="-mcpu=750"
  3065. disable altivec
  3066. ;;
  3067. g4|745*|ppc745*|powerpc745*)
  3068. cpuflags="-mcpu=7450"
  3069. ;;
  3070. 74*|ppc74*|powerpc74*)
  3071. cpuflags="-mcpu=7400"
  3072. ;;
  3073. g5|970|ppc970|powerpc970)
  3074. cpuflags="-mcpu=970"
  3075. ;;
  3076. power[3-7]*)
  3077. cpuflags="-mcpu=$cpu"
  3078. ;;
  3079. cell)
  3080. cpuflags="-mcpu=cell"
  3081. enable ldbrx
  3082. ;;
  3083. e500mc)
  3084. cpuflags="-mcpu=e500mc"
  3085. disable altivec
  3086. ;;
  3087. e500v2)
  3088. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  3089. disable altivec
  3090. ;;
  3091. e500)
  3092. cpuflags="-mcpu=8540 -mhard-float"
  3093. disable altivec
  3094. ;;
  3095. esac
  3096. elif enabled sparc; then
  3097. case $cpu in
  3098. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  3099. cpuflags="-mcpu=$cpu"
  3100. disable vis
  3101. ;;
  3102. ultrasparc*|niagara[234])
  3103. cpuflags="-mcpu=$cpu"
  3104. ;;
  3105. esac
  3106. elif enabled x86; then
  3107. case $cpu in
  3108. i[345]86|pentium)
  3109. cpuflags="-march=$cpu"
  3110. disable mmx
  3111. ;;
  3112. # targets that do NOT support nopl and conditional mov (cmov)
  3113. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  3114. cpuflags="-march=$cpu"
  3115. disable i686
  3116. ;;
  3117. # targets that do support nopl and conditional mov (cmov)
  3118. 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*)
  3119. cpuflags="-march=$cpu"
  3120. enable i686
  3121. enable fast_cmov
  3122. ;;
  3123. # targets that do support conditional mov but on which it's slow
  3124. pentium4|pentium4m|prescott|nocona)
  3125. cpuflags="-march=$cpu"
  3126. enable i686
  3127. disable fast_cmov
  3128. ;;
  3129. esac
  3130. fi
  3131. if [ "$cpu" != generic ]; then
  3132. add_cflags $cpuflags
  3133. add_asflags $cpuflags
  3134. fi
  3135. # compiler sanity check
  3136. check_exec <<EOF
  3137. int main(void){ return 0; }
  3138. EOF
  3139. if test "$?" != 0; then
  3140. echo "$cc is unable to create an executable file."
  3141. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3142. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3143. echo "Only do this if you know what cross compiling means."
  3144. fi
  3145. die "C compiler test failed."
  3146. fi
  3147. add_cppflags -D_ISOC99_SOURCE
  3148. add_cxxflags -D__STDC_CONSTANT_MACROS
  3149. check_cflags -std=c99
  3150. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  3151. #include <stdlib.h>
  3152. EOF
  3153. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  3154. #include <stdlib.h>
  3155. EOF
  3156. check_host_cflags -std=c99
  3157. check_host_cflags -Wall
  3158. check_64bit(){
  3159. arch32=$1
  3160. arch64=$2
  3161. expr=$3
  3162. check_code cc "" "int test[2*($expr) - 1]" &&
  3163. subarch=$arch64 || subarch=$arch32
  3164. }
  3165. case "$arch" in
  3166. aarch64|alpha|ia64)
  3167. spic=$shared
  3168. ;;
  3169. mips)
  3170. check_64bit mips mips64 '_MIPS_SIM > 1'
  3171. spic=$shared
  3172. ;;
  3173. parisc)
  3174. check_64bit parisc parisc64 'sizeof(void *) > 4'
  3175. spic=$shared
  3176. ;;
  3177. ppc)
  3178. check_64bit ppc ppc64 'sizeof(void *) > 4'
  3179. spic=$shared
  3180. ;;
  3181. sparc)
  3182. check_64bit sparc sparc64 'sizeof(void *) > 4'
  3183. spic=$shared
  3184. ;;
  3185. x86)
  3186. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  3187. if test "$subarch" = "x86_64"; then
  3188. spic=$shared
  3189. fi
  3190. ;;
  3191. ppc)
  3192. check_cc <<EOF && subarch="ppc64"
  3193. int test[(int)sizeof(char*) - 7];
  3194. EOF
  3195. ;;
  3196. esac
  3197. enable $subarch
  3198. enabled spic && enable_weak pic
  3199. # OS specific
  3200. case $target_os in
  3201. aix)
  3202. SHFLAGS=-shared
  3203. add_cppflags '-I\$(SRC_PATH)/compat/aix'
  3204. enabled shared && add_ldflags -Wl,-brtl
  3205. ;;
  3206. haiku)
  3207. prefix_default="/boot/common"
  3208. network_extralibs="-lnetwork"
  3209. host_libs=
  3210. ;;
  3211. sunos)
  3212. SHFLAGS='-shared -Wl,-h,$$(@F)'
  3213. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  3214. network_extralibs="-lsocket -lnsl"
  3215. add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  3216. # When using suncc to build, the Solaris linker will mark
  3217. # an executable with each instruction set encountered by
  3218. # the Solaris assembler. As our libraries contain their own
  3219. # guards for processor-specific code, instead suppress
  3220. # generation of the HWCAPS ELF section on Solaris x86 only.
  3221. enabled_all suncc x86 &&
  3222. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  3223. add_ldflags -Wl,-M,mapfile
  3224. nm_default='nm -P -g'
  3225. ;;
  3226. netbsd)
  3227. disable symver
  3228. oss_indev_extralibs="-lossaudio"
  3229. oss_outdev_extralibs="-lossaudio"
  3230. enabled gcc || check_ldflags -Wl,-zmuldefs
  3231. ;;
  3232. openbsd|bitrig)
  3233. disable symver
  3234. SHFLAGS='-shared'
  3235. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3236. SLIB_INSTALL_LINKS=
  3237. oss_indev_extralibs="-lossaudio"
  3238. oss_outdev_extralibs="-lossaudio"
  3239. ;;
  3240. dragonfly)
  3241. disable symver
  3242. ;;
  3243. freebsd)
  3244. ;;
  3245. bsd/os)
  3246. add_extralibs -lpoll -lgnugetopt
  3247. strip="strip -d"
  3248. ;;
  3249. darwin)
  3250. gas="gas-preprocessor.pl $cc"
  3251. enabled ppc && add_asflags -force_cpusubtype_ALL
  3252. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3253. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3254. strip="${strip} -x"
  3255. add_ldflags -Wl,-dynamic,-search_paths_first
  3256. SLIBSUF=".dylib"
  3257. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  3258. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  3259. objformat="macho"
  3260. enabled x86_64 && objformat="macho64"
  3261. enabled_any pic shared ||
  3262. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3263. ;;
  3264. mingw32*)
  3265. if test $target_os = "mingw32ce"; then
  3266. disable network
  3267. else
  3268. target_os=mingw32
  3269. fi
  3270. LIBTARGET=i386
  3271. if enabled x86_64; then
  3272. LIBTARGET="i386:x86-64"
  3273. elif enabled arm; then
  3274. LIBTARGET=arm-wince
  3275. fi
  3276. check_ldflags -Wl,--nxcompat
  3277. check_ldflags -Wl,--dynamicbase
  3278. shlibdir_default="$bindir_default"
  3279. SLIBPREF=""
  3280. SLIBSUF=".dll"
  3281. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3282. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3283. dlltool="${cross_prefix}dlltool"
  3284. if check_cmd lib.exe -list; then
  3285. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3286. if enabled x86_64; then
  3287. LIBTARGET=x64
  3288. fi
  3289. elif check_cmd $dlltool --version; then
  3290. 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)'
  3291. fi
  3292. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3293. SLIB_INSTALL_LINKS=
  3294. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3295. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3296. 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'
  3297. objformat="win32"
  3298. ranlib=:
  3299. enable dos_paths
  3300. ;;
  3301. win32|win64)
  3302. if enabled shared; then
  3303. # Link to the import library instead of the normal static library
  3304. # for shared libs.
  3305. LD_LIB='%.lib'
  3306. # Cannot build both shared and static libs with MSVC or icl.
  3307. disable static
  3308. fi
  3309. shlibdir_default="$bindir_default"
  3310. SLIBPREF=""
  3311. SLIBSUF=".dll"
  3312. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3313. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3314. SLIB_CREATE_DEF_CMD='makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3315. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3316. SLIB_INSTALL_LINKS=
  3317. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3318. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3319. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3320. objformat="win32"
  3321. ranlib=:
  3322. enable dos_paths
  3323. ;;
  3324. cygwin*)
  3325. target_os=cygwin
  3326. shlibdir_default="$bindir_default"
  3327. SLIBPREF="cyg"
  3328. SLIBSUF=".dll"
  3329. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3330. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3331. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3332. SLIB_INSTALL_LINKS=
  3333. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  3334. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  3335. objformat="win32"
  3336. enable dos_paths
  3337. ;;
  3338. *-dos|freedos|opendos)
  3339. network_extralibs="-lsocket"
  3340. objformat="coff"
  3341. enable dos_paths
  3342. add_cppflags -U__STRICT_ANSI__
  3343. ;;
  3344. linux)
  3345. enable dv1394
  3346. ;;
  3347. irix*)
  3348. target_os=irix
  3349. ranlib="echo ignoring ranlib"
  3350. ;;
  3351. os/2*)
  3352. strip="lxlite -CS"
  3353. ln_s="cp -f"
  3354. objformat="aout"
  3355. add_cppflags -D_GNU_SOURCE
  3356. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  3357. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3358. LIBSUF="_s.a"
  3359. SLIBPREF=""
  3360. SLIBSUF=".dll"
  3361. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3362. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3363. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3364. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  3365. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3366. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3367. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3368. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  3369. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3370. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3371. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3372. enable dos_paths
  3373. enable_weak os2threads
  3374. ;;
  3375. gnu/kfreebsd)
  3376. add_cppflags -D_BSD_SOURCE
  3377. ;;
  3378. gnu)
  3379. ;;
  3380. qnx)
  3381. add_cppflags -D_QNX_SOURCE
  3382. network_extralibs="-lsocket"
  3383. ;;
  3384. symbian)
  3385. SLIBSUF=".dll"
  3386. enable dos_paths
  3387. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3388. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3389. add_ldflags -Wl,--target1-abs,--no-undefined \
  3390. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3391. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3392. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3393. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3394. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3395. ;;
  3396. osf1)
  3397. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  3398. ;;
  3399. minix)
  3400. ;;
  3401. plan9)
  3402. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  3403. -D_REENTRANT_SOURCE \
  3404. -D_RESEARCH_SOURCE \
  3405. -DFD_SETSIZE=96 \
  3406. -DHAVE_SOCK_OPTS
  3407. add_compat strtod.o strtod=avpriv_strtod
  3408. network_extralibs='-lbsd'
  3409. exeobjs=compat/plan9/main.o
  3410. disable ffserver
  3411. cp_f='cp'
  3412. ;;
  3413. none)
  3414. ;;
  3415. *)
  3416. die "Unknown OS '$target_os'."
  3417. ;;
  3418. esac
  3419. # determine libc flavour
  3420. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3421. if check_cpp_condition features.h "defined __UCLIBC__"; then
  3422. libc_type=uclibc
  3423. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3424. elif check_cpp_condition features.h "defined __GLIBC__"; then
  3425. libc_type=glibc
  3426. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3427. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3428. elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3429. libc_type=newlib
  3430. add_cppflags -U__STRICT_ANSI__
  3431. elif check_header _mingw.h; then
  3432. libc_type=mingw
  3433. check_cpp_condition _mingw.h \
  3434. "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
  3435. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3436. die "ERROR: MinGW runtime version must be >= 3.15."
  3437. add_cppflags -U__STRICT_ANSI__
  3438. if check_cpp_condition _mingw.h "defined(__MINGW64_VERSION_MAJOR) && \
  3439. __MINGW64_VERSION_MAJOR < 3"; then
  3440. add_compat msvcrt/snprintf.o
  3441. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  3442. else
  3443. add_cppflags -D__USE_MINGW_ANSI_STDIO=1
  3444. fi
  3445. elif check_func_headers stdlib.h _get_doserrno; then
  3446. libc_type=msvcrt
  3447. add_compat strtod.o strtod=avpriv_strtod
  3448. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3449. _snprintf=avpriv_snprintf \
  3450. vsnprintf=avpriv_vsnprintf
  3451. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  3452. # 0x601 by default unless something else is set by the user.
  3453. # This can easily lead to us detecting functions only present
  3454. # in such new versions and producing binaries requiring windows 7.0.
  3455. # Therefore explicitly set the default to XP unless the user has
  3456. # set something else on the command line.
  3457. check_cpp_condition stdlib.h "defined(_WIN32_WINNT)" || add_cppflags -D_WIN32_WINNT=0x0502
  3458. elif check_cpp_condition stddef.h "defined __KLIBC__"; then
  3459. libc_type=klibc
  3460. elif check_cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3461. libc_type=bionic
  3462. add_compat strtod.o strtod=avpriv_strtod
  3463. fi
  3464. test -n "$libc_type" && enable $libc_type
  3465. # hacks for compiler/libc/os combinations
  3466. if enabled_all tms470 glibc; then
  3467. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3468. add_cppflags -D__USER_LABEL_PREFIX__=
  3469. add_cppflags -D__builtin_memset=memset
  3470. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3471. add_cflags -pds=48 # incompatible redefinition of macro
  3472. fi
  3473. if enabled_all ccc glibc; then
  3474. add_ldflags -Wl,-z,now # calls to libots crash without this
  3475. fi
  3476. esc(){
  3477. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3478. }
  3479. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
  3480. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3481. set_default $PATHS_LIST
  3482. set_default nm
  3483. # we need to build at least one lib type
  3484. if ! enabled_any static shared; then
  3485. cat <<EOF
  3486. At least one library type must be built.
  3487. Specify --enable-static to build the static libraries or --enable-shared to
  3488. build the shared libraries as well. To only build the shared libraries specify
  3489. --disable-static in addition to --enable-shared.
  3490. EOF
  3491. exit 1;
  3492. fi
  3493. # backward compatibility layer for incompatible_libav/fork_abi
  3494. enabled incompatible_fork_abi && enable incompatible_libav_abi
  3495. enabled incompatible_libav_abi && enable incompatible_fork_abi
  3496. die_license_disabled() {
  3497. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  3498. }
  3499. die_license_disabled_gpl() {
  3500. enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; }
  3501. }
  3502. die_license_disabled gpl frei0r
  3503. die_license_disabled gpl libcdio
  3504. die_license_disabled gpl libutvideo
  3505. die_license_disabled gpl libvidstab
  3506. die_license_disabled gpl libx264
  3507. die_license_disabled gpl libxavs
  3508. die_license_disabled gpl libxvid
  3509. die_license_disabled gpl libzvbi
  3510. die_license_disabled gpl x11grab
  3511. die_license_disabled nonfree libaacplus
  3512. die_license_disabled nonfree libfaac
  3513. enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
  3514. enabled gpl && die_license_disabled_gpl nonfree openssl
  3515. die_license_disabled version3 libopencore_amrnb
  3516. die_license_disabled version3 libopencore_amrwb
  3517. die_license_disabled version3 libvo_aacenc
  3518. die_license_disabled version3 libvo_amrwbenc
  3519. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3520. disabled optimizations || check_cflags -fomit-frame-pointer
  3521. enable_weak_pic() {
  3522. disabled pic && return
  3523. enable pic
  3524. add_cppflags -DPIC
  3525. case "$target_os" in
  3526. mingw*|cygwin*)
  3527. ;;
  3528. *)
  3529. add_cflags -fPIC
  3530. ;;
  3531. esac
  3532. add_asflags -fPIC
  3533. }
  3534. enabled pic && enable_weak_pic
  3535. check_cc <<EOF || die "Symbol mangling check failed."
  3536. int ff_extern;
  3537. EOF
  3538. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3539. extern_prefix=${sym%%ff_extern*}
  3540. check_cc <<EOF && enable_weak inline_asm
  3541. void foo(void) { __asm__ volatile ("" ::); }
  3542. EOF
  3543. _restrict=
  3544. for restrict_keyword in restrict __restrict__ __restrict; do
  3545. check_cc <<EOF && _restrict=$restrict_keyword && break
  3546. void foo(char * $restrict_keyword p);
  3547. EOF
  3548. done
  3549. check_cc <<EOF && enable pragma_deprecated
  3550. void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
  3551. EOF
  3552. check_cc <<EOF && enable attribute_packed
  3553. struct { int x; } __attribute__((packed)) x;
  3554. EOF
  3555. check_cc <<EOF && enable attribute_may_alias
  3556. union { int x; } __attribute__((may_alias)) x;
  3557. EOF
  3558. check_cc <<EOF || die "endian test failed"
  3559. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3560. EOF
  3561. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3562. check_inline_asm inline_asm_labels '"1:\n"'
  3563. if enabled alpha; then
  3564. check_cflags -mieee
  3565. elif enabled arm; then
  3566. check_cpp_condition stddef.h "defined __thumb__" && check_cc <<EOF && enable_weak thumb
  3567. float func(float a, float b){ return a+b; }
  3568. EOF
  3569. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3570. nogas=die
  3571. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3572. enable vfp_args
  3573. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  3574. case "${cross_prefix:-$cc}" in
  3575. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3576. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3577. __asm__ (".eabi_attribute 28, 1");
  3578. int main(void) { return 0; }
  3579. EOF
  3580. esac
  3581. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3582. fi
  3583. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3584. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3585. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3586. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3587. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3588. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3589. [ $target_os = linux ] ||
  3590. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3591. $ARCH_EXT_LIST_ARM
  3592. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3593. check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  3594. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  3595. elif enabled mips; then
  3596. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3597. enabled mips32r2 && add_cflags "-mips32r2" && add_asflags "-mips32r2" &&
  3598. check_inline_asm mips32r2 '"rotr $t0, $t1, 1"'
  3599. enabled mipsdspr1 && add_cflags "-mdsp" && add_asflags "-mdsp" &&
  3600. check_inline_asm mipsdspr1 '"addu.qb $t0, $t1, $t2"'
  3601. enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
  3602. check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
  3603. enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
  3604. check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"'
  3605. elif enabled parisc; then
  3606. if enabled gcc; then
  3607. case $($cc -dumpversion) in
  3608. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3609. esac
  3610. fi
  3611. elif enabled ppc; then
  3612. enable local_aligned_8 local_aligned_16
  3613. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3614. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3615. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3616. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3617. # AltiVec flags: The FSF version of GCC differs from the Apple version
  3618. if enabled altivec; then
  3619. if ! enabled_any pic ppc64; then
  3620. nogas=warn
  3621. fi
  3622. check_cflags -maltivec -mabi=altivec &&
  3623. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  3624. check_cflags -faltivec
  3625. # check if our compiler supports Motorola AltiVec C API
  3626. check_cc <<EOF || disable altivec
  3627. $inc_altivec_h
  3628. int main(void) {
  3629. vector signed int v1 = (vector signed int) { 0 };
  3630. vector signed int v2 = (vector signed int) { 1 };
  3631. v1 = vec_add(v1, v2);
  3632. return 0;
  3633. }
  3634. EOF
  3635. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3636. fi
  3637. elif enabled sparc; then
  3638. enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
  3639. elif enabled x86; then
  3640. check_builtin rdtsc intrin.h "__rdtsc()"
  3641. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3642. enable local_aligned_8 local_aligned_16
  3643. # check whether EBP is available on x86
  3644. # As 'i' is stored on the stack, this program will crash
  3645. # if the base pointer is used to access it because the
  3646. # base pointer is cleared in the inline assembly code.
  3647. check_exec_crash <<EOF && enable ebp_available
  3648. volatile int i=0;
  3649. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3650. return i;
  3651. EOF
  3652. # check whether EBX is available on x86
  3653. check_inline_asm ebx_available '""::"b"(0)' &&
  3654. check_inline_asm ebx_available '"":::"%ebx"'
  3655. # check whether xmm clobbers are supported
  3656. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3657. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3658. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3659. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3660. if ! disabled_any asm mmx yasm; then
  3661. if check_cmd $yasmexe --version; then
  3662. enabled x86_64 && yasm_extra="-m amd64"
  3663. yasm_debug="-g dwarf2"
  3664. elif check_cmd nasm -v; then
  3665. yasmexe=nasm
  3666. yasm_debug="-g -F dwarf"
  3667. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3668. fi
  3669. YASMFLAGS="-f $objformat $yasm_extra"
  3670. enabled pic && append YASMFLAGS "-DPIC"
  3671. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3672. case "$objformat" in
  3673. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3674. esac
  3675. check_yasm "movbe ecx, [5]" && enable yasm ||
  3676. die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
  3677. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx_external avresample
  3678. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  3679. check_yasm "CPU amdnop" && enable cpunop
  3680. fi
  3681. case "$cpu" in
  3682. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  3683. disable fast_clz
  3684. ;;
  3685. esac
  3686. fi
  3687. if enabled asm; then
  3688. as=${gas:=$as}
  3689. check_as <<EOF && enable gnu_as || \
  3690. $nogas "GNU assembler not found, install gas-preprocessor"
  3691. .macro m n
  3692. \n: .int 0
  3693. .endm
  3694. m x
  3695. EOF
  3696. fi
  3697. check_ldflags -Wl,--as-needed
  3698. if check_func dlopen; then
  3699. ldl=
  3700. elif check_func dlopen -ldl; then
  3701. ldl=-ldl
  3702. fi
  3703. if ! disabled network; then
  3704. check_type "sys/types.h sys/socket.h" socklen_t
  3705. check_type netdb.h "struct addrinfo"
  3706. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3707. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3708. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3709. check_type netinet/in.h "struct sockaddr_in6"
  3710. check_type poll.h "struct pollfd"
  3711. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3712. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3713. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3714. check_func getaddrinfo $network_extralibs
  3715. check_func getservbyport $network_extralibs
  3716. # Prefer arpa/inet.h over winsock2
  3717. if check_header arpa/inet.h ; then
  3718. check_func closesocket
  3719. elif check_header winsock2.h ; then
  3720. check_func_headers winsock2.h closesocket -lws2 &&
  3721. network_extralibs="-lws2" ||
  3722. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3723. network_extralibs="-lws2_32"; }
  3724. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3725. check_type ws2tcpip.h socklen_t
  3726. check_type ws2tcpip.h "struct addrinfo"
  3727. check_type ws2tcpip.h "struct group_source_req"
  3728. check_type ws2tcpip.h "struct ip_mreq_source"
  3729. check_type ws2tcpip.h "struct ipv6_mreq"
  3730. check_type winsock2.h "struct pollfd"
  3731. check_type ws2tcpip.h "struct sockaddr_in6"
  3732. check_type ws2tcpip.h "struct sockaddr_storage"
  3733. check_struct winsock2.h "struct sockaddr" sa_len
  3734. else
  3735. disable network
  3736. fi
  3737. fi
  3738. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3739. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  3740. check_func access
  3741. check_func clock_gettime || { check_func clock_gettime -lrt && add_extralibs -lrt; }
  3742. check_func fcntl
  3743. check_func fork
  3744. check_func_headers stdlib.h getenv
  3745. check_func gethrtime
  3746. check_func getopt
  3747. check_func getrusage
  3748. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3749. check_func gettimeofday
  3750. check_func inet_aton $network_extralibs
  3751. check_func isatty
  3752. check_func localtime_r
  3753. check_func ${malloc_prefix}memalign && enable memalign
  3754. check_func mkstemp
  3755. check_func mmap
  3756. check_func mprotect
  3757. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3758. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3759. check_func setrlimit
  3760. check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  3761. check_func strerror_r
  3762. check_func sched_getaffinity
  3763. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  3764. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  3765. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  3766. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  3767. check_builtin sarestart signal.h "SA_RESTART"
  3768. check_func sysconf
  3769. check_func sysctl
  3770. check_func usleep
  3771. check_func_headers conio.h kbhit
  3772. check_func_headers windows.h PeekNamedPipe
  3773. check_func_headers io.h setmode
  3774. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  3775. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3776. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3777. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3778. check_func_headers windows.h GetProcessAffinityMask
  3779. check_func_headers windows.h GetProcessTimes
  3780. check_func_headers windows.h GetSystemTimeAsFileTime
  3781. check_func_headers windows.h MapViewOfFile
  3782. check_func_headers windows.h SetConsoleTextAttribute
  3783. check_func_headers windows.h Sleep
  3784. check_func_headers windows.h VirtualAlloc
  3785. check_func_headers glob.h glob
  3786. check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
  3787. check_header cl/cl.h
  3788. check_header direct.h
  3789. check_header dlfcn.h
  3790. check_header dxva.h
  3791. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  3792. check_header io.h
  3793. check_header libcrystalhd/libcrystalhd_if.h
  3794. check_header malloc.h
  3795. check_header poll.h
  3796. check_header sys/mman.h
  3797. check_header sys/param.h
  3798. check_header sys/resource.h
  3799. check_header sys/select.h
  3800. check_header sys/time.h
  3801. check_header sys/un.h
  3802. check_header termios.h
  3803. check_header unistd.h
  3804. check_header vdpau/vdpau.h
  3805. check_header vdpau/vdpau_x11.h
  3806. check_header VideoDecodeAcceleration/VDADecoder.h
  3807. check_header windows.h
  3808. check_header X11/extensions/XvMClib.h
  3809. check_header asm/types.h
  3810. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3811. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3812. if ! disabled w32threads && ! enabled pthreads; then
  3813. check_func_headers "windows.h process.h" _beginthreadex && enable w32threads
  3814. fi
  3815. # check for some common methods of building with pthread support
  3816. # do this before the optional library checks as some of them require pthreads
  3817. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  3818. enable pthreads
  3819. if check_func pthread_create; then
  3820. :
  3821. elif check_func pthread_create -pthread; then
  3822. add_cflags -pthread
  3823. add_extralibs -pthread
  3824. elif check_func pthread_create -pthreads; then
  3825. add_cflags -pthreads
  3826. add_extralibs -pthreads
  3827. elif check_func pthread_create -lpthreadGC2; then
  3828. add_extralibs -lpthreadGC2
  3829. elif ! check_lib pthread.h pthread_create -lpthread; then
  3830. disable pthreads
  3831. fi
  3832. fi
  3833. for thread in $THREADS_LIST; do
  3834. if enabled $thread; then
  3835. test -n "$thread_type" &&
  3836. die "ERROR: Only one thread type must be selected." ||
  3837. thread_type="$thread"
  3838. fi
  3839. done
  3840. if enabled pthreads; then
  3841. check_func pthread_cancel
  3842. fi
  3843. enabled sync_val_compare_and_swap && enable atomics_gcc
  3844. enabled_all atomic_cas_ptr machine_rw_barrier && enable atomics_suncc
  3845. enabled MemoryBarrier && enable atomics_win32
  3846. check_lib math.h sin -lm && LIBM="-lm"
  3847. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  3848. atan2f_args=2
  3849. ldexpf_args=2
  3850. powf_args=2
  3851. for func in $MATH_FUNCS; do
  3852. eval check_mathfunc $func \${${func}_args:-1}
  3853. done
  3854. # these are off by default, so fail if requested and not available
  3855. enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } ||
  3856. { check_lib2 "dlfcn.h" dlopen -ldl; } ||
  3857. die "ERROR: LoadLibrary/dlopen not found for avisynth"; }
  3858. enabled fontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  3859. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3860. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3861. enabled ladspa && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; }
  3862. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  3863. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  3864. enabled libass && require_pkg_config libass ass/ass.h ass_library_init
  3865. enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray
  3866. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  3867. { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
  3868. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  3869. enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
  3870. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  3871. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  3872. 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"
  3873. enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
  3874. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  3875. enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++
  3876. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  3877. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  3878. done || die "ERROR: libgsm not found"; }
  3879. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  3880. enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
  3881. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  3882. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  3883. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  3884. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  3885. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  3886. enabled libopenjpeg && { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg ||
  3887. check_lib openjpeg.h opj_version -lopenjpeg ||
  3888. die "ERROR: libopenjpeg not found"; }
  3889. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  3890. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  3891. enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
  3892. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  3893. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  3894. enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer
  3895. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  3896. enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
  3897. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  3898. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  3899. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  3900. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
  3901. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  3902. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  3903. { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  3904. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  3905. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  3906. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  3907. enabled libvidstab && require_pkg_config vidstab vid.stab/libvidstab.h vsMotionDetectInit
  3908. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  3909. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  3910. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  3911. enabled libvpx && {
  3912. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  3913. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  3914. 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 ||
  3915. die "ERROR: libvpx encoder version must be >=0.9.7"; }
  3916. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  3917. enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } }
  3918. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  3919. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  3920. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  3921. die "ERROR: libx264 must be installed and version must be >= 0.118."; }
  3922. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  3923. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  3924. enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new
  3925. enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi
  3926. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  3927. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  3928. die "ERROR: openal not found"; } &&
  3929. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  3930. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  3931. enabled opencl && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
  3932. check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
  3933. die "ERROR: opencl not found"; } &&
  3934. { ! enabled_any w32threads os2threads ||
  3935. die "opencl currently needs --enable-pthreads or --disable-w32threads"; } &&
  3936. { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
  3937. check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
  3938. die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
  3939. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  3940. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  3941. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  3942. die "ERROR: openssl not found"; }
  3943. if enabled gnutls; then
  3944. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  3945. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  3946. fi
  3947. # libdc1394 check
  3948. if enabled libdc1394; then
  3949. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  3950. enable libdc1394_2; } ||
  3951. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  3952. enable libdc1394_1; } ||
  3953. die "ERROR: No version of libdc1394 found "
  3954. fi
  3955. SDL_CONFIG="${cross_prefix}sdl-config"
  3956. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3957. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3958. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  3959. enable sdl
  3960. else
  3961. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  3962. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  3963. sdl_libs=$("${SDL_CONFIG}" --libs)
  3964. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  3965. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3966. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  3967. enable sdl
  3968. fi
  3969. fi
  3970. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  3971. texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  3972. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  3973. perl --version > /dev/null 2>&1 && enable perl || disable perl
  3974. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  3975. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  3976. check_header linux/fb.h
  3977. check_header linux/videodev.h
  3978. check_header linux/videodev2.h
  3979. check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  3980. check_header sys/videoio.h
  3981. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  3982. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  3983. # w32api 3.12 had it defined wrong
  3984. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  3985. check_type "dshow.h" IBaseFilter
  3986. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  3987. { check_header dev/bktr/ioctl_meteor.h &&
  3988. check_header dev/bktr/ioctl_bt848.h; } ||
  3989. { check_header machine/ioctl_meteor.h &&
  3990. check_header machine/ioctl_bt848.h; } ||
  3991. { check_header dev/video/meteor/ioctl_meteor.h &&
  3992. check_header dev/video/bktr/ioctl_bt848.h; } ||
  3993. check_header dev/ic/bt8xx.h
  3994. check_header sndio.h
  3995. if check_struct sys/soundcard.h audio_buf_info bytes; then
  3996. enable_safe sys/soundcard.h
  3997. else
  3998. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  3999. #include <sys/soundcard.h>
  4000. audio_buf_info abc;
  4001. EOF
  4002. fi
  4003. check_header soundcard.h
  4004. enabled_any alsa_indev alsa_outdev &&
  4005. check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  4006. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait &&
  4007. check_func jack_port_get_latency_range -ljack
  4008. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  4009. if enabled libcdio; then
  4010. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4011. check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  4012. die "ERROR: libcdio-paranoia not found"
  4013. fi
  4014. enabled x11grab &&
  4015. require X11 X11/Xlib.h XOpenDisplay -lX11 &&
  4016. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  4017. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  4018. enabled vaapi &&
  4019. check_lib va/va.h vaInitialize -lva ||
  4020. disable vaapi
  4021. enabled vdpau &&
  4022. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  4023. disable vdpau
  4024. # Funny iconv installations are not unusual, so check it after all flags have been set
  4025. disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv
  4026. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  4027. # add some useful compiler flags if supported
  4028. check_cflags -Wdeclaration-after-statement
  4029. check_cflags -Wall
  4030. check_cflags -Wno-parentheses
  4031. check_cflags -Wno-switch
  4032. check_cflags -Wno-format-zero-length
  4033. check_cflags -Wdisabled-optimization
  4034. check_cflags -Wpointer-arith
  4035. check_cflags -Wredundant-decls
  4036. check_cflags -Wno-pointer-sign
  4037. check_cflags -Wwrite-strings
  4038. check_cflags -Wtype-limits
  4039. check_cflags -Wundef
  4040. check_cflags -Wmissing-prototypes
  4041. check_cflags -Wno-pointer-to-int-cast
  4042. check_cflags -Wstrict-prototypes
  4043. enabled extra_warnings && check_cflags -Winline
  4044. # add some linker flags
  4045. check_ldflags -Wl,--warn-common
  4046. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  4047. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  4048. enabled xmm_clobber_test &&
  4049. check_ldflags -Wl,--wrap,avcodec_open2 \
  4050. -Wl,--wrap,avcodec_decode_audio4 \
  4051. -Wl,--wrap,avcodec_decode_video2 \
  4052. -Wl,--wrap,avcodec_decode_subtitle2 \
  4053. -Wl,--wrap,avcodec_encode_audio2 \
  4054. -Wl,--wrap,avcodec_encode_video \
  4055. -Wl,--wrap,avcodec_encode_video2 \
  4056. -Wl,--wrap,avcodec_encode_subtitle \
  4057. -Wl,--wrap,sws_scale ||
  4058. disable xmm_clobber_test
  4059. echo "X{};" > $TMPV
  4060. if test_ldflags -Wl,--version-script,$TMPV; then
  4061. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  4062. check_cc <<EOF && enable symver_asm_label
  4063. void ff_foo(void) __asm__ ("av_foo@VERSION");
  4064. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  4065. EOF
  4066. check_cc <<EOF && enable symver_gnu_asm
  4067. __asm__(".symver ff_foo,av_foo@VERSION");
  4068. void ff_foo(void) {}
  4069. EOF
  4070. fi
  4071. if [ -z "$optflags" ]; then
  4072. if enabled small; then
  4073. optflags=$cflags_size
  4074. elif enabled optimizations; then
  4075. optflags=$cflags_speed
  4076. else
  4077. optflags=$cflags_noopt
  4078. fi
  4079. fi
  4080. check_optflags(){
  4081. check_cflags "$@"
  4082. enabled lto && check_ldflags "$@"
  4083. }
  4084. if enabled lto; then
  4085. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  4086. check_cflags -flto
  4087. check_ldflags -flto $cpuflags
  4088. fi
  4089. check_optflags $optflags
  4090. check_optflags -fno-math-errno
  4091. check_optflags -fno-signed-zeros
  4092. enabled ftrapv && check_cflags -ftrapv
  4093. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  4094. int x;
  4095. EOF
  4096. if enabled icc; then
  4097. # Just warnings, no remarks
  4098. check_cflags -w1
  4099. # -wd: Disable following warnings
  4100. # 144, 167, 556: -Wno-pointer-sign
  4101. # 188: enumerated type mixed with another type
  4102. # 1292: attribute "foo" ignored
  4103. # 1419: external declaration in primary source file
  4104. # 10006: ignoring unknown option -fno-signed-zeros
  4105. # 10148: ignoring unknown option -Wno-parentheses
  4106. # 10156: ignoring option '-W'; no argument required
  4107. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156
  4108. # 11030: Warning unknown option --as-needed
  4109. # 10156: ignoring option '-export'; no argument required
  4110. check_ldflags -wd10156,11030
  4111. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  4112. enable ebp_available
  4113. if enabled x86_32; then
  4114. icc_version=$($cc -dumpversion)
  4115. test ${icc_version%%.*} -ge 11 &&
  4116. check_cflags -falign-stack=maintain-16-byte ||
  4117. disable aligned_stack
  4118. fi
  4119. elif enabled ccc; then
  4120. # disable some annoying warnings
  4121. add_cflags -msg_disable bitnotint
  4122. add_cflags -msg_disable mixfuncvoid
  4123. add_cflags -msg_disable nonstandcast
  4124. add_cflags -msg_disable unsupieee
  4125. elif enabled gcc; then
  4126. check_optflags -fno-tree-vectorize
  4127. check_cflags -Werror=implicit-function-declaration
  4128. check_cflags -Werror=missing-prototypes
  4129. check_cflags -Werror=return-type
  4130. check_cflags -Werror=vla
  4131. enabled extra_warnings || check_cflags -Wno-maybe-uninitialized
  4132. elif enabled llvm_gcc; then
  4133. check_cflags -mllvm -stack-alignment=16
  4134. elif enabled clang; then
  4135. check_cflags -mllvm -stack-alignment=16
  4136. check_cflags -Qunused-arguments
  4137. check_cflags -Werror=implicit-function-declaration
  4138. check_cflags -Werror=missing-prototypes
  4139. check_cflags -Werror=return-type
  4140. elif enabled cparser; then
  4141. add_cflags -Wno-missing-variable-declarations
  4142. add_cflags -Wno-empty-statement
  4143. elif enabled armcc; then
  4144. # 2523: use of inline assembler is deprecated
  4145. add_cflags -W${armcc_opt},--diag_suppress=2523
  4146. add_cflags -W${armcc_opt},--diag_suppress=1207
  4147. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  4148. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  4149. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  4150. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  4151. elif enabled tms470; then
  4152. add_cflags -pds=824 -pds=837
  4153. elif enabled pathscale; then
  4154. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  4155. elif enabled_any msvc icl; then
  4156. enabled x86_32 && disable aligned_stack
  4157. enabled_all x86_32 debug && add_cflags -Oy-
  4158. enabled debug && add_ldflags -debug
  4159. enable pragma_deprecated
  4160. if enabled icl; then
  4161. # -Qansi-alias is basically -fstrict-aliasing, but does not work
  4162. # (correctly) on icl 13.x.
  4163. check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
  4164. add_cflags -Qansi-alias
  4165. # icl will pass the inline asm tests but inline asm is currently
  4166. # not supported (build will fail)
  4167. disabled inline_asm || warn "inline asm disabled due to issues with it in ICL"
  4168. disable inline_asm
  4169. fi
  4170. fi
  4171. case $target_os in
  4172. osf1)
  4173. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  4174. ;;
  4175. plan9)
  4176. add_cppflags -Dmain=plan9_main
  4177. ;;
  4178. esac
  4179. enable frame_thread_encoder
  4180. enabled_any $THREADS_LIST && enable threads
  4181. enabled_any $ATOMICS_LIST && enable atomics_native
  4182. 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"
  4183. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  4184. check_deps $CONFIG_LIST \
  4185. $CONFIG_EXTRA \
  4186. $HAVE_LIST \
  4187. $ALL_COMPONENTS \
  4188. if test $target_os = "haiku"; then
  4189. disable memalign
  4190. disable posix_memalign
  4191. fi
  4192. ! enabled_any memalign posix_memalign aligned_malloc &&
  4193. enabled_any $need_memalign && enable memalign_hack
  4194. # add_dep lib dep
  4195. # -> enable ${lib}_deps_${dep}
  4196. # -> add $dep to ${lib}_deps only once
  4197. add_dep() {
  4198. lib=$1
  4199. dep=$2
  4200. enabled "${lib}_deps_${dep}" && return 0
  4201. enable "${lib}_deps_${dep}"
  4202. prepend "${lib}_deps" $dep
  4203. }
  4204. # merge deps lib components
  4205. # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
  4206. merge_deps() {
  4207. lib=$1
  4208. shift
  4209. for comp in $*; do
  4210. enabled $comp || continue
  4211. eval "dep=\"\$${comp}_deps\""
  4212. for d in $dep; do
  4213. add_dep $lib $d
  4214. done
  4215. done
  4216. }
  4217. merge_deps libavfilter $FILTER_LIST
  4218. echo "install prefix $prefix"
  4219. echo "source path $source_path"
  4220. echo "C compiler $cc"
  4221. echo "ARCH $arch ($cpu)"
  4222. if test "$build_suffix" != ""; then
  4223. echo "build suffix $build_suffix"
  4224. fi
  4225. if test "$progs_suffix" != ""; then
  4226. echo "progs suffix $progs_suffix"
  4227. fi
  4228. if test "$extra_version" != ""; then
  4229. echo "version string suffix $extra_version"
  4230. fi
  4231. echo "big-endian ${bigendian-no}"
  4232. echo "runtime cpu detection ${runtime_cpudetect-no}"
  4233. if enabled x86; then
  4234. echo "${yasmexe} ${yasm-no}"
  4235. echo "MMX enabled ${mmx-no}"
  4236. echo "MMXEXT enabled ${mmxext-no}"
  4237. echo "3DNow! enabled ${amd3dnow-no}"
  4238. echo "3DNow! extended enabled ${amd3dnowext-no}"
  4239. echo "SSE enabled ${sse-no}"
  4240. echo "SSSE3 enabled ${ssse3-no}"
  4241. echo "AVX enabled ${avx-no}"
  4242. echo "FMA4 enabled ${fma4-no}"
  4243. echo "i686 features enabled ${i686-no}"
  4244. echo "CMOV is fast ${fast_cmov-no}"
  4245. echo "EBX available ${ebx_available-no}"
  4246. echo "EBP available ${ebp_available-no}"
  4247. fi
  4248. if enabled arm; then
  4249. echo "ARMv5TE enabled ${armv5te-no}"
  4250. echo "ARMv6 enabled ${armv6-no}"
  4251. echo "ARMv6T2 enabled ${armv6t2-no}"
  4252. echo "VFP enabled ${vfp-no}"
  4253. echo "NEON enabled ${neon-no}"
  4254. echo "THUMB enabled ${thumb-no}"
  4255. fi
  4256. if enabled mips; then
  4257. echo "MIPS FPU enabled ${mipsfpu-no}"
  4258. echo "MIPS32R2 enabled ${mips32r2-no}"
  4259. echo "MIPS DSP R1 enabled ${mipsdspr1-no}"
  4260. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  4261. fi
  4262. if enabled ppc; then
  4263. echo "AltiVec enabled ${altivec-no}"
  4264. echo "PPC 4xx optimizations ${ppc4xx-no}"
  4265. echo "dcbzl available ${dcbzl-no}"
  4266. fi
  4267. if enabled sparc; then
  4268. echo "VIS enabled ${vis-no}"
  4269. fi
  4270. echo "debug symbols ${debug-no}"
  4271. echo "strip symbols ${stripping-no}"
  4272. echo "optimize for size ${small-no}"
  4273. echo "optimizations ${optimizations-no}"
  4274. echo "static ${static-no}"
  4275. echo "shared ${shared-no}"
  4276. echo "postprocessing support ${postproc-no}"
  4277. echo "new filter support ${avfilter-no}"
  4278. echo "network support ${network-no}"
  4279. echo "threading support ${thread_type-no}"
  4280. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  4281. echo "SDL support ${sdl-no}"
  4282. echo "opencl enabled ${opencl-no}"
  4283. echo "libzvbi enabled ${libzvbi-no}"
  4284. echo "texi2html enabled ${texi2html-no}"
  4285. echo "perl enabled ${perl-no}"
  4286. echo "pod2man enabled ${pod2man-no}"
  4287. echo "makeinfo enabled ${makeinfo-no}"
  4288. test -n "$random_seed" &&
  4289. echo "random seed ${random_seed}"
  4290. echo
  4291. echo "External libraries:"
  4292. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4293. echo
  4294. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  4295. echo "Enabled ${type}s:"
  4296. eval list=\$$(toupper $type)_LIST
  4297. print_enabled '_*' $list | print_3_columns
  4298. echo
  4299. done
  4300. license="LGPL version 2.1 or later"
  4301. if enabled nonfree; then
  4302. license="nonfree and unredistributable"
  4303. elif enabled gplv3; then
  4304. license="GPL version 3 or later"
  4305. elif enabled lgplv3; then
  4306. license="LGPL version 3 or later"
  4307. elif enabled gpl; then
  4308. license="GPL version 2 or later"
  4309. fi
  4310. echo "License: $license"
  4311. echo "Creating config.mak, config.h, and doc/config.texi..."
  4312. test -e Makefile || $ln_s "$source_path/Makefile" .
  4313. enabled stripping || strip="echo skipping strip"
  4314. config_files="$TMPH config.mak doc/config.texi"
  4315. cat > config.mak <<EOF
  4316. # Automatically generated by configure - do not modify!
  4317. ifndef FFMPEG_CONFIG_MAK
  4318. FFMPEG_CONFIG_MAK=1
  4319. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  4320. prefix=$prefix
  4321. LIBDIR=\$(DESTDIR)$libdir
  4322. SHLIBDIR=\$(DESTDIR)$shlibdir
  4323. INCDIR=\$(DESTDIR)$incdir
  4324. BINDIR=\$(DESTDIR)$bindir
  4325. DATADIR=\$(DESTDIR)$datadir
  4326. DOCDIR=\$(DESTDIR)$docdir
  4327. MANDIR=\$(DESTDIR)$mandir
  4328. SRC_PATH=$source_path
  4329. ifndef MAIN_MAKEFILE
  4330. SRC_PATH:=\$(SRC_PATH:.%=..%)
  4331. endif
  4332. CC_IDENT=$cc_ident
  4333. ARCH=$arch
  4334. CC=$cc
  4335. CXX=$cxx
  4336. AS=$as
  4337. LD=$ld
  4338. DEPCC=$dep_cc
  4339. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4340. DEPAS=$as
  4341. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4342. YASM=$yasmexe
  4343. DEPYASM=$yasmexe
  4344. AR=$ar
  4345. ARFLAGS=$arflags
  4346. AR_O=$ar_o
  4347. RANLIB=$ranlib
  4348. STRIP=$strip
  4349. CP=cp -p
  4350. LN_S=$ln_s
  4351. CPPFLAGS=$CPPFLAGS
  4352. CFLAGS=$CFLAGS
  4353. CXXFLAGS=$CXXFLAGS
  4354. ASFLAGS=$ASFLAGS
  4355. AS_C=$AS_C
  4356. AS_O=$AS_O
  4357. CC_C=$CC_C
  4358. CC_E=$CC_E
  4359. CC_O=$CC_O
  4360. CXX_C=$CXX_C
  4361. CXX_O=$CXX_O
  4362. LD_O=$LD_O
  4363. LD_LIB=$LD_LIB
  4364. LD_PATH=$LD_PATH
  4365. DLLTOOL=$dlltool
  4366. LDFLAGS=$LDFLAGS
  4367. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4368. YASMFLAGS=$YASMFLAGS
  4369. BUILDSUF=$build_suffix
  4370. PROGSSUF=$progs_suffix
  4371. FULLNAME=$FULLNAME
  4372. LIBPREF=$LIBPREF
  4373. LIBSUF=$LIBSUF
  4374. LIBNAME=$LIBNAME
  4375. SLIBPREF=$SLIBPREF
  4376. SLIBSUF=$SLIBSUF
  4377. EXESUF=$EXESUF
  4378. EXTRA_VERSION=$extra_version
  4379. CCDEP=$CCDEP
  4380. CXXDEP=$CXXDEP
  4381. CCDEP_FLAGS=$CCDEP_FLAGS
  4382. ASDEP=$ASDEP
  4383. ASDEP_FLAGS=$ASDEP_FLAGS
  4384. CC_DEPFLAGS=$CC_DEPFLAGS
  4385. AS_DEPFLAGS=$AS_DEPFLAGS
  4386. HOSTCC=$host_cc
  4387. HOSTLD=$host_ld
  4388. HOSTCFLAGS=$host_cflags
  4389. HOSTCPPFLAGS=$host_cppflags
  4390. HOSTEXESUF=$HOSTEXESUF
  4391. HOSTLDFLAGS=$host_ldflags
  4392. HOSTLIBS=$host_libs
  4393. DEPHOSTCC=$host_cc
  4394. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4395. HOSTCCDEP=$HOSTCCDEP
  4396. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4397. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4398. HOSTCC_C=$HOSTCC_C
  4399. HOSTCC_O=$HOSTCC_O
  4400. HOSTLD_O=$HOSTLD_O
  4401. TARGET_EXEC=$target_exec $target_exec_args
  4402. TARGET_PATH=$target_path
  4403. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  4404. LIBS-ffplay=$sdl_libs
  4405. CFLAGS-ffplay=$sdl_cflags
  4406. ZLIB=$($ldflags_filter -lz)
  4407. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4408. EXTRALIBS=$extralibs
  4409. COMPAT_OBJS=$compat_objs
  4410. EXEOBJS=$exeobjs
  4411. INSTALL=$install
  4412. LIBTARGET=${LIBTARGET}
  4413. SLIBNAME=${SLIBNAME}
  4414. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4415. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4416. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4417. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4418. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4419. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4420. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4421. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4422. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  4423. NOREDZONE_FLAGS=$noredzone_flags
  4424. EOF
  4425. get_version(){
  4426. lcname=lib${1}
  4427. name=$(toupper $lcname)
  4428. file=$source_path/$lcname/version.h
  4429. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  4430. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  4431. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  4432. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  4433. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  4434. }
  4435. map 'get_version $v' $LIBRARY_LIST
  4436. cat > $TMPH <<EOF
  4437. /* Automatically generated by configure - do not modify! */
  4438. #ifndef FFMPEG_CONFIG_H
  4439. #define FFMPEG_CONFIG_H
  4440. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  4441. #define FFMPEG_LICENSE "$(c_escape $license)"
  4442. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  4443. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4444. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4445. #define av_restrict $_restrict
  4446. #define EXTERN_PREFIX "${extern_prefix}"
  4447. #define EXTERN_ASM ${extern_prefix}
  4448. #define SLIBSUF "$SLIBSUF"
  4449. #define HAVE_MMX2 HAVE_MMXEXT
  4450. EOF
  4451. test -n "$assert_level" &&
  4452. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  4453. test -n "$malloc_prefix" &&
  4454. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4455. if enabled yasm; then
  4456. append config_files $TMPASM
  4457. printf '' >$TMPASM
  4458. fi
  4459. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  4460. mkdir -p doc
  4461. echo "@c auto-generated by configure" > doc/config.texi
  4462. print_config ARCH_ "$config_files" $ARCH_LIST
  4463. print_config HAVE_ "$config_files" $HAVE_LIST
  4464. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4465. $CONFIG_EXTRA \
  4466. $ALL_COMPONENTS \
  4467. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  4468. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  4469. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4470. cp_if_changed $TMPH config.h
  4471. touch .config
  4472. enabled yasm && cp_if_changed $TMPASM config.asm
  4473. cat > $TMPH <<EOF
  4474. /* Generated by ffconf */
  4475. #ifndef AVUTIL_AVCONFIG_H
  4476. #define AVUTIL_AVCONFIG_H
  4477. EOF
  4478. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4479. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4480. cp_if_changed $TMPH libavutil/avconfig.h
  4481. if test -n "$WARNINGS"; then
  4482. printf "\n$WARNINGS"
  4483. enabled fatal_warnings && exit 1
  4484. fi
  4485. # build pkg-config files
  4486. pkgconfig_generate(){
  4487. name=$1
  4488. shortname=${name#lib}${build_suffix}
  4489. comment=$2
  4490. version=$3
  4491. libs=$4
  4492. requires=$5
  4493. enabled ${name#lib} || return 0
  4494. mkdir -p $name
  4495. cat <<EOF > $name/$name${build_suffix}.pc
  4496. prefix=$prefix
  4497. exec_prefix=\${prefix}
  4498. libdir=$libdir
  4499. includedir=$incdir
  4500. Name: $name
  4501. Description: $comment
  4502. Version: $version
  4503. Requires: $(enabled shared || echo $requires)
  4504. Requires.private: $(enabled shared && echo $requires)
  4505. Conflicts:
  4506. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4507. Libs.private: $(enabled shared && echo $libs)
  4508. Cflags: -I\${includedir}
  4509. EOF
  4510. mkdir -p doc/examples/pc-uninstalled
  4511. includedir=${source_path}
  4512. [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
  4513. cat <<EOF > doc/examples/pc-uninstalled/$name.pc
  4514. prefix=
  4515. exec_prefix=
  4516. libdir=\${pcfiledir}/../../../$name
  4517. includedir=${includedir}
  4518. Name: $name
  4519. Description: $comment
  4520. Version: $version
  4521. Requires: $requires
  4522. Conflicts:
  4523. Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4524. Cflags: -I\${includedir}
  4525. EOF
  4526. }
  4527. lavfi_libs="libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4528. enabled libavfilter_deps_avcodec && prepend lavfi_libs "libavcodec${build_suffix} = $LIBAVCODEC_VERSION,"
  4529. enabled libavfilter_deps_avformat && prepend lavfi_libs "libavformat${build_suffix} = $LIBAVFORMAT_VERSION,"
  4530. enabled libavfilter_deps_avresample && prepend lavfi_libs "libavresample${build_suffix} = $LIBAVRESAMPLE_VERSION,"
  4531. enabled libavfilter_deps_swscale && prepend lavfi_libs "libswscale${build_suffix} = $LIBSWSCALE_VERSION,"
  4532. enabled libavfilter_deps_swresample && prepend lavfi_libs "libswresample${build_suffix} = $LIBSWRESAMPLE_VERSION,"
  4533. enabled libavfilter_deps_postproc && prepend lavfi_libs "libpostproc${build_suffix} = $LIBPOSTPROC_VERSION,"
  4534. lavfi_libs=${lavfi_libs%, }
  4535. lavd_libs="libavformat${build_suffix} = $LIBAVFORMAT_VERSION"
  4536. enabled lavfi_indev && prepend lavd_libs "libavfilter${build_suffix} = $LIBAVFILTER_VERSION,"
  4537. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  4538. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4539. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec${build_suffix} = $LIBAVCODEC_VERSION"
  4540. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$lavd_libs"
  4541. pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs"
  4542. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4543. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4544. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4545. pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4546. fix_ffmpeg_remote(){
  4547. git_remote_from=$1
  4548. git_remote_to=$2
  4549. fixme_remote=$(git --git-dir=$source_path/.git --work-tree=$source_path remote -v | grep $git_remote_from | cut -f 1 | sort | uniq)
  4550. if [ "$fixme_remote" != "" ]; then
  4551. echolog "
  4552. Outdated domain in git config, the official domain for ffmpeg git is since
  4553. November 2011, source.ffmpeg.org, both the old and the new point to the same
  4554. repository and server. To update it enter the following commands:
  4555. "
  4556. for remote in $fixme_remote; do
  4557. echolog "git remote set-url $remote $git_remote_to"
  4558. done
  4559. fi
  4560. }
  4561. if test -f "$source_path/.git/config"; then
  4562. remote_from=git.videolan.org
  4563. remote_to=source.ffmpeg.org
  4564. fix_ffmpeg_remote git@$remote_from:ffmpeg git@$remote_to:ffmpeg
  4565. fix_ffmpeg_remote git://$remote_from/ffmpeg git://$remote_to/ffmpeg
  4566. fi