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.

4699 lines
142KB

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