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.

4965 lines
152KB

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