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.

4672 lines
141KB

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