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.

4895 lines
150KB

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