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.

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