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.

5017 lines
154KB

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