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.

4629 lines
139KB

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