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.

4611 lines
140KB

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