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.

4862 lines
148KB

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