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.

4690 lines
141KB

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