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.

5195 lines
160KB

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