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.

5008 lines
153KB

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