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.

4836 lines
147KB

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