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.

5260 lines
163KB

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