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.

4964 lines
152KB

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