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.

4653 lines
141KB

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