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.

4704 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-libquvi enable quvi input via libquvi [no]
  201. --enable-librtmp enable RTMP[E] support via librtmp [no]
  202. --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
  203. --enable-libsoxr enable Include libsoxr resampling [no]
  204. --enable-libspeex enable Speex de/encoding via libspeex [no]
  205. --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
  206. --enable-libtheora enable Theora encoding via libtheora [no]
  207. --enable-libtwolame enable MP2 encoding via libtwolame [no]
  208. --enable-libutvideo enable Ut Video encoding and decoding via libutvideo [no]
  209. --enable-libv4l2 enable libv4l2/v4l-utils [no]
  210. --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
  211. --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
  212. --enable-libvorbis enable Vorbis en/decoding via libvorbis,
  213. native implementation exists [no]
  214. --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
  215. --enable-libx264 enable H.264 encoding via x264 [no]
  216. --enable-libxavs enable AVS encoding via xavs [no]
  217. --enable-libxvid enable Xvid encoding via xvidcore,
  218. native MPEG-4/Xvid encoder exists [no]
  219. --enable-openal enable OpenAL 1.1 capture support [no]
  220. --enable-opencl enable OpenCL code
  221. --enable-openssl enable openssl [no]
  222. --enable-x11grab enable X11 grabbing [no]
  223. --enable-zlib enable zlib [autodetect]
  224. Advanced options (experts only):
  225. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  226. --enable-cross-compile assume a cross-compiler is used
  227. --sysroot=PATH root of cross-build tree
  228. --sysinclude=PATH location of cross-build system headers
  229. --target-os=OS compiler targets OS [$target_os]
  230. --target-exec=CMD command to run executables on target
  231. --target-path=DIR path to view of build directory on target
  232. --toolchain=NAME set tool defaults according to NAME
  233. --nm=NM use nm tool NM [$nm_default]
  234. --ar=AR use archive tool AR [$ar_default]
  235. --as=AS use assembler AS [$as_default]
  236. --yasmexe=EXE use yasm-compatible assembler EXE [$yasmexe_default]
  237. --cc=CC use C compiler CC [$cc_default]
  238. --cxx=CXX use C compiler CXX [$cxx_default]
  239. --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
  240. --ld=LD use linker LD [$ld_default]
  241. --host-cc=HOSTCC use host C compiler HOSTCC
  242. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  243. --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
  244. --host-ld=HOSTLD use host linker HOSTLD
  245. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  246. --host-libs=HLIBS use libs HLIBS when linking for host
  247. --host-os=OS compiler host OS [$target_os]
  248. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  249. --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
  250. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  251. --extra-libs=ELIBS add ELIBS [$ELIBS]
  252. --extra-version=STRING version string suffix []
  253. --optflags=OPTFLAGS override optimization-related compiler flags
  254. --build-suffix=SUFFIX library name suffix []
  255. --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
  256. --progs-suffix=SUFFIX program name suffix []
  257. --arch=ARCH select architecture [$arch]
  258. --cpu=CPU select the minimum required CPU (affects
  259. instruction selection, may crash on older CPUs)
  260. --enable-pic build position-independent code
  261. --enable-sram allow use of on-chip SRAM
  262. --enable-thumb compile for Thumb instruction set
  263. --disable-symver disable symbol versioning
  264. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  265. --disable-safe-bitstream-reader
  266. disable buffer boundary checking in bitreaders
  267. (faster, but may crash)
  268. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  269. --enable-lto use link-time optimization
  270. Optimization options (experts only):
  271. --disable-asm disable all assembler optimizations
  272. --disable-altivec disable AltiVec optimizations
  273. --disable-amd3dnow disable 3DNow! optimizations
  274. --disable-amd3dnowext disable 3DNow! extended optimizations
  275. --disable-mmx disable MMX optimizations
  276. --disable-mmxext disable MMXEXT optimizations
  277. --disable-sse disable SSE optimizations
  278. --disable-sse2 disable SSE2 optimizations
  279. --disable-sse3 disable SSE3 optimizations
  280. --disable-ssse3 disable SSSE3 optimizations
  281. --disable-sse4 disable SSE4 optimizations
  282. --disable-sse42 disable SSE4.2 optimizations
  283. --disable-avx disable AVX optimizations
  284. --disable-fma4 disable FMA4 optimizations
  285. --disable-armv5te disable armv5te optimizations
  286. --disable-armv6 disable armv6 optimizations
  287. --disable-armv6t2 disable armv6t2 optimizations
  288. --disable-vfp disable VFP optimizations
  289. --disable-neon disable NEON optimizations
  290. --disable-vis disable VIS optimizations
  291. --disable-inline-asm disable use of inline assembler
  292. --disable-yasm disable use of yasm assembler
  293. --disable-mips32r2 disable MIPS32R2 optimizations
  294. --disable-mipsdspr1 disable MIPS DSP ASE R1 optimizations
  295. --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations
  296. --disable-mipsfpu disable floating point MIPS optimizations
  297. --disable-fast-unaligned consider unaligned accesses slow
  298. Developer options (useful when working on FFmpeg itself):
  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. libquvi
  1039. librtmp
  1040. libschroedinger
  1041. libsoxr
  1042. libspeex
  1043. libstagefright_h264
  1044. libtheora
  1045. libtwolame
  1046. libutvideo
  1047. libv4l2
  1048. libvo_aacenc
  1049. libvo_amrwbenc
  1050. libvorbis
  1051. libvpx
  1052. libx264
  1053. libxavs
  1054. libxvid
  1055. openal
  1056. opencl
  1057. openssl
  1058. x11grab
  1059. zlib
  1060. "
  1061. DOCUMENT_LIST="
  1062. doc
  1063. htmlpages
  1064. manpages
  1065. podpages
  1066. txtpages
  1067. "
  1068. HWACCEL_LIST="
  1069. dxva2
  1070. vaapi
  1071. vda
  1072. vdpau
  1073. "
  1074. LIBRARY_LIST="
  1075. avcodec
  1076. avdevice
  1077. avfilter
  1078. avformat
  1079. avresample
  1080. avutil
  1081. postproc
  1082. swresample
  1083. swscale
  1084. "
  1085. PROGRAM_LIST="
  1086. ffplay
  1087. ffprobe
  1088. ffserver
  1089. ffmpeg
  1090. "
  1091. CONFIG_LIST="
  1092. $COMPONENT_LIST
  1093. $DOCUMENT_LIST
  1094. $EXTERNAL_LIBRARY_LIST
  1095. $HWACCEL_LIST
  1096. $LIBRARY_LIST
  1097. $PROGRAM_LIST
  1098. dct
  1099. dwt
  1100. error_resilience
  1101. fast_unaligned
  1102. fft
  1103. ftrapv
  1104. gpl
  1105. gray
  1106. hardcoded_tables
  1107. incompatible_fork_abi
  1108. lsp
  1109. lzo
  1110. mdct
  1111. memalign_hack
  1112. memory_poisoning
  1113. network
  1114. nonfree
  1115. pic
  1116. rdft
  1117. runtime_cpudetect
  1118. safe_bitstream_reader
  1119. shared
  1120. small
  1121. sram
  1122. static
  1123. swscale_alpha
  1124. thumb
  1125. version3
  1126. xmm_clobber_test
  1127. "
  1128. THREADS_LIST='
  1129. pthreads
  1130. w32threads
  1131. os2threads
  1132. '
  1133. ATOMICS_LIST='
  1134. atomics_gcc
  1135. atomics_win32
  1136. atomics_suncc
  1137. '
  1138. ARCH_LIST='
  1139. aarch64
  1140. alpha
  1141. arm
  1142. avr32
  1143. avr32_ap
  1144. avr32_uc
  1145. bfin
  1146. ia64
  1147. m68k
  1148. mips
  1149. mips64
  1150. parisc
  1151. ppc
  1152. ppc64
  1153. s390
  1154. sh4
  1155. sparc
  1156. sparc64
  1157. tilegx
  1158. tilepro
  1159. tomi
  1160. x86
  1161. x86_32
  1162. x86_64
  1163. '
  1164. ARCH_EXT_LIST_ARM='
  1165. armv5te
  1166. armv6
  1167. armv6t2
  1168. neon
  1169. vfp
  1170. vfpv3
  1171. '
  1172. ARCH_EXT_LIST_X86='
  1173. amd3dnow
  1174. amd3dnowext
  1175. avx
  1176. fma4
  1177. mmx
  1178. mmxext
  1179. sse
  1180. sse2
  1181. sse3
  1182. sse4
  1183. sse42
  1184. ssse3
  1185. '
  1186. ARCH_EXT_LIST="
  1187. $ARCH_EXT_LIST_ARM
  1188. $ARCH_EXT_LIST_X86
  1189. altivec
  1190. ppc4xx
  1191. vis
  1192. mipsfpu
  1193. mips32r2
  1194. mipsdspr1
  1195. mipsdspr2
  1196. "
  1197. HAVE_LIST_CMDLINE='
  1198. inline_asm
  1199. symver
  1200. yasm
  1201. '
  1202. HAVE_LIST_PUB='
  1203. bigendian
  1204. fast_unaligned
  1205. incompatible_fork_abi
  1206. '
  1207. MATH_FUNCS="
  1208. atanf
  1209. atan2f
  1210. cbrt
  1211. cbrtf
  1212. cosf
  1213. exp2
  1214. exp2f
  1215. expf
  1216. isinf
  1217. isnan
  1218. ldexpf
  1219. llrint
  1220. llrintf
  1221. log2
  1222. log2f
  1223. log10f
  1224. lrint
  1225. lrintf
  1226. powf
  1227. rint
  1228. round
  1229. roundf
  1230. sinf
  1231. trunc
  1232. truncf
  1233. "
  1234. HAVE_LIST="
  1235. $ARCH_EXT_LIST
  1236. $(add_suffix _external $ARCH_EXT_LIST)
  1237. $(add_suffix _inline $ARCH_EXT_LIST)
  1238. $HAVE_LIST_CMDLINE
  1239. $HAVE_LIST_PUB
  1240. $THREADS_LIST
  1241. $ATOMICS_LIST
  1242. $MATH_FUNCS
  1243. access
  1244. aligned_malloc
  1245. aligned_stack
  1246. alsa_asoundlib_h
  1247. altivec_h
  1248. arpa_inet_h
  1249. asm_mod_q
  1250. asm_mod_y
  1251. asm_types_h
  1252. atomic_cas_ptr
  1253. atomics_native
  1254. attribute_may_alias
  1255. attribute_packed
  1256. cdio_paranoia_h
  1257. cdio_paranoia_paranoia_h
  1258. clock_gettime
  1259. closesocket
  1260. cmov
  1261. CommandLineToArgvW
  1262. cpunop
  1263. CryptGenRandom
  1264. dcbzl
  1265. dev_bktr_ioctl_bt848_h
  1266. dev_bktr_ioctl_meteor_h
  1267. dev_ic_bt8xx_h
  1268. dev_video_bktr_ioctl_bt848_h
  1269. dev_video_meteor_ioctl_meteor_h
  1270. direct_h
  1271. dlfcn_h
  1272. dlopen
  1273. dos_paths
  1274. dxva_h
  1275. ebp_available
  1276. ebx_available
  1277. fast_64bit
  1278. fast_clz
  1279. fast_cmov
  1280. fcntl
  1281. fork
  1282. getaddrinfo
  1283. gethrtime
  1284. getopt
  1285. GetProcessAffinityMask
  1286. GetProcessMemoryInfo
  1287. GetProcessTimes
  1288. GetSystemTimeAsFileTime
  1289. getrusage
  1290. getservbyport
  1291. gettimeofday
  1292. glob
  1293. gnu_as
  1294. gsm_h
  1295. ibm_asm
  1296. inet_aton
  1297. io_h
  1298. isatty
  1299. jack_port_get_latency_range
  1300. kbhit
  1301. ldbrx
  1302. libdc1394_1
  1303. libdc1394_2
  1304. local_aligned_16
  1305. local_aligned_8
  1306. localtime_r
  1307. loongson
  1308. lzo1x_999_compress
  1309. machine_ioctl_bt848_h
  1310. machine_ioctl_meteor_h
  1311. machine_rw_barrier
  1312. makeinfo
  1313. malloc_h
  1314. MapViewOfFile
  1315. memalign
  1316. MemoryBarrier
  1317. mkstemp
  1318. mm_empty
  1319. mmap
  1320. mprotect
  1321. msvcrt
  1322. nanosleep
  1323. openjpeg_1_5_openjpeg_h
  1324. PeekNamedPipe
  1325. perl
  1326. pod2man
  1327. poll_h
  1328. posix_memalign
  1329. pthread_cancel
  1330. rdtsc
  1331. rsync_contimeout
  1332. sched_getaffinity
  1333. sdl
  1334. SetConsoleTextAttribute
  1335. setmode
  1336. setrlimit
  1337. Sleep
  1338. sndio_h
  1339. socklen_t
  1340. soundcard_h
  1341. strerror_r
  1342. struct_addrinfo
  1343. struct_group_source_req
  1344. struct_ip_mreq_source
  1345. struct_ipv6_mreq
  1346. struct_pollfd
  1347. struct_rusage_ru_maxrss
  1348. struct_sctp_event_subscribe
  1349. struct_sockaddr_in6
  1350. struct_sockaddr_sa_len
  1351. struct_sockaddr_storage
  1352. struct_v4l2_frmivalenum_discrete
  1353. symver_asm_label
  1354. symver_gnu_asm
  1355. sync_val_compare_and_swap
  1356. sysconf
  1357. sysctl
  1358. sys_mman_h
  1359. sys_param_h
  1360. sys_resource_h
  1361. sys_select_h
  1362. sys_soundcard_h
  1363. sys_time_h
  1364. sys_videoio_h
  1365. termios_h
  1366. texi2html
  1367. threads
  1368. unistd_h
  1369. usleep
  1370. vfp_args
  1371. VirtualAlloc
  1372. windows_h
  1373. winsock2_h
  1374. xform_asm
  1375. xmm_clobbers
  1376. "
  1377. # options emitted with CONFIG_ prefix but not available on the command line
  1378. CONFIG_EXTRA="
  1379. aandcttables
  1380. ac3dsp
  1381. audio_frame_queue
  1382. dsputil
  1383. frame_thread_encoder
  1384. gcrypt
  1385. golomb
  1386. gplv3
  1387. h264chroma
  1388. h264dsp
  1389. h264pred
  1390. h264qpel
  1391. hpeldsp
  1392. huffman
  1393. lgplv3
  1394. lpc
  1395. mpegaudio
  1396. mpegaudiodsp
  1397. mpegvideo
  1398. mpegvideoenc
  1399. nettle
  1400. rangecoder
  1401. rtpdec
  1402. rtpenc_chain
  1403. sinewin
  1404. videodsp
  1405. vp3dsp
  1406. "
  1407. CMDLINE_SELECT="
  1408. $ARCH_EXT_LIST
  1409. $CONFIG_LIST
  1410. $HAVE_LIST_CMDLINE
  1411. $THREADS_LIST
  1412. asm
  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. libquvi_demuxer_deps="libquvi"
  1789. libschroedinger_decoder_deps="libschroedinger"
  1790. libschroedinger_encoder_deps="libschroedinger"
  1791. libspeex_decoder_deps="libspeex"
  1792. libspeex_encoder_deps="libspeex"
  1793. libspeex_encoder_select="audio_frame_queue"
  1794. libstagefright_h264_decoder_deps="libstagefright_h264"
  1795. libtheora_encoder_deps="libtheora"
  1796. libtwolame_encoder_deps="libtwolame"
  1797. libvo_aacenc_encoder_deps="libvo_aacenc"
  1798. libvo_aacenc_encoder_select="audio_frame_queue"
  1799. libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
  1800. libvorbis_decoder_deps="libvorbis"
  1801. libvorbis_encoder_deps="libvorbis"
  1802. libvorbis_encoder_select="audio_frame_queue"
  1803. libvpx_vp8_decoder_deps="libvpx"
  1804. libvpx_vp8_encoder_deps="libvpx"
  1805. libvpx_vp9_decoder_deps="libvpx"
  1806. libvpx_vp9_encoder_deps="libvpx"
  1807. libx264_encoder_deps="libx264"
  1808. libx264rgb_encoder_deps="libx264"
  1809. libxavs_encoder_deps="libxavs"
  1810. libxvid_encoder_deps="libxvid"
  1811. libutvideo_decoder_deps="libutvideo"
  1812. libutvideo_encoder_deps="libutvideo"
  1813. # demuxers / muxers
  1814. ac3_demuxer_select="ac3_parser"
  1815. asf_stream_muxer_select="asf_muxer"
  1816. avisynth_demuxer_deps="avisynth"
  1817. dirac_demuxer_select="dirac_parser"
  1818. dts_demuxer_select="dca_parser"
  1819. dtshd_demuxer_select="dca_parser"
  1820. eac3_demuxer_select="ac3_parser"
  1821. f4v_muxer_select="mov_muxer"
  1822. flac_demuxer_select="flac_parser"
  1823. ipod_muxer_select="mov_muxer"
  1824. ismv_muxer_select="mov_muxer"
  1825. libnut_demuxer_deps="libnut"
  1826. libnut_muxer_deps="libnut"
  1827. matroska_audio_muxer_select="matroska_muxer"
  1828. matroska_demuxer_suggest="bzlib lzo zlib"
  1829. mov_demuxer_suggest="zlib"
  1830. mov_muxer_select="rtpenc_chain"
  1831. mp3_demuxer_select="mpegaudio_parser"
  1832. mp4_muxer_select="mov_muxer"
  1833. mpegts_muxer_select="adts_muxer latm_muxer"
  1834. mpegtsraw_demuxer_select="mpegts_demuxer"
  1835. mxf_d10_muxer_select="mxf_muxer"
  1836. ogg_demuxer_select="golomb"
  1837. psp_muxer_select="mov_muxer"
  1838. rtp_demuxer_select="sdp_demuxer"
  1839. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1840. rtsp_demuxer_select="http_protocol rtpdec"
  1841. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
  1842. sap_demuxer_select="sdp_demuxer"
  1843. sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
  1844. sdp_demuxer_select="rtpdec"
  1845. smoothstreaming_muxer_select="ismv_muxer"
  1846. spdif_muxer_select="aac_parser"
  1847. tak_demuxer_select="tak_parser"
  1848. tg2_muxer_select="mov_muxer"
  1849. tgp_muxer_select="mov_muxer"
  1850. vobsub_demuxer_select="mpegps_demuxer"
  1851. w64_demuxer_deps="wav_demuxer"
  1852. w64_muxer_deps="wav_muxer"
  1853. # indevs / outdevs
  1854. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1855. alsa_outdev_deps="alsa_asoundlib_h"
  1856. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1857. caca_outdev_deps="libcaca"
  1858. dshow_indev_deps="IBaseFilter"
  1859. dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid"
  1860. dv1394_indev_deps="dv1394 dv_demuxer"
  1861. fbdev_indev_deps="linux_fb_h"
  1862. iec61883_indev_deps="libiec61883"
  1863. jack_indev_deps="jack_jack_h sem_timedwait"
  1864. lavfi_indev_deps="avfilter"
  1865. libcdio_indev_deps="libcdio"
  1866. libdc1394_indev_deps="libdc1394"
  1867. libv4l2_indev_deps="libv4l2"
  1868. openal_indev_deps="openal"
  1869. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1870. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1871. pulse_indev_deps="libpulse"
  1872. sdl_outdev_deps="sdl"
  1873. sndio_indev_deps="sndio_h"
  1874. sndio_outdev_deps="sndio_h"
  1875. v4l_indev_deps="linux_videodev_h"
  1876. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1877. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1878. vfwcap_indev_extralibs="-lavicap32"
  1879. x11grab_indev_deps="x11grab"
  1880. # protocols
  1881. bluray_protocol_deps="libbluray"
  1882. ffrtmpcrypt_protocol_deps="!librtmp_protocol"
  1883. ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
  1884. ffrtmpcrypt_protocol_select="tcp_protocol"
  1885. ffrtmphttp_protocol_deps="!librtmp_protocol"
  1886. ffrtmphttp_protocol_select="http_protocol"
  1887. gopher_protocol_select="network"
  1888. httpproxy_protocol_select="tcp_protocol"
  1889. http_protocol_select="tcp_protocol"
  1890. https_protocol_select="tls_protocol"
  1891. librtmp_protocol_deps="librtmp"
  1892. librtmpe_protocol_deps="librtmp"
  1893. librtmps_protocol_deps="librtmp"
  1894. librtmpt_protocol_deps="librtmp"
  1895. librtmpte_protocol_deps="librtmp"
  1896. mmsh_protocol_select="http_protocol"
  1897. mmst_protocol_select="network"
  1898. rtmp_protocol_deps="!librtmp_protocol"
  1899. rtmp_protocol_select="tcp_protocol"
  1900. rtmpe_protocol_select="ffrtmpcrypt_protocol"
  1901. rtmps_protocol_deps="!librtmp_protocol"
  1902. rtmps_protocol_select="tls_protocol"
  1903. rtmpt_protocol_select="ffrtmphttp_protocol"
  1904. rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
  1905. rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
  1906. rtp_protocol_select="udp_protocol"
  1907. sctp_protocol_deps="struct_sctp_event_subscribe"
  1908. sctp_protocol_select="network"
  1909. srtp_protocol_select="rtp_protocol"
  1910. tcp_protocol_select="network"
  1911. tls_protocol_deps_any="openssl gnutls"
  1912. tls_protocol_select="tcp_protocol"
  1913. udp_protocol_select="network"
  1914. # filters
  1915. aconvert_filter_deps="swresample"
  1916. amovie_filter_deps="avcodec avformat"
  1917. aresample_filter_deps="swresample"
  1918. ass_filter_deps="libass"
  1919. asyncts_filter_deps="avresample"
  1920. atempo_filter_deps="avcodec rdft"
  1921. blackframe_filter_deps="gpl"
  1922. boxblur_filter_deps="gpl"
  1923. colormatrix_filter_deps="gpl"
  1924. cropdetect_filter_deps="gpl"
  1925. decimate_filter_deps="gpl avcodec"
  1926. delogo_filter_deps="gpl"
  1927. deshake_filter_deps="avcodec"
  1928. drawtext_filter_deps="libfreetype"
  1929. ebur128_filter_deps="gpl"
  1930. flite_filter_deps="libflite"
  1931. frei0r_filter_deps="frei0r dlopen"
  1932. frei0r_filter_extralibs='$ldl'
  1933. frei0r_src_filter_deps="frei0r dlopen"
  1934. frei0r_src_filter_extralibs='$ldl'
  1935. geq_filter_deps="gpl"
  1936. histeq_filter_deps="gpl"
  1937. hqdn3d_filter_deps="gpl"
  1938. hue_filter_deps="gpl"
  1939. kerndeint_filter_deps="gpl"
  1940. movie_filter_deps="avcodec avformat"
  1941. mp_filter_deps="gpl avcodec swscale inline_asm"
  1942. mptestsrc_filter_deps="gpl"
  1943. negate_filter_deps="lut_filter"
  1944. noise_filter_deps="gpl"
  1945. resample_filter_deps="avresample"
  1946. ocv_filter_deps="libopencv"
  1947. pan_filter_deps="swresample"
  1948. pp_filter_deps="gpl postproc"
  1949. removelogo_filter_deps="avcodec avformat swscale"
  1950. scale_filter_deps="swscale"
  1951. smartblur_filter_deps="gpl swscale"
  1952. showspectrum_filter_deps="avcodec rdft"
  1953. stereo3d_filter_deps="gpl"
  1954. subtitles_filter_deps="avformat avcodec libass"
  1955. super2xsai_filter_deps="gpl"
  1956. tinterlace_filter_deps="gpl"
  1957. yadif_filter_deps="gpl"
  1958. pixfmts_super2xsai_test_deps="super2xsai_filter"
  1959. tinterlace_merge_test_deps="tinterlace_filter"
  1960. tinterlace_pad_test_deps="tinterlace_filter"
  1961. # libraries
  1962. avcodec_deps="avutil"
  1963. avdevice_deps="avutil avcodec avformat"
  1964. avfilter_deps="avutil"
  1965. avformat_deps="avutil avcodec"
  1966. avresample_deps="avutil"
  1967. postproc_deps="avutil gpl"
  1968. swscale_deps="avutil"
  1969. # programs
  1970. ffmpeg_deps="avcodec avfilter avformat swscale swresample"
  1971. ffmpeg_select="format_filter aformat_filter
  1972. setpts_filter null_filter anull_filter"
  1973. ffplay_deps="avcodec avformat swscale swresample sdl"
  1974. ffplay_select="rdft crop_filter"
  1975. ffprobe_deps="avcodec avformat"
  1976. ffserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
  1977. ffserver_extralibs='$ldl'
  1978. # documentation
  1979. podpages_deps="perl"
  1980. manpages_deps="perl pod2man"
  1981. htmlpages_deps="texi2html"
  1982. txtpages_deps="makeinfo"
  1983. doc_deps_any="manpages htmlpages podpages txtpages"
  1984. # default parameters
  1985. logfile="config.log"
  1986. # installation paths
  1987. prefix_default="/usr/local"
  1988. bindir_default='${prefix}/bin'
  1989. datadir_default='${prefix}/share/ffmpeg'
  1990. incdir_default='${prefix}/include'
  1991. libdir_default='${prefix}/lib'
  1992. mandir_default='${prefix}/share/man'
  1993. shlibdir_default="$libdir_default"
  1994. # toolchain
  1995. ar_default="ar"
  1996. cc_default="gcc"
  1997. cxx_default="g++"
  1998. host_cc_default="gcc"
  1999. cp_f="cp -f"
  2000. install="install"
  2001. ln_s="ln -s -f"
  2002. nm_default="nm -g"
  2003. objformat="elf"
  2004. pkg_config_default=pkg-config
  2005. ranlib="ranlib"
  2006. strip_default="strip"
  2007. yasmexe_default="yasm"
  2008. nogas=":"
  2009. # machine
  2010. arch_default=$(uname -m)
  2011. cpu="generic"
  2012. # OS
  2013. target_os_default=$(tolower $(uname -s))
  2014. host_os=$target_os_default
  2015. # configurable options
  2016. enable $PROGRAM_LIST
  2017. enable $DOCUMENT_LIST
  2018. enable $(filter_out avresample $LIBRARY_LIST)
  2019. enable stripping
  2020. enable asm
  2021. enable debug
  2022. enable doc
  2023. enable optimizations
  2024. enable runtime_cpudetect
  2025. enable safe_bitstream_reader
  2026. enable static
  2027. enable swscale_alpha
  2028. # By default, enable only those hwaccels that have no external dependencies.
  2029. enable dxva2 vdpau
  2030. # build settings
  2031. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  2032. FFSERVERLDFLAGS=-Wl,-E
  2033. LIBPREF="lib"
  2034. LIBSUF=".a"
  2035. FULLNAME='$(NAME)$(BUILDSUF)'
  2036. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  2037. SLIBPREF="lib"
  2038. SLIBSUF=".so"
  2039. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  2040. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  2041. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  2042. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  2043. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  2044. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  2045. asflags_filter=echo
  2046. cflags_filter=echo
  2047. ldflags_filter=echo
  2048. AS_C='-c'
  2049. AS_O='-o $@'
  2050. CC_C='-c'
  2051. CC_E='-E -o $@'
  2052. CC_O='-o $@'
  2053. CXX_C='-c'
  2054. CXX_O='-o $@'
  2055. LD_O='-o $@'
  2056. LD_LIB='-l%'
  2057. LD_PATH='-L'
  2058. HOSTCC_C='-c'
  2059. HOSTCC_O='-o $@'
  2060. HOSTLD_O='-o $@'
  2061. host_cflags='-O3 -g'
  2062. host_cppflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600'
  2063. host_libs='-lm'
  2064. host_cflags_filter=echo
  2065. host_ldflags_filter=echo
  2066. target_path='$(CURDIR)'
  2067. # since the object filename is not given with the -MM flag, the compiler
  2068. # is only able to print the basename, and we must add the path ourselves
  2069. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  2070. DEPFLAGS='-MM'
  2071. # find source path
  2072. if test -f configure; then
  2073. source_path=.
  2074. else
  2075. source_path=$(cd $(dirname "$0"); pwd)
  2076. echo "$source_path" | grep -q '[[:blank:]]' &&
  2077. die "Out of tree builds are impossible with whitespace in source path."
  2078. test -e "$source_path/config.h" &&
  2079. die "Out of tree builds are impossible with config.h in source dir."
  2080. fi
  2081. for v in "$@"; do
  2082. r=${v#*=}
  2083. l=${v%"$r"}
  2084. r=$(sh_quote "$r")
  2085. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  2086. done
  2087. find_things(){
  2088. thing=$1
  2089. pattern=$2
  2090. file=$source_path/$3
  2091. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  2092. }
  2093. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  2094. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  2095. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  2096. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  2097. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  2098. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  2099. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  2100. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  2101. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  2102. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  2103. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  2104. ALL_COMPONENTS="
  2105. $BSF_LIST
  2106. $DECODER_LIST
  2107. $DEMUXER_LIST
  2108. $ENCODER_LIST
  2109. $FILTER_LIST
  2110. $HWACCEL_LIST
  2111. $INDEV_LIST
  2112. $MUXER_LIST
  2113. $OUTDEV_LIST
  2114. $PARSER_LIST
  2115. $PROTOCOL_LIST
  2116. "
  2117. for n in $COMPONENT_LIST; do
  2118. v=$(toupper ${n%s})_LIST
  2119. eval enable \$$v
  2120. eval ${n}_if_any="\$$v"
  2121. done
  2122. enable $ARCH_EXT_LIST
  2123. die_unknown(){
  2124. echo "Unknown option \"$1\"."
  2125. echo "See $0 --help for available options."
  2126. exit 1
  2127. }
  2128. print_3_columns() {
  2129. cat | tr ' ' '\n' | sort | pr -r -3 -t
  2130. }
  2131. show_list() {
  2132. suffix=_$1
  2133. shift
  2134. echo $* | sed s/$suffix//g | print_3_columns
  2135. exit 0
  2136. }
  2137. rand_list(){
  2138. IFS=', '
  2139. set -- $*
  2140. unset IFS
  2141. for thing; do
  2142. comp=${thing%:*}
  2143. prob=${thing#$comp}
  2144. prob=${prob#:}
  2145. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  2146. echo "prob ${prob:-0.5}"
  2147. printf '%s\n' $comp
  2148. done
  2149. }
  2150. do_random(){
  2151. action=$1
  2152. shift
  2153. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  2154. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  2155. }
  2156. for opt do
  2157. optval="${opt#*=}"
  2158. case "$opt" in
  2159. --extra-ldflags=*)
  2160. add_ldflags $optval
  2161. ;;
  2162. --extra-libs=*)
  2163. add_extralibs $optval
  2164. ;;
  2165. --disable-devices)
  2166. disable $INDEV_LIST $OUTDEV_LIST
  2167. ;;
  2168. --enable-debug=*)
  2169. debuglevel="$optval"
  2170. ;;
  2171. --disable-programs)
  2172. disable $PROGRAM_LIST
  2173. ;;
  2174. --disable-everything)
  2175. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2176. ;;
  2177. --disable-all)
  2178. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2179. disable $LIBRARY_LIST $PROGRAM_LIST doc
  2180. ;;
  2181. --enable-random|--disable-random)
  2182. action=${opt%%-random}
  2183. do_random ${action#--} $COMPONENT_LIST
  2184. ;;
  2185. --enable-random=*|--disable-random=*)
  2186. action=${opt%%-random=*}
  2187. do_random ${action#--} $optval
  2188. ;;
  2189. --enable-*=*|--disable-*=*)
  2190. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  2191. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  2192. eval list=\$$(toupper $thing)_LIST
  2193. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  2194. list=$(filter "$name" $list)
  2195. [ "$list" = "" ] && warn "Option $opt did not match anything"
  2196. $action $list
  2197. ;;
  2198. --enable-?*|--disable-?*)
  2199. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  2200. if is_in $option $COMPONENT_LIST; then
  2201. test $action = disable && action=unset
  2202. eval $action \$$(toupper ${option%s})_LIST
  2203. elif is_in $option $CMDLINE_SELECT; then
  2204. $action $option
  2205. else
  2206. die_unknown $opt
  2207. fi
  2208. ;;
  2209. --list-*)
  2210. NAME="${opt#--list-}"
  2211. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  2212. NAME=${NAME%s}
  2213. eval show_list $NAME \$$(toupper $NAME)_LIST
  2214. ;;
  2215. --help|-h) show_help
  2216. ;;
  2217. --fatal-warnings) enable fatal_warnings
  2218. ;;
  2219. *)
  2220. optname="${opt%%=*}"
  2221. optname="${optname#--}"
  2222. optname=$(echo "$optname" | sed 's/-/_/g')
  2223. if is_in $optname $CMDLINE_SET; then
  2224. eval $optname='$optval'
  2225. elif is_in $optname $CMDLINE_APPEND; then
  2226. append $optname "$optval"
  2227. else
  2228. die_unknown $opt
  2229. fi
  2230. ;;
  2231. esac
  2232. done
  2233. disabled logging && logfile=/dev/null
  2234. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  2235. set >> $logfile
  2236. test -n "$cross_prefix" && enable cross_compile
  2237. if enabled cross_compile; then
  2238. test -n "$arch" && test -n "$target_os" ||
  2239. die "Must specify target arch and OS when cross-compiling"
  2240. fi
  2241. ar_default="${cross_prefix}${ar_default}"
  2242. cc_default="${cross_prefix}${cc_default}"
  2243. cxx_default="${cross_prefix}${cxx_default}"
  2244. nm_default="${cross_prefix}${nm_default}"
  2245. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2246. ranlib="${cross_prefix}${ranlib}"
  2247. strip_default="${cross_prefix}${strip_default}"
  2248. sysinclude_default="${sysroot}/usr/include"
  2249. case "$toolchain" in
  2250. clang-asan)
  2251. cc_default="clang"
  2252. add_cflags -fsanitize=address
  2253. add_ldflags -fsanitize=address
  2254. ;;
  2255. clang-tsan)
  2256. cc_default="clang"
  2257. add_cflags -fsanitize=thread -pie
  2258. add_ldflags -fsanitize=thread -pie
  2259. ;;
  2260. msvc)
  2261. cc_default="c99wrap cl"
  2262. ld_default="c99wrap link"
  2263. nm_default="dumpbin -symbols"
  2264. ar_default="lib"
  2265. target_os_default="win32"
  2266. ;;
  2267. gcov)
  2268. add_cflags -fprofile-arcs -ftest-coverage
  2269. add_ldflags -fprofile-arcs -ftest-coverage
  2270. ;;
  2271. ?*)
  2272. die "Unknown toolchain $toolchain"
  2273. ;;
  2274. esac
  2275. set_default arch cc cxx pkg_config strip sysinclude target_os yasmexe
  2276. enabled cross_compile || host_cc_default=$cc
  2277. set_default host_cc
  2278. if ! $pkg_config --version >/dev/null 2>&1; then
  2279. warn "$pkg_config not found, library detection may fail."
  2280. pkg_config=false
  2281. fi
  2282. exesuf() {
  2283. case $1 in
  2284. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2285. esac
  2286. }
  2287. EXESUF=$(exesuf $target_os)
  2288. HOSTEXESUF=$(exesuf $host_os)
  2289. # set temporary file name
  2290. : ${TMPDIR:=$TEMPDIR}
  2291. : ${TMPDIR:=$TMP}
  2292. : ${TMPDIR:=/tmp}
  2293. if ! check_cmd mktemp -u XXXXXX; then
  2294. # simple replacement for missing mktemp
  2295. # NOT SAFE FOR GENERAL USE
  2296. mktemp(){
  2297. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2298. }
  2299. fi
  2300. tmpfile(){
  2301. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2302. (set -C; exec > $tmp) 2>/dev/null ||
  2303. die "Unable to create temporary file in $TMPDIR."
  2304. append TMPFILES $tmp
  2305. eval $1=$tmp
  2306. }
  2307. trap 'rm -f -- $TMPFILES' EXIT
  2308. tmpfile TMPASM .asm
  2309. tmpfile TMPC .c
  2310. tmpfile TMPCPP .cpp
  2311. tmpfile TMPE $EXESUF
  2312. tmpfile TMPH .h
  2313. tmpfile TMPO .o
  2314. tmpfile TMPS .S
  2315. tmpfile TMPSH .sh
  2316. tmpfile TMPV .ver
  2317. unset -f mktemp
  2318. chmod +x $TMPE
  2319. # make sure we can execute files in $TMPDIR
  2320. cat > $TMPSH 2>> $logfile <<EOF
  2321. #! /bin/sh
  2322. EOF
  2323. chmod +x $TMPSH >> $logfile 2>&1
  2324. if ! $TMPSH >> $logfile 2>&1; then
  2325. cat <<EOF
  2326. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2327. variable to another directory and make sure that it is not mounted noexec.
  2328. EOF
  2329. die "Sanity test failed."
  2330. fi
  2331. ccc_flags(){
  2332. for flag; do
  2333. case $flag in
  2334. -std=c99) echo -c99 ;;
  2335. -mcpu=*) echo -arch ${flag#*=} ;;
  2336. -mieee) echo -ieee ;;
  2337. -O*|-fast) echo $flag ;;
  2338. -fno-math-errno) echo -assume nomath_errno ;;
  2339. -g) echo -g3 ;;
  2340. -Wall) echo -msg_enable level2 ;;
  2341. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2342. -Wl,*) echo $flag ;;
  2343. -f*|-W*) ;;
  2344. *) echo $flag ;;
  2345. esac
  2346. done
  2347. }
  2348. msvc_flags(){
  2349. for flag; do
  2350. case $flag in
  2351. -fomit-frame-pointer) echo -Oy ;;
  2352. -g) echo -Z7 ;;
  2353. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2354. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2355. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2356. -wd4554 \
  2357. -wd4996 -wd4273 ;;
  2358. -std=c99) ;;
  2359. -fno-math-errno) ;;
  2360. -fno-common) ;;
  2361. -fno-signed-zeros) ;;
  2362. -fPIC) ;;
  2363. -lz) echo zlib.lib ;;
  2364. -lavifil32) echo vfw32.lib ;;
  2365. -lavicap32) echo vfw32.lib user32.lib ;;
  2366. -l*) echo ${flag#-l}.lib ;;
  2367. *) echo $flag ;;
  2368. esac
  2369. done
  2370. }
  2371. pgi_flags(){
  2372. for flag; do
  2373. case $flag in
  2374. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2375. -fomit-frame-pointer) echo -Mnoframe ;;
  2376. -g) echo -gopt ;;
  2377. *) echo $flag ;;
  2378. esac
  2379. done
  2380. }
  2381. suncc_flags(){
  2382. for flag; do
  2383. case $flag in
  2384. -march=*|-mcpu=*)
  2385. case "${flag#*=}" in
  2386. native) echo -xtarget=native ;;
  2387. v9|niagara) echo -xarch=sparc ;;
  2388. ultrasparc) echo -xarch=sparcvis ;;
  2389. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2390. i586|pentium) echo -xchip=pentium ;;
  2391. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2392. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2393. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2394. pentium4*) echo -xtarget=pentium4 ;;
  2395. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2396. *-sse3) echo -xarch=sse3 ;;
  2397. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2398. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2399. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2400. amdfam10|barcelona) echo -xtarget=barcelona ;;
  2401. bdver*) echo -xarch=avx ;;
  2402. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2403. k8|opteron|athlon64|athlon-fx)
  2404. echo -xarch=sse2a ;;
  2405. athlon*) echo -xarch=pentium_proa ;;
  2406. esac
  2407. ;;
  2408. -std=c99) echo -xc99 ;;
  2409. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2410. -fPIC) echo -KPIC -xcode=pic32 ;;
  2411. -W*,*) echo $flag ;;
  2412. -f*-*|-W*|-mimpure-text) ;;
  2413. -shared) echo -G ;;
  2414. *) echo $flag ;;
  2415. esac
  2416. done
  2417. }
  2418. tms470_flags(){
  2419. for flag; do
  2420. case $flag in
  2421. -march=*|-mcpu=*)
  2422. case "${flag#*=}" in
  2423. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2424. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2425. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2426. armv6*|arm11*) echo -mv=6 ;;
  2427. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2428. echo -mv=5e ;;
  2429. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2430. esac
  2431. ;;
  2432. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2433. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2434. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2435. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2436. -msoft-float) echo --float_support=vfplib ;;
  2437. -O[0-3]|-mf=*) echo $flag ;;
  2438. -g) echo -g -mn ;;
  2439. -pds=*) echo $flag ;;
  2440. -D*|-I*) echo $flag ;;
  2441. --gcc|--abi=*) echo $flag ;;
  2442. -me) echo $flag ;;
  2443. esac
  2444. done
  2445. }
  2446. probe_cc(){
  2447. pfx=$1
  2448. _cc=$2
  2449. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2450. unset _ld_o _ldflags _ld_lib _ld_path
  2451. unset _depflags _DEPCMD _DEPFLAGS
  2452. _flags_filter=echo
  2453. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2454. _type=llvm_gcc
  2455. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2456. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2457. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2458. _cflags_speed='-O3'
  2459. _cflags_size='-Os'
  2460. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2461. _type=gcc
  2462. gcc_version=$($_cc --version | head -n1)
  2463. gcc_basever=$($_cc -dumpversion)
  2464. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2465. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2466. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2467. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2468. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2469. fi
  2470. _cflags_speed='-O3'
  2471. _cflags_size='-Os'
  2472. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2473. _type=icc
  2474. _ident=$($_cc --version | head -n1)
  2475. _depflags='-MMD'
  2476. _cflags_speed='-O3'
  2477. _cflags_size='-Os'
  2478. _cflags_noopt='-O1'
  2479. elif $_cc -v 2>&1 | grep -q xlc; then
  2480. _type=xlc
  2481. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2482. _cflags_speed='-O5'
  2483. _cflags_size='-O5 -qcompact'
  2484. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2485. _type=ccc
  2486. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2487. _DEPFLAGS='-M'
  2488. _cflags_speed='-fast'
  2489. _cflags_size='-O1'
  2490. _flags_filter=ccc_flags
  2491. elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  2492. test -d "$sysroot" || die "No valid sysroot specified."
  2493. _type=armcc
  2494. _ident=$($_cc --vsn | head -n1)
  2495. armcc_conf="$PWD/armcc.conf"
  2496. $_cc --arm_linux_configure \
  2497. --arm_linux_config_file="$armcc_conf" \
  2498. --configure_sysroot="$sysroot" \
  2499. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2500. die "Error creating armcc configuration file."
  2501. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2502. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2503. as_default="${cross_prefix}gcc"
  2504. _depflags='-MMD'
  2505. _cflags_speed='-O3'
  2506. _cflags_size='-Os'
  2507. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2508. _type=tms470
  2509. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2510. _flags='--gcc --abi=eabi -me'
  2511. _cc_e='-ppl -fe=$@'
  2512. _cc_o='-fe=$@'
  2513. _depflags='-ppa -ppd=$(@:.o=.d)'
  2514. _cflags_speed='-O3 -mf=5'
  2515. _cflags_size='-O3 -mf=2'
  2516. _flags_filter=tms470_flags
  2517. elif $_cc -v 2>&1 | grep -q clang; then
  2518. _type=clang
  2519. _ident=$($_cc --version | head -n1)
  2520. _depflags='-MMD'
  2521. _cflags_speed='-O3'
  2522. _cflags_size='-Os'
  2523. elif $_cc -V 2>&1 | grep -q Sun; then
  2524. _type=suncc
  2525. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2526. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2527. _DEPFLAGS='-xM1 -xc99'
  2528. _ldflags='-std=c99'
  2529. _cflags_speed='-O5'
  2530. _cflags_size='-O5 -xspace'
  2531. _flags_filter=suncc_flags
  2532. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2533. _type=pathscale
  2534. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2535. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2536. _cflags_speed='-O2'
  2537. _cflags_size='-Os'
  2538. _flags_filter='filter_out -Wdisabled-optimization'
  2539. elif $_cc -v 2>&1 | grep -q Open64; then
  2540. _type=open64
  2541. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2542. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2543. _cflags_speed='-O2'
  2544. _cflags_size='-Os'
  2545. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2546. elif $_cc -V 2>&1 | grep -q Portland; then
  2547. _type=pgi
  2548. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2549. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2550. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2551. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2552. _cflags_noopt="-O1"
  2553. _flags_filter=pgi_flags
  2554. elif $_cc 2>&1 | grep -q Microsoft; then
  2555. _type=msvc
  2556. _ident=$($cc 2>&1 | head -n1)
  2557. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2558. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2559. _cflags_speed="-O2"
  2560. _cflags_size="-O1"
  2561. # Nonstandard output options, to avoid msys path conversion issues, relies on wrapper to remap it
  2562. if $_cc 2>&1 | grep -q Linker; then
  2563. _ld_o='-out $@'
  2564. else
  2565. _ld_o='-Fe$@'
  2566. fi
  2567. _cc_o='-Fo $@'
  2568. _cc_e='-P -Fi $@'
  2569. _flags_filter=msvc_flags
  2570. _ld_lib='lib%.a'
  2571. _ld_path='-libpath:'
  2572. _flags='-nologo'
  2573. _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2574. if [ $pfx = hostcc ]; then
  2575. append _cflags -Dsnprintf=_snprintf
  2576. fi
  2577. disable stripping
  2578. fi
  2579. eval ${pfx}_type=\$_type
  2580. eval ${pfx}_ident=\$_ident
  2581. }
  2582. set_ccvars(){
  2583. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2584. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2585. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2586. if [ -n "$_depflags" ]; then
  2587. eval ${1}_DEPFLAGS=\$_depflags
  2588. else
  2589. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2590. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2591. eval DEP${1}FLAGS=\$_flags
  2592. fi
  2593. }
  2594. probe_cc cc "$cc"
  2595. cflags_filter=$_flags_filter
  2596. cflags_speed=$_cflags_speed
  2597. cflags_size=$_cflags_size
  2598. cflags_noopt=$_cflags_noopt
  2599. add_cflags $_flags $_cflags
  2600. cc_ldflags=$_ldflags
  2601. set_ccvars CC
  2602. probe_cc hostcc "$host_cc"
  2603. host_cflags_filter=$_flags_filter
  2604. add_host_cflags $_flags $_cflags
  2605. set_ccvars HOSTCC
  2606. test -n "$cc_type" && enable $cc_type ||
  2607. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2608. : ${as_default:=$cc}
  2609. : ${dep_cc_default:=$cc}
  2610. : ${ld_default:=$cc}
  2611. : ${host_ld_default:=$host_cc}
  2612. set_default ar as dep_cc ld host_ld
  2613. probe_cc as "$as"
  2614. asflags_filter=$_flags_filter
  2615. add_asflags $_flags $_cflags
  2616. set_ccvars AS
  2617. probe_cc ld "$ld"
  2618. ldflags_filter=$_flags_filter
  2619. add_ldflags $_flags $_ldflags
  2620. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2621. LD_O=${_ld_o-$LD_O}
  2622. LD_LIB=${_ld_lib-$LD_LIB}
  2623. LD_PATH=${_ld_path-$LD_PATH}
  2624. probe_cc hostld "$host_ld"
  2625. host_ldflags_filter=$_flags_filter
  2626. add_host_ldflags $_flags $_ldflags
  2627. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2628. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2629. probe_cc depcc "$dep_cc"
  2630. CCDEP=${_DEPCMD:-$DEPCMD}
  2631. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2632. DEPCCFLAGS=$_flags
  2633. fi
  2634. if $ar 2>&1 | grep -q Microsoft; then
  2635. arflags="-nologo"
  2636. ar_o='-out:$@'
  2637. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2638. arflags="rq"
  2639. ar_o='$@'
  2640. else
  2641. arflags="rc"
  2642. ar_o='$@'
  2643. fi
  2644. add_cflags $extra_cflags
  2645. add_cxxflags $extra_cxxflags
  2646. add_asflags $extra_cflags
  2647. if test -n "$sysroot"; then
  2648. case "$cc_type" in
  2649. gcc|llvm_gcc|clang)
  2650. add_cppflags --sysroot="$sysroot"
  2651. add_ldflags --sysroot="$sysroot"
  2652. ;;
  2653. tms470)
  2654. add_cppflags -I"$sysinclude"
  2655. add_ldflags --sysroot="$sysroot"
  2656. ;;
  2657. esac
  2658. fi
  2659. if test "$cpu" = host; then
  2660. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  2661. case "$cc_type" in
  2662. gcc|llvm_gcc)
  2663. check_native(){
  2664. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2665. sed -n "/cc1.*$1=/{
  2666. s/.*$1=\\([^ ]*\\).*/\\1/
  2667. p
  2668. q
  2669. }" $TMPE
  2670. }
  2671. cpu=$(check_native -march || check_native -mcpu)
  2672. ;;
  2673. esac
  2674. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  2675. fi
  2676. # Deal with common $arch aliases
  2677. case "$arch" in
  2678. aarch64|arm64)
  2679. arch="aarch64"
  2680. ;;
  2681. arm*|iPad*)
  2682. arch="arm"
  2683. ;;
  2684. mips*|IP*)
  2685. arch="mips"
  2686. ;;
  2687. parisc*|hppa*)
  2688. arch="parisc"
  2689. ;;
  2690. "Power Macintosh"|ppc*|powerpc*)
  2691. arch="ppc"
  2692. ;;
  2693. s390|s390x)
  2694. arch="s390"
  2695. ;;
  2696. sh4|sh)
  2697. arch="sh4"
  2698. ;;
  2699. sun4u|sparc*)
  2700. arch="sparc"
  2701. ;;
  2702. tilegx|tile-gx)
  2703. arch="tilegx"
  2704. ;;
  2705. i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  2706. arch="x86"
  2707. ;;
  2708. esac
  2709. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2710. enable $arch
  2711. # Add processor-specific flags
  2712. if enabled aarch64; then
  2713. case $cpu in
  2714. armv*)
  2715. cpuflags="-march=$cpu"
  2716. ;;
  2717. *)
  2718. cpuflags="-mcpu=$cpu"
  2719. ;;
  2720. esac
  2721. elif enabled alpha; then
  2722. cpuflags="-mcpu=$cpu"
  2723. elif enabled arm; then
  2724. check_arm_arch() {
  2725. check_cpp_condition stddef.h \
  2726. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  2727. $cpuflags
  2728. }
  2729. probe_arm_arch() {
  2730. if check_arm_arch 4; then echo armv4;
  2731. elif check_arm_arch 4T; then echo armv4t;
  2732. elif check_arm_arch 5; then echo armv5;
  2733. elif check_arm_arch 5E; then echo armv5e;
  2734. elif check_arm_arch 5T; then echo armv5t;
  2735. elif check_arm_arch 5TE; then echo armv5te;
  2736. elif check_arm_arch 5TEJ; then echo armv5te;
  2737. elif check_arm_arch 6; then echo armv6;
  2738. elif check_arm_arch 6J; then echo armv6j;
  2739. elif check_arm_arch 6K; then echo armv6k;
  2740. elif check_arm_arch 6Z; then echo armv6z;
  2741. elif check_arm_arch 6ZK; then echo armv6zk;
  2742. elif check_arm_arch 6T2; then echo armv6t2;
  2743. elif check_arm_arch 7; then echo armv7;
  2744. elif check_arm_arch 7A 7_A; then echo armv7-a;
  2745. elif check_arm_arch 7R 7_R; then echo armv7-r;
  2746. elif check_arm_arch 7M 7_M; then echo armv7-m;
  2747. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  2748. elif check_arm_arch 8A 8_A; then echo armv8-a;
  2749. fi
  2750. }
  2751. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  2752. case $cpu in
  2753. armv*)
  2754. cpuflags="-march=$cpu"
  2755. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2756. ;;
  2757. *)
  2758. cpuflags="-mcpu=$cpu"
  2759. case $cpu in
  2760. cortex-a*) subarch=armv7a ;;
  2761. cortex-r*) subarch=armv7r ;;
  2762. cortex-m*) enable thumb; subarch=armv7m ;;
  2763. arm11*) subarch=armv6 ;;
  2764. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2765. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2766. *) subarch=$(probe_arm_arch) ;;
  2767. esac
  2768. ;;
  2769. esac
  2770. case "$subarch" in
  2771. armv5t*) enable fast_clz ;;
  2772. armv[6-8]*) enable fast_clz fast_unaligned ;;
  2773. esac
  2774. elif enabled avr32; then
  2775. case $cpu in
  2776. ap7[02]0[0-2])
  2777. subarch="avr32_ap"
  2778. cpuflags="-mpart=$cpu"
  2779. ;;
  2780. ap)
  2781. subarch="avr32_ap"
  2782. cpuflags="-march=$cpu"
  2783. ;;
  2784. uc3[ab]*)
  2785. subarch="avr32_uc"
  2786. cpuflags="-mcpu=$cpu"
  2787. ;;
  2788. uc)
  2789. subarch="avr32_uc"
  2790. cpuflags="-march=$cpu"
  2791. ;;
  2792. esac
  2793. elif enabled bfin; then
  2794. cpuflags="-mcpu=$cpu"
  2795. elif enabled mips; then
  2796. cpuflags="-march=$cpu"
  2797. case $cpu in
  2798. 24kc)
  2799. disable mipsfpu
  2800. disable mipsdspr1
  2801. disable mipsdspr2
  2802. ;;
  2803. 24kf*)
  2804. disable mipsdspr1
  2805. disable mipsdspr2
  2806. ;;
  2807. 24kec|34kc|1004kc)
  2808. disable mipsfpu
  2809. disable mipsdspr2
  2810. ;;
  2811. 24kef*|34kf*|1004kf*)
  2812. disable mipsdspr2
  2813. ;;
  2814. 74kc)
  2815. disable mipsfpu
  2816. ;;
  2817. esac
  2818. elif enabled ppc; then
  2819. case $(tolower $cpu) in
  2820. 601|ppc601|powerpc601)
  2821. cpuflags="-mcpu=601"
  2822. disable altivec
  2823. ;;
  2824. 603*|ppc603*|powerpc603*)
  2825. cpuflags="-mcpu=603"
  2826. disable altivec
  2827. ;;
  2828. 604*|ppc604*|powerpc604*)
  2829. cpuflags="-mcpu=604"
  2830. disable altivec
  2831. ;;
  2832. g3|75*|ppc75*|powerpc75*)
  2833. cpuflags="-mcpu=750"
  2834. disable altivec
  2835. ;;
  2836. g4|745*|ppc745*|powerpc745*)
  2837. cpuflags="-mcpu=7450"
  2838. ;;
  2839. 74*|ppc74*|powerpc74*)
  2840. cpuflags="-mcpu=7400"
  2841. ;;
  2842. g5|970|ppc970|powerpc970)
  2843. cpuflags="-mcpu=970"
  2844. ;;
  2845. power[3-7]*)
  2846. cpuflags="-mcpu=$cpu"
  2847. ;;
  2848. cell)
  2849. cpuflags="-mcpu=cell"
  2850. enable ldbrx
  2851. ;;
  2852. e500mc)
  2853. cpuflags="-mcpu=e500mc"
  2854. disable altivec
  2855. ;;
  2856. e500v2)
  2857. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2858. disable altivec
  2859. ;;
  2860. e500)
  2861. cpuflags="-mcpu=8540 -mhard-float"
  2862. disable altivec
  2863. ;;
  2864. esac
  2865. elif enabled sparc; then
  2866. case $cpu in
  2867. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  2868. cpuflags="-mcpu=$cpu"
  2869. disable vis
  2870. ;;
  2871. ultrasparc*|niagara[234])
  2872. cpuflags="-mcpu=$cpu"
  2873. ;;
  2874. esac
  2875. elif enabled x86; then
  2876. case $cpu in
  2877. i[345]86|pentium)
  2878. cpuflags="-march=$cpu"
  2879. disable mmx
  2880. ;;
  2881. # targets that do NOT support conditional mov (cmov)
  2882. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2883. cpuflags="-march=$cpu"
  2884. disable cmov
  2885. ;;
  2886. # targets that do support conditional mov (cmov)
  2887. 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*)
  2888. cpuflags="-march=$cpu"
  2889. enable cmov
  2890. enable fast_cmov
  2891. ;;
  2892. # targets that do support conditional mov but on which it's slow
  2893. pentium4|pentium4m|prescott|nocona)
  2894. cpuflags="-march=$cpu"
  2895. enable cmov
  2896. disable fast_cmov
  2897. ;;
  2898. esac
  2899. fi
  2900. if [ "$cpu" != generic ]; then
  2901. add_cflags $cpuflags
  2902. add_asflags $cpuflags
  2903. fi
  2904. # compiler sanity check
  2905. check_exec <<EOF
  2906. int main(void){ return 0; }
  2907. EOF
  2908. if test "$?" != 0; then
  2909. echo "$cc is unable to create an executable file."
  2910. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2911. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2912. echo "Only do this if you know what cross compiling means."
  2913. fi
  2914. die "C compiler test failed."
  2915. fi
  2916. add_cppflags -D_ISOC99_SOURCE
  2917. add_cxxflags -D__STDC_CONSTANT_MACROS
  2918. check_cflags -std=c99
  2919. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2920. #include <stdlib.h>
  2921. EOF
  2922. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2923. #include <stdlib.h>
  2924. EOF
  2925. check_host_cflags -std=c99
  2926. check_host_cflags -Wall
  2927. check_64bit(){
  2928. arch32=$1
  2929. arch64=$2
  2930. expr=$3
  2931. check_code cc "" "int test[2*($expr) - 1]" &&
  2932. subarch=$arch64 || subarch=$arch32
  2933. }
  2934. case "$arch" in
  2935. aarch64|alpha|ia64)
  2936. spic=$shared
  2937. ;;
  2938. mips)
  2939. check_64bit mips mips64 '_MIPS_SIM > 1'
  2940. spic=$shared
  2941. ;;
  2942. parisc)
  2943. check_64bit parisc parisc64 'sizeof(void *) > 4'
  2944. spic=$shared
  2945. ;;
  2946. ppc)
  2947. check_64bit ppc ppc64 'sizeof(void *) > 4'
  2948. spic=$shared
  2949. ;;
  2950. sparc)
  2951. check_64bit sparc sparc64 'sizeof(void *) > 4'
  2952. spic=$shared
  2953. ;;
  2954. x86)
  2955. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  2956. if test "$subarch" = "x86_64"; then
  2957. spic=$shared
  2958. fi
  2959. ;;
  2960. ppc)
  2961. check_cc <<EOF && subarch="ppc64"
  2962. int test[(int)sizeof(char*) - 7];
  2963. EOF
  2964. ;;
  2965. esac
  2966. enable $subarch
  2967. enabled spic && enable pic
  2968. # OS specific
  2969. case $target_os in
  2970. haiku)
  2971. prefix_default="/boot/common"
  2972. network_extralibs="-lnetwork"
  2973. host_libs=
  2974. ;;
  2975. sunos)
  2976. FFSERVERLDFLAGS=""
  2977. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2978. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2979. network_extralibs="-lsocket -lnsl"
  2980. add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  2981. # When using suncc to build, the Solaris linker will mark
  2982. # an executable with each instruction set encountered by
  2983. # the Solaris assembler. As our libraries contain their own
  2984. # guards for processor-specific code, instead suppress
  2985. # generation of the HWCAPS ELF section on Solaris x86 only.
  2986. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  2987. nm_default='nm -P -g'
  2988. ;;
  2989. netbsd)
  2990. disable symver
  2991. oss_indev_extralibs="-lossaudio"
  2992. oss_outdev_extralibs="-lossaudio"
  2993. enabled gcc || check_ldflags -Wl,-zmuldefs
  2994. ;;
  2995. openbsd|bitrig)
  2996. disable symver
  2997. SHFLAGS='-shared'
  2998. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  2999. SLIB_INSTALL_LINKS=
  3000. oss_indev_extralibs="-lossaudio"
  3001. oss_outdev_extralibs="-lossaudio"
  3002. ;;
  3003. dragonfly)
  3004. disable symver
  3005. ;;
  3006. freebsd)
  3007. ;;
  3008. bsd/os)
  3009. add_extralibs -lpoll -lgnugetopt
  3010. strip="strip -d"
  3011. ;;
  3012. darwin)
  3013. gas="gas-preprocessor.pl $cc"
  3014. enabled ppc && add_asflags -force_cpusubtype_ALL
  3015. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3016. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3017. strip="${strip} -x"
  3018. add_ldflags -Wl,-dynamic,-search_paths_first
  3019. SLIBSUF=".dylib"
  3020. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  3021. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  3022. FFSERVERLDFLAGS=-Wl,-bind_at_load
  3023. objformat="macho"
  3024. enabled x86_64 && objformat="macho64"
  3025. enabled_any pic shared ||
  3026. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3027. ;;
  3028. mingw32*)
  3029. if test $target_os = "mingw32ce"; then
  3030. disable network
  3031. else
  3032. target_os=mingw32
  3033. fi
  3034. LIBTARGET=i386
  3035. if enabled x86_64; then
  3036. LIBTARGET="i386:x86-64"
  3037. elif enabled arm; then
  3038. LIBTARGET=arm-wince
  3039. fi
  3040. shlibdir_default="$bindir_default"
  3041. SLIBPREF=""
  3042. SLIBSUF=".dll"
  3043. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3044. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3045. dlltool="${cross_prefix}dlltool"
  3046. if check_cmd lib.exe -list; then
  3047. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3048. if enabled x86_64; then
  3049. LIBTARGET=x64
  3050. fi
  3051. elif check_cmd $dlltool --version; then
  3052. 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)'
  3053. fi
  3054. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3055. SLIB_INSTALL_LINKS=
  3056. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3057. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3058. 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'
  3059. objformat="win32"
  3060. ranlib=:
  3061. enable dos_paths
  3062. ;;
  3063. win32|win64)
  3064. if enabled shared; then
  3065. # Link to the import library instead of the normal static library
  3066. # for shared libs.
  3067. LD_LIB='%.lib'
  3068. # Cannot build shared and static libraries at the same time with
  3069. # MSVC.
  3070. disable static
  3071. fi
  3072. shlibdir_default="$bindir_default"
  3073. SLIBPREF=""
  3074. SLIBSUF=".dll"
  3075. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3076. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3077. SLIB_CREATE_DEF_CMD='makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3078. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3079. SLIB_INSTALL_LINKS=
  3080. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3081. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3082. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3083. objformat="win32"
  3084. ranlib=:
  3085. enable dos_paths
  3086. ;;
  3087. cygwin*)
  3088. target_os=cygwin
  3089. shlibdir_default="$bindir_default"
  3090. SLIBPREF="cyg"
  3091. SLIBSUF=".dll"
  3092. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3093. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3094. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3095. SLIB_INSTALL_LINKS=
  3096. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  3097. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  3098. objformat="win32"
  3099. enable dos_paths
  3100. ;;
  3101. *-dos|freedos|opendos)
  3102. network_extralibs="-lsocket"
  3103. objformat="coff"
  3104. enable dos_paths
  3105. add_cppflags -U__STRICT_ANSI__
  3106. ;;
  3107. linux)
  3108. enable dv1394
  3109. ;;
  3110. irix*)
  3111. target_os=irix
  3112. ranlib="echo ignoring ranlib"
  3113. ;;
  3114. os/2*)
  3115. strip="lxlite -CS"
  3116. ln_s="cp -f"
  3117. objformat="aout"
  3118. add_cppflags -D_GNU_SOURCE
  3119. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  3120. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3121. FFSERVERLDFLAGS=""
  3122. LIBSUF="_s.a"
  3123. SLIBPREF=""
  3124. SLIBSUF=".dll"
  3125. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3126. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3127. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3128. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  3129. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3130. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3131. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3132. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  3133. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3134. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3135. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3136. enable dos_paths
  3137. enable_weak os2threads
  3138. ;;
  3139. gnu/kfreebsd)
  3140. add_cppflags -D_BSD_SOURCE
  3141. ;;
  3142. gnu)
  3143. ;;
  3144. qnx)
  3145. add_cppflags -D_QNX_SOURCE
  3146. network_extralibs="-lsocket"
  3147. ;;
  3148. symbian)
  3149. SLIBSUF=".dll"
  3150. enable dos_paths
  3151. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3152. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3153. add_ldflags -Wl,--target1-abs,--no-undefined \
  3154. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3155. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3156. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3157. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3158. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3159. ;;
  3160. osf1)
  3161. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  3162. FFSERVERLDFLAGS=
  3163. ;;
  3164. minix)
  3165. ;;
  3166. plan9)
  3167. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  3168. -D_REENTRANT_SOURCE \
  3169. -D_RESEARCH_SOURCE \
  3170. -DFD_SETSIZE=96 \
  3171. -DHAVE_SOCK_OPTS
  3172. add_compat strtod.o strtod=avpriv_strtod
  3173. network_extralibs='-lbsd'
  3174. exeobjs=compat/plan9/main.o
  3175. disable ffserver
  3176. cp_f='cp'
  3177. ;;
  3178. none)
  3179. ;;
  3180. *)
  3181. die "Unknown OS '$target_os'."
  3182. ;;
  3183. esac
  3184. # determine libc flavour
  3185. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3186. if check_cpp_condition features.h "defined __UCLIBC__"; then
  3187. libc_type=uclibc
  3188. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3189. elif check_cpp_condition features.h "defined __GLIBC__"; then
  3190. libc_type=glibc
  3191. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3192. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3193. elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3194. libc_type=newlib
  3195. add_cppflags -U__STRICT_ANSI__
  3196. elif check_header _mingw.h; then
  3197. libc_type=mingw
  3198. check_cpp_condition _mingw.h \
  3199. "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
  3200. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3201. die "ERROR: MinGW runtime version must be >= 3.15."
  3202. add_cppflags -U__STRICT_ANSI__
  3203. if check_cpp_condition _mingw.h "defined(__MINGW64_VERSION_MAJOR) && \
  3204. __MINGW64_VERSION_MAJOR < 3"; then
  3205. add_compat msvcrt/snprintf.o
  3206. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  3207. fi
  3208. elif check_func_headers stdlib.h _get_doserrno; then
  3209. libc_type=msvcrt
  3210. add_compat strtod.o strtod=avpriv_strtod
  3211. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3212. _snprintf=avpriv_snprintf \
  3213. vsnprintf=avpriv_vsnprintf
  3214. elif check_cpp_condition stddef.h "defined __KLIBC__"; then
  3215. libc_type=klibc
  3216. fi
  3217. test -n "$libc_type" && enable $libc_type
  3218. # hacks for compiler/libc/os combinations
  3219. if enabled_all tms470 glibc; then
  3220. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3221. add_cppflags -D__USER_LABEL_PREFIX__=
  3222. add_cppflags -D__builtin_memset=memset
  3223. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3224. add_cflags -pds=48 # incompatible redefinition of macro
  3225. fi
  3226. if enabled_all ccc glibc; then
  3227. add_ldflags -Wl,-z,now # calls to libots crash without this
  3228. fi
  3229. esc(){
  3230. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3231. }
  3232. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
  3233. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  3234. set_default $PATHS_LIST
  3235. set_default nm
  3236. # we need to build at least one lib type
  3237. if ! enabled_any static shared; then
  3238. cat <<EOF
  3239. At least one library type must be built.
  3240. Specify --enable-static to build the static libraries or --enable-shared to
  3241. build the shared libraries as well. To only build the shared libraries specify
  3242. --disable-static in addition to --enable-shared.
  3243. EOF
  3244. exit 1;
  3245. fi
  3246. die_license_disabled() {
  3247. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  3248. }
  3249. die_license_disabled_gpl() {
  3250. enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; }
  3251. }
  3252. die_license_disabled gpl libcdio
  3253. die_license_disabled gpl libutvideo
  3254. die_license_disabled gpl libx264
  3255. die_license_disabled gpl libxavs
  3256. die_license_disabled gpl libxvid
  3257. die_license_disabled gpl x11grab
  3258. die_license_disabled nonfree libaacplus
  3259. die_license_disabled nonfree libfaac
  3260. enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
  3261. enabled gpl && die_license_disabled_gpl nonfree openssl
  3262. die_license_disabled version3 libopencore_amrnb
  3263. die_license_disabled version3 libopencore_amrwb
  3264. die_license_disabled version3 libvo_aacenc
  3265. die_license_disabled version3 libvo_amrwbenc
  3266. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3267. disabled optimizations || check_cflags -fomit-frame-pointer
  3268. enable_pic() {
  3269. enable pic
  3270. add_cppflags -DPIC
  3271. add_cflags -fPIC
  3272. add_asflags -fPIC
  3273. }
  3274. enabled pic && enable_pic
  3275. check_cc <<EOF || die "Symbol mangling check failed."
  3276. int ff_extern;
  3277. EOF
  3278. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3279. extern_prefix=${sym%%ff_extern*}
  3280. check_cc <<EOF && enable_weak inline_asm
  3281. void foo(void) { __asm__ volatile ("" ::); }
  3282. EOF
  3283. _restrict=
  3284. for restrict_keyword in restrict __restrict__ __restrict; do
  3285. check_cc <<EOF && _restrict=$restrict_keyword && break
  3286. void foo(char * $restrict_keyword p);
  3287. EOF
  3288. done
  3289. check_cc <<EOF && enable attribute_packed
  3290. struct { int x; } __attribute__((packed)) x;
  3291. EOF
  3292. check_cc <<EOF && enable attribute_may_alias
  3293. union { int x; } __attribute__((may_alias)) x;
  3294. EOF
  3295. check_cc <<EOF || die "endian test failed"
  3296. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3297. EOF
  3298. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3299. if enabled alpha; then
  3300. check_cflags -mieee
  3301. elif enabled arm; then
  3302. check_cpp_condition stddef.h "defined __thumb__" && check_cc <<EOF && enable_weak thumb
  3303. float func(float a, float b){ return a+b; }
  3304. EOF
  3305. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3306. nogas=die
  3307. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3308. enable vfp_args
  3309. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  3310. case "${cross_prefix:-$cc}" in
  3311. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3312. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3313. __asm__ (".eabi_attribute 28, 1");
  3314. int main(void) { return 0; }
  3315. EOF
  3316. esac
  3317. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3318. fi
  3319. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3320. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3321. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3322. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3323. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3324. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3325. [ $target_os = linux ] ||
  3326. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3327. $ARCH_EXT_LIST_ARM
  3328. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3329. check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  3330. enabled_all armv6t2 shared !pic && enable_pic
  3331. elif enabled mips; then
  3332. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3333. enabled mips32r2 && add_cflags "-mips32r2" && add_asflags "-mips32r2" &&
  3334. check_inline_asm mips32r2 '"rotr $t0, $t1, 1"'
  3335. enabled mipsdspr1 && add_cflags "-mdsp" && add_asflags "-mdsp" &&
  3336. check_inline_asm mipsdspr1 '"addu.qb $t0, $t1, $t2"'
  3337. enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
  3338. check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
  3339. enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
  3340. check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"'
  3341. elif enabled parisc; then
  3342. if enabled gcc; then
  3343. case $($cc -dumpversion) in
  3344. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3345. esac
  3346. fi
  3347. elif enabled ppc; then
  3348. enable local_aligned_8 local_aligned_16
  3349. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3350. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3351. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3352. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3353. # AltiVec flags: The FSF version of GCC differs from the Apple version
  3354. if enabled altivec; then
  3355. nogas=warn
  3356. check_cflags -maltivec -mabi=altivec &&
  3357. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  3358. check_cflags -faltivec
  3359. # check if our compiler supports Motorola AltiVec C API
  3360. check_cc <<EOF || disable altivec
  3361. $inc_altivec_h
  3362. int main(void) {
  3363. vector signed int v1 = (vector signed int) { 0 };
  3364. vector signed int v2 = (vector signed int) { 1 };
  3365. v1 = vec_add(v1, v2);
  3366. return 0;
  3367. }
  3368. EOF
  3369. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3370. fi
  3371. elif enabled sparc; then
  3372. enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
  3373. elif enabled x86; then
  3374. check_builtin rdtsc intrin.h "__rdtsc()"
  3375. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3376. enable local_aligned_8 local_aligned_16
  3377. # check whether EBP is available on x86
  3378. # As 'i' is stored on the stack, this program will crash
  3379. # if the base pointer is used to access it because the
  3380. # base pointer is cleared in the inline assembly code.
  3381. check_exec_crash <<EOF && enable ebp_available
  3382. volatile int i=0;
  3383. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3384. return i;
  3385. EOF
  3386. # check whether EBX is available on x86
  3387. check_inline_asm ebx_available '""::"b"(0)' &&
  3388. check_inline_asm ebx_available '"":::"%ebx"'
  3389. # check whether xmm clobbers are supported
  3390. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3391. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3392. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3393. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3394. if ! disabled_any asm mmx yasm; then
  3395. if check_cmd $yasmexe --version; then
  3396. enabled x86_64 && yasm_extra="-m amd64"
  3397. yasm_debug="-g dwarf2"
  3398. elif check_cmd nasm -v; then
  3399. yasmexe=nasm
  3400. yasm_debug="-g -F dwarf"
  3401. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3402. fi
  3403. YASMFLAGS="-f $objformat $yasm_extra"
  3404. enabled pic && append YASMFLAGS "-DPIC"
  3405. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3406. case "$objformat" in
  3407. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3408. esac
  3409. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  3410. die "yasm not found, use --disable-yasm for a crippled build"
  3411. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx_external
  3412. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  3413. check_yasm "CPU amdnop" && enable cpunop
  3414. fi
  3415. case "$cpu" in
  3416. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  3417. disable fast_clz
  3418. ;;
  3419. esac
  3420. fi
  3421. if enabled asm; then
  3422. as=${gas:=$as}
  3423. check_as <<EOF && enable gnu_as || \
  3424. $nogas "GNU assembler not found, install gas-preprocessor"
  3425. .macro m n
  3426. \n: .int 0
  3427. .endm
  3428. m x
  3429. EOF
  3430. fi
  3431. check_ldflags -Wl,--as-needed
  3432. if check_func dlopen; then
  3433. ldl=
  3434. elif check_func dlopen -ldl; then
  3435. ldl=-ldl
  3436. fi
  3437. if ! disabled network; then
  3438. check_type "sys/types.h sys/socket.h" socklen_t
  3439. check_type netdb.h "struct addrinfo"
  3440. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3441. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3442. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3443. check_type netinet/in.h "struct sockaddr_in6"
  3444. check_type poll.h "struct pollfd"
  3445. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3446. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3447. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3448. check_func getaddrinfo $network_extralibs
  3449. check_func getservbyport $network_extralibs
  3450. # Prefer arpa/inet.h over winsock2
  3451. if check_header arpa/inet.h ; then
  3452. check_func closesocket
  3453. elif check_header winsock2.h ; then
  3454. check_func_headers winsock2.h closesocket -lws2 &&
  3455. network_extralibs="-lws2" ||
  3456. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3457. network_extralibs="-lws2_32"; }
  3458. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3459. check_type ws2tcpip.h socklen_t
  3460. check_type ws2tcpip.h "struct addrinfo"
  3461. check_type ws2tcpip.h "struct group_source_req"
  3462. check_type ws2tcpip.h "struct ip_mreq_source"
  3463. check_type ws2tcpip.h "struct ipv6_mreq"
  3464. check_type winsock2.h "struct pollfd"
  3465. check_type ws2tcpip.h "struct sockaddr_in6"
  3466. check_type ws2tcpip.h "struct sockaddr_storage"
  3467. check_struct winsock2.h "struct sockaddr" sa_len
  3468. else
  3469. disable network
  3470. fi
  3471. fi
  3472. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3473. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  3474. check_func access
  3475. check_func clock_gettime || { check_func clock_gettime -lrt && add_extralibs -lrt; }
  3476. check_func fcntl
  3477. check_func fork
  3478. check_func gethrtime
  3479. check_func getopt
  3480. check_func getrusage
  3481. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3482. check_func gettimeofday
  3483. check_func inet_aton $network_extralibs
  3484. check_func isatty
  3485. check_func localtime_r
  3486. check_func ${malloc_prefix}memalign && enable memalign
  3487. check_func mkstemp
  3488. check_func mmap
  3489. check_func mprotect
  3490. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3491. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3492. check_func setrlimit
  3493. check_func strerror_r
  3494. check_func sched_getaffinity
  3495. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  3496. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  3497. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  3498. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  3499. check_func sysconf
  3500. check_func sysctl
  3501. check_func usleep
  3502. check_func_headers conio.h kbhit
  3503. check_func_headers windows.h PeekNamedPipe
  3504. check_func_headers io.h setmode
  3505. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  3506. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3507. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3508. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3509. check_func_headers windows.h GetProcessAffinityMask
  3510. check_func_headers windows.h GetProcessTimes
  3511. check_func_headers windows.h GetSystemTimeAsFileTime
  3512. check_func_headers windows.h MapViewOfFile
  3513. check_func_headers windows.h SetConsoleTextAttribute
  3514. check_func_headers windows.h Sleep
  3515. check_func_headers windows.h VirtualAlloc
  3516. check_func_headers glob.h glob
  3517. check_header direct.h
  3518. check_header dlfcn.h
  3519. check_header dxva.h
  3520. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  3521. check_header io.h
  3522. check_header libcrystalhd/libcrystalhd_if.h
  3523. check_header malloc.h
  3524. check_header poll.h
  3525. check_header sys/mman.h
  3526. check_header sys/param.h
  3527. check_header sys/resource.h
  3528. check_header sys/select.h
  3529. check_header sys/time.h
  3530. check_header termios.h
  3531. check_header unistd.h
  3532. check_header vdpau/vdpau.h
  3533. check_header vdpau/vdpau_x11.h
  3534. check_header VideoDecodeAcceleration/VDADecoder.h
  3535. check_header windows.h
  3536. check_header X11/extensions/XvMClib.h
  3537. check_header asm/types.h
  3538. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3539. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3540. if ! disabled w32threads && ! enabled pthreads; then
  3541. check_func_headers "windows.h process.h" _beginthreadex && enable w32threads
  3542. fi
  3543. # check for some common methods of building with pthread support
  3544. # do this before the optional library checks as some of them require pthreads
  3545. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  3546. enable pthreads
  3547. if check_func pthread_create; then
  3548. :
  3549. elif check_func pthread_create -pthread; then
  3550. add_cflags -pthread
  3551. add_extralibs -pthread
  3552. elif check_func pthread_create -pthreads; then
  3553. add_cflags -pthreads
  3554. add_extralibs -pthreads
  3555. elif check_func pthread_create -lpthreadGC2; then
  3556. add_extralibs -lpthreadGC2
  3557. elif ! check_lib pthread.h pthread_create -lpthread; then
  3558. disable pthreads
  3559. fi
  3560. fi
  3561. for thread in $THREADS_LIST; do
  3562. if enabled $thread; then
  3563. test -n "$thread_type" &&
  3564. die "ERROR: Only one thread type must be selected." ||
  3565. thread_type="$thread"
  3566. fi
  3567. done
  3568. if enabled pthreads; then
  3569. check_func pthread_cancel
  3570. fi
  3571. enabled sync_val_compare_and_swap && enable atomics_gcc
  3572. enabled machine_rw_barrier && enabled atomic_cas_ptr && enable atomics_suncc
  3573. enabled MemoryBarrier && enable atomics_win32
  3574. check_lib math.h sin -lm && LIBM="-lm"
  3575. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  3576. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  3577. atan2f_args=2
  3578. ldexpf_args=2
  3579. powf_args=2
  3580. for func in $MATH_FUNCS; do
  3581. eval check_mathfunc $func \${${func}_args:-1}
  3582. done
  3583. # these are off by default, so fail if requested and not available
  3584. enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } ||
  3585. { check_lib2 "dlfcn.h" dlopen -ldl; } ||
  3586. die "ERROR: LoadLibrary/dlopen not found for avisynth"; }
  3587. enabled fontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  3588. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3589. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3590. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  3591. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  3592. enabled libass && require_pkg_config libass ass/ass.h ass_library_init
  3593. enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray
  3594. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  3595. { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
  3596. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  3597. enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
  3598. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  3599. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  3600. 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"
  3601. enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
  3602. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  3603. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  3604. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  3605. done || die "ERROR: libgsm not found"; }
  3606. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  3607. enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
  3608. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  3609. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  3610. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  3611. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  3612. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  3613. enabled libopenjpeg && { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg ||
  3614. check_lib openjpeg.h opj_version -lopenjpeg ||
  3615. die "ERROR: libopenjpeg not found"; }
  3616. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  3617. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  3618. enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
  3619. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  3620. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  3621. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  3622. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  3623. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  3624. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  3625. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
  3626. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  3627. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  3628. { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  3629. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  3630. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  3631. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  3632. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  3633. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  3634. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  3635. enabled libvpx && {
  3636. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  3637. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  3638. 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 ||
  3639. die "ERROR: libvpx encoder version must be >=0.9.7"; }
  3640. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  3641. enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } }
  3642. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  3643. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  3644. die "ERROR: libx264 must be installed and version must be >= 0.118."; }
  3645. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  3646. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  3647. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  3648. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  3649. die "ERROR: openal not found"; } &&
  3650. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  3651. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  3652. enabled opencl && require2 opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL
  3653. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  3654. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  3655. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  3656. die "ERROR: openssl not found"; }
  3657. if enabled gnutls; then
  3658. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  3659. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  3660. fi
  3661. # libdc1394 check
  3662. if enabled libdc1394; then
  3663. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  3664. enable libdc1394_2; } ||
  3665. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  3666. enable libdc1394_1; } ||
  3667. die "ERROR: No version of libdc1394 found "
  3668. fi
  3669. SDL_CONFIG="${cross_prefix}sdl-config"
  3670. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3671. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3672. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  3673. enable sdl
  3674. else
  3675. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  3676. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  3677. sdl_libs=$("${SDL_CONFIG}" --libs)
  3678. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  3679. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3680. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  3681. enable sdl
  3682. fi
  3683. fi
  3684. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  3685. texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  3686. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  3687. perl --version > /dev/null 2>&1 && enable perl || disable perl
  3688. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  3689. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  3690. check_header linux/fb.h
  3691. check_header linux/videodev.h
  3692. check_header linux/videodev2.h
  3693. check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  3694. check_header sys/videoio.h
  3695. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  3696. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  3697. # w32api 3.12 had it defined wrong
  3698. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  3699. check_type "dshow.h" IBaseFilter
  3700. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  3701. { check_header dev/bktr/ioctl_meteor.h &&
  3702. check_header dev/bktr/ioctl_bt848.h; } ||
  3703. { check_header machine/ioctl_meteor.h &&
  3704. check_header machine/ioctl_bt848.h; } ||
  3705. { check_header dev/video/meteor/ioctl_meteor.h &&
  3706. check_header dev/video/bktr/ioctl_bt848.h; } ||
  3707. check_header dev/ic/bt8xx.h
  3708. check_header sndio.h
  3709. if check_struct sys/soundcard.h audio_buf_info bytes; then
  3710. enable_safe sys/soundcard.h
  3711. else
  3712. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  3713. #include <sys/soundcard.h>
  3714. audio_buf_info abc;
  3715. EOF
  3716. fi
  3717. check_header soundcard.h
  3718. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  3719. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait &&
  3720. check_func jack_port_get_latency_range -ljack
  3721. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  3722. if enabled libcdio; then
  3723. 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
  3724. fi
  3725. enabled x11grab &&
  3726. require X11 X11/Xlib.h XOpenDisplay -lX11 &&
  3727. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  3728. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  3729. if ! disabled vaapi; then
  3730. check_lib va/va.h vaInitialize -lva && {
  3731. check_cpp_condition va/va_version.h "VA_CHECK_VERSION(0,32,0)" ||
  3732. warn "Please upgrade to VA-API >= 0.32 if you would like full VA-API support.";
  3733. } || disable vaapi
  3734. fi
  3735. enabled vdpau &&
  3736. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  3737. disable vdpau
  3738. # Funny iconv installations are not unusual, so check it after all flags have been set
  3739. disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv
  3740. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  3741. 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"
  3742. # add some useful compiler flags if supported
  3743. check_cflags -Wdeclaration-after-statement
  3744. check_cflags -Wall
  3745. check_cflags -Wno-parentheses
  3746. check_cflags -Wno-switch
  3747. check_cflags -Wno-format-zero-length
  3748. check_cflags -Wdisabled-optimization
  3749. check_cflags -Wpointer-arith
  3750. check_cflags -Wredundant-decls
  3751. check_cflags -Wno-pointer-sign
  3752. check_cflags -Wwrite-strings
  3753. check_cflags -Wtype-limits
  3754. check_cflags -Wundef
  3755. check_cflags -Wmissing-prototypes
  3756. check_cflags -Wno-pointer-to-int-cast
  3757. check_cflags -Wstrict-prototypes
  3758. enabled extra_warnings && check_cflags -Winline
  3759. # add some linker flags
  3760. check_ldflags -Wl,--warn-common
  3761. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  3762. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  3763. enabled xmm_clobber_test &&
  3764. check_ldflags -Wl,--wrap,avcodec_open2 \
  3765. -Wl,--wrap,avcodec_decode_audio4 \
  3766. -Wl,--wrap,avcodec_decode_video2 \
  3767. -Wl,--wrap,avcodec_decode_subtitle2 \
  3768. -Wl,--wrap,avcodec_encode_audio2 \
  3769. -Wl,--wrap,avcodec_encode_video \
  3770. -Wl,--wrap,avcodec_encode_subtitle \
  3771. -Wl,--wrap,sws_scale ||
  3772. disable xmm_clobber_test
  3773. echo "X{};" > $TMPV
  3774. if test_ldflags -Wl,--version-script,$TMPV; then
  3775. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  3776. check_cc <<EOF && enable symver_asm_label
  3777. void ff_foo(void) __asm__ ("av_foo@VERSION");
  3778. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  3779. EOF
  3780. check_cc <<EOF && enable symver_gnu_asm
  3781. __asm__(".symver ff_foo,av_foo@VERSION");
  3782. void ff_foo(void) {}
  3783. EOF
  3784. fi
  3785. if [ -z "$optflags" ]; then
  3786. if enabled small; then
  3787. optflags=$cflags_size
  3788. elif enabled optimizations; then
  3789. optflags=$cflags_speed
  3790. else
  3791. optflags=$cflags_noopt
  3792. fi
  3793. fi
  3794. check_optflags(){
  3795. check_cflags "$@"
  3796. enabled lto && check_ldflags "$@"
  3797. }
  3798. if enabled lto; then
  3799. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  3800. check_cflags -flto
  3801. check_ldflags -flto $cpuflags
  3802. fi
  3803. check_optflags $optflags
  3804. check_optflags -fno-math-errno
  3805. check_optflags -fno-signed-zeros
  3806. enabled ftrapv && check_cflags -ftrapv
  3807. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  3808. int x;
  3809. EOF
  3810. if enabled icc; then
  3811. # Just warnings, no remarks
  3812. check_cflags -w1
  3813. # -wd: Disable following warnings
  3814. # 144, 167, 556: -Wno-pointer-sign
  3815. # 188: enumerated type mixed with another type
  3816. # 1292: attribute "foo" ignored
  3817. # 1419: external declaration in primary source file
  3818. # 10006: ignoring unknown option -fno-signed-zeros
  3819. # 10148: ignoring unknown option -Wno-parentheses
  3820. # 10156: ignoring option '-W'; no argument required
  3821. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156
  3822. # 11030: Warning unknown option --as-needed
  3823. # 10156: ignoring option '-export'; no argument required
  3824. check_ldflags -wd10156,11030
  3825. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  3826. enable ebp_available
  3827. if enabled x86_32; then
  3828. icc_version=$($cc -dumpversion)
  3829. test ${icc_version%%.*} -ge 11 &&
  3830. check_cflags -falign-stack=maintain-16-byte ||
  3831. disable aligned_stack
  3832. fi
  3833. elif enabled ccc; then
  3834. # disable some annoying warnings
  3835. add_cflags -msg_disable bitnotint
  3836. add_cflags -msg_disable mixfuncvoid
  3837. add_cflags -msg_disable nonstandcast
  3838. add_cflags -msg_disable unsupieee
  3839. elif enabled gcc; then
  3840. check_optflags -fno-tree-vectorize
  3841. check_cflags -Werror=implicit-function-declaration
  3842. check_cflags -Werror=missing-prototypes
  3843. check_cflags -Werror=return-type
  3844. check_cflags -Werror=vla
  3845. elif enabled llvm_gcc; then
  3846. check_cflags -mllvm -stack-alignment=16
  3847. elif enabled clang; then
  3848. check_cflags -mllvm -stack-alignment=16
  3849. check_cflags -Qunused-arguments
  3850. check_cflags -Werror=implicit-function-declaration
  3851. check_cflags -Werror=missing-prototypes
  3852. check_cflags -Werror=return-type
  3853. elif enabled armcc; then
  3854. # 2523: use of inline assembler is deprecated
  3855. add_cflags -W${armcc_opt},--diag_suppress=2523
  3856. add_cflags -W${armcc_opt},--diag_suppress=1207
  3857. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  3858. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  3859. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  3860. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  3861. elif enabled tms470; then
  3862. add_cflags -pds=824 -pds=837
  3863. elif enabled pathscale; then
  3864. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  3865. elif enabled msvc; then
  3866. enabled x86_32 && disable aligned_stack
  3867. fi
  3868. case $target_os in
  3869. osf1)
  3870. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  3871. ;;
  3872. plan9)
  3873. add_cppflags -Dmain=plan9_main
  3874. ;;
  3875. esac
  3876. enable frame_thread_encoder
  3877. enabled_any $THREADS_LIST && enable threads
  3878. enabled_any $ATOMICS_LIST && enable atomics_native
  3879. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  3880. check_deps $CONFIG_LIST \
  3881. $CONFIG_EXTRA \
  3882. $HAVE_LIST \
  3883. $ALL_COMPONENTS \
  3884. if test $target_os = "haiku"; then
  3885. disable memalign
  3886. disable posix_memalign
  3887. fi
  3888. ! enabled_any memalign posix_memalign aligned_malloc &&
  3889. enabled_any $need_memalign && enable memalign_hack
  3890. # add_dep lib dep
  3891. # -> enable ${lib}_deps_${dep}
  3892. # -> add $dep to ${lib}_deps only once
  3893. add_dep() {
  3894. lib=$1
  3895. dep=$2
  3896. enabled "${lib}_deps_${dep}" && return 0
  3897. enable "${lib}_deps_${dep}"
  3898. prepend "${lib}_deps" $dep
  3899. }
  3900. # merge deps lib components
  3901. # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
  3902. merge_deps() {
  3903. lib=$1
  3904. shift
  3905. for comp in $*; do
  3906. enabled $comp || continue
  3907. eval "dep=\"\$${comp}_deps\""
  3908. for d in $dep; do
  3909. add_dep $lib $d
  3910. done
  3911. done
  3912. }
  3913. merge_deps libavfilter $FILTER_LIST
  3914. echo "install prefix $prefix"
  3915. echo "source path $source_path"
  3916. echo "C compiler $cc"
  3917. echo "ARCH $arch ($cpu)"
  3918. if test "$build_suffix" != ""; then
  3919. echo "build suffix $build_suffix"
  3920. fi
  3921. if test "$progs_suffix" != ""; then
  3922. echo "progs suffix $progs_suffix"
  3923. fi
  3924. if test "$extra_version" != ""; then
  3925. echo "version string suffix $extra_version"
  3926. fi
  3927. echo "big-endian ${bigendian-no}"
  3928. echo "runtime cpu detection ${runtime_cpudetect-no}"
  3929. if enabled x86; then
  3930. echo "${yasmexe} ${yasm-no}"
  3931. echo "MMX enabled ${mmx-no}"
  3932. echo "MMXEXT enabled ${mmxext-no}"
  3933. echo "3DNow! enabled ${amd3dnow-no}"
  3934. echo "3DNow! extended enabled ${amd3dnowext-no}"
  3935. echo "SSE enabled ${sse-no}"
  3936. echo "SSSE3 enabled ${ssse3-no}"
  3937. echo "AVX enabled ${avx-no}"
  3938. echo "FMA4 enabled ${fma4-no}"
  3939. echo "CMOV enabled ${cmov-no}"
  3940. echo "CMOV is fast ${fast_cmov-no}"
  3941. echo "EBX available ${ebx_available-no}"
  3942. echo "EBP available ${ebp_available-no}"
  3943. fi
  3944. if enabled arm; then
  3945. echo "ARMv5TE enabled ${armv5te-no}"
  3946. echo "ARMv6 enabled ${armv6-no}"
  3947. echo "ARMv6T2 enabled ${armv6t2-no}"
  3948. echo "VFP enabled ${vfp-no}"
  3949. echo "NEON enabled ${neon-no}"
  3950. echo "THUMB enabled ${thumb-no}"
  3951. fi
  3952. if enabled mips; then
  3953. echo "MIPS FPU enabled ${mipsfpu-no}"
  3954. echo "MIPS32R2 enabled ${mips32r2-no}"
  3955. echo "MIPS DSP R1 enabled ${mipsdspr1-no}"
  3956. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  3957. fi
  3958. if enabled ppc; then
  3959. echo "AltiVec enabled ${altivec-no}"
  3960. echo "PPC 4xx optimizations ${ppc4xx-no}"
  3961. echo "dcbzl available ${dcbzl-no}"
  3962. fi
  3963. if enabled sparc; then
  3964. echo "VIS enabled ${vis-no}"
  3965. fi
  3966. echo "debug symbols ${debug-no}"
  3967. echo "strip symbols ${stripping-no}"
  3968. echo "optimize for size ${small-no}"
  3969. echo "optimizations ${optimizations-no}"
  3970. echo "static ${static-no}"
  3971. echo "shared ${shared-no}"
  3972. echo "postprocessing support ${postproc-no}"
  3973. echo "new filter support ${avfilter-no}"
  3974. echo "network support ${network-no}"
  3975. echo "threading support ${thread_type-no}"
  3976. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  3977. echo "SDL support ${sdl-no}"
  3978. echo "opencl enabled ${opencl-no}"
  3979. echo "texi2html enabled ${texi2html-no}"
  3980. echo "perl enabled ${perl-no}"
  3981. echo "pod2man enabled ${pod2man-no}"
  3982. echo "makeinfo enabled ${makeinfo-no}"
  3983. test -n "$random_seed" &&
  3984. echo "random seed ${random_seed}"
  3985. echo
  3986. echo "External libraries:"
  3987. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  3988. echo
  3989. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  3990. echo "Enabled ${type}s:"
  3991. eval list=\$$(toupper $type)_LIST
  3992. print_enabled '_*' $list | print_3_columns
  3993. echo
  3994. done
  3995. license="LGPL version 2.1 or later"
  3996. if enabled nonfree; then
  3997. license="nonfree and unredistributable"
  3998. elif enabled gplv3; then
  3999. license="GPL version 3 or later"
  4000. elif enabled lgplv3; then
  4001. license="LGPL version 3 or later"
  4002. elif enabled gpl; then
  4003. license="GPL version 2 or later"
  4004. fi
  4005. echo "License: $license"
  4006. echo "Creating config.mak, config.h, and doc/config.texi..."
  4007. test -e Makefile || $ln_s "$source_path/Makefile" .
  4008. enabled stripping || strip="echo skipping strip"
  4009. config_files="$TMPH config.mak doc/config.texi"
  4010. cat > config.mak <<EOF
  4011. # Automatically generated by configure - do not modify!
  4012. ifndef FFMPEG_CONFIG_MAK
  4013. FFMPEG_CONFIG_MAK=1
  4014. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  4015. prefix=$prefix
  4016. LIBDIR=\$(DESTDIR)$libdir
  4017. SHLIBDIR=\$(DESTDIR)$shlibdir
  4018. INCDIR=\$(DESTDIR)$incdir
  4019. BINDIR=\$(DESTDIR)$bindir
  4020. DATADIR=\$(DESTDIR)$datadir
  4021. MANDIR=\$(DESTDIR)$mandir
  4022. SRC_PATH=$source_path
  4023. ifndef MAIN_MAKEFILE
  4024. SRC_PATH:=\$(SRC_PATH:.%=..%)
  4025. endif
  4026. CC_IDENT=$cc_ident
  4027. ARCH=$arch
  4028. CC=$cc
  4029. CXX=$cxx
  4030. AS=$as
  4031. LD=$ld
  4032. DEPCC=$dep_cc
  4033. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4034. DEPAS=$as
  4035. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4036. YASM=$yasmexe
  4037. DEPYASM=$yasmexe
  4038. AR=$ar
  4039. ARFLAGS=$arflags
  4040. AR_O=$ar_o
  4041. RANLIB=$ranlib
  4042. CP=cp -p
  4043. LN_S=$ln_s
  4044. STRIP=$strip
  4045. CPPFLAGS=$CPPFLAGS
  4046. CFLAGS=$CFLAGS
  4047. CXXFLAGS=$CXXFLAGS
  4048. ASFLAGS=$ASFLAGS
  4049. AS_C=$AS_C
  4050. AS_O=$AS_O
  4051. CC_C=$CC_C
  4052. CC_E=$CC_E
  4053. CC_O=$CC_O
  4054. CXX_C=$CXX_C
  4055. CXX_O=$CXX_O
  4056. LD_O=$LD_O
  4057. LD_LIB=$LD_LIB
  4058. LD_PATH=$LD_PATH
  4059. DLLTOOL=$dlltool
  4060. LDFLAGS=$LDFLAGS
  4061. LDFLAGS-ffserver=$FFSERVERLDFLAGS
  4062. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4063. YASMFLAGS=$YASMFLAGS
  4064. BUILDSUF=$build_suffix
  4065. PROGSSUF=$progs_suffix
  4066. FULLNAME=$FULLNAME
  4067. LIBPREF=$LIBPREF
  4068. LIBSUF=$LIBSUF
  4069. LIBNAME=$LIBNAME
  4070. SLIBPREF=$SLIBPREF
  4071. SLIBSUF=$SLIBSUF
  4072. EXESUF=$EXESUF
  4073. EXTRA_VERSION=$extra_version
  4074. CCDEP=$CCDEP
  4075. CXXDEP=$CXXDEP
  4076. CCDEP_FLAGS=$CCDEP_FLAGS
  4077. ASDEP=$ASDEP
  4078. ASDEP_FLAGS=$ASDEP_FLAGS
  4079. CC_DEPFLAGS=$CC_DEPFLAGS
  4080. AS_DEPFLAGS=$AS_DEPFLAGS
  4081. HOSTCC=$host_cc
  4082. HOSTLD=$host_ld
  4083. HOSTCFLAGS=$host_cflags
  4084. HOSTCPPFLAGS=$host_cppflags
  4085. HOSTEXESUF=$HOSTEXESUF
  4086. HOSTLDFLAGS=$host_ldflags
  4087. HOSTLIBS=$host_libs
  4088. DEPHOSTCC=$host_cc
  4089. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4090. HOSTCCDEP=$HOSTCCDEP
  4091. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4092. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4093. HOSTCC_C=$HOSTCC_C
  4094. HOSTCC_O=$HOSTCC_O
  4095. HOSTLD_O=$HOSTLD_O
  4096. TARGET_EXEC=$target_exec
  4097. TARGET_PATH=$target_path
  4098. LIBS-ffplay=$sdl_libs
  4099. CFLAGS-ffplay=$sdl_cflags
  4100. ZLIB=$($ldflags_filter -lz)
  4101. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4102. EXTRALIBS=$extralibs
  4103. COMPAT_OBJS=$compat_objs
  4104. EXEOBJS=$exeobjs
  4105. INSTALL=$install
  4106. LIBTARGET=${LIBTARGET}
  4107. SLIBNAME=${SLIBNAME}
  4108. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4109. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4110. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4111. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4112. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4113. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4114. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4115. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4116. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  4117. NOREDZONE_FLAGS=$noredzone_flags
  4118. EOF
  4119. get_version(){
  4120. lcname=lib${1}
  4121. name=$(toupper $lcname)
  4122. file=$source_path/$lcname/version.h
  4123. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  4124. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  4125. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  4126. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  4127. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  4128. }
  4129. map 'get_version $v' $LIBRARY_LIST
  4130. cat > $TMPH <<EOF
  4131. /* Automatically generated by configure - do not modify! */
  4132. #ifndef FFMPEG_CONFIG_H
  4133. #define FFMPEG_CONFIG_H
  4134. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  4135. #define FFMPEG_LICENSE "$(c_escape $license)"
  4136. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  4137. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4138. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4139. #define av_restrict $_restrict
  4140. #define EXTERN_PREFIX "${extern_prefix}"
  4141. #define EXTERN_ASM ${extern_prefix}
  4142. #define SLIBSUF "$SLIBSUF"
  4143. #define HAVE_MMX2 HAVE_MMXEXT
  4144. EOF
  4145. test -n "$assert_level" &&
  4146. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  4147. test -n "$malloc_prefix" &&
  4148. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4149. if enabled yasm; then
  4150. append config_files $TMPASM
  4151. printf '' >$TMPASM
  4152. fi
  4153. mkdir -p doc
  4154. echo "@c auto-generated by configure" > doc/config.texi
  4155. print_config ARCH_ "$config_files" $ARCH_LIST
  4156. print_config HAVE_ "$config_files" $HAVE_LIST
  4157. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4158. $CONFIG_EXTRA \
  4159. $ALL_COMPONENTS \
  4160. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  4161. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  4162. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4163. cp_if_changed $TMPH config.h
  4164. touch .config
  4165. enabled yasm && cp_if_changed $TMPASM config.asm
  4166. cat > $TMPH <<EOF
  4167. /* Generated by ffconf */
  4168. #ifndef AVUTIL_AVCONFIG_H
  4169. #define AVUTIL_AVCONFIG_H
  4170. EOF
  4171. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4172. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4173. cp_if_changed $TMPH libavutil/avconfig.h
  4174. if test -n "$WARNINGS"; then
  4175. printf "\n$WARNINGS"
  4176. enabled fatal_warnings && exit 1
  4177. fi
  4178. # build pkg-config files
  4179. pkgconfig_generate(){
  4180. name=$1
  4181. shortname=${name#lib}${build_suffix}
  4182. comment=$2
  4183. version=$3
  4184. libs=$4
  4185. requires=$5
  4186. enabled ${name#lib} || return 0
  4187. mkdir -p $name
  4188. cat <<EOF > $name/$name${build_suffix}.pc
  4189. prefix=$prefix
  4190. exec_prefix=\${prefix}
  4191. libdir=$libdir
  4192. includedir=$incdir
  4193. Name: $name
  4194. Description: $comment
  4195. Version: $version
  4196. Requires: $(enabled shared || echo $requires)
  4197. Requires.private: $(enabled shared && echo $requires)
  4198. Conflicts:
  4199. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4200. Libs.private: $(enabled shared && echo $libs)
  4201. Cflags: -I\${includedir}
  4202. EOF
  4203. mkdir -p doc/examples/pc-uninstalled
  4204. includedir=${source_path}
  4205. [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
  4206. cat <<EOF > doc/examples/pc-uninstalled/$name.pc
  4207. prefix=
  4208. exec_prefix=
  4209. libdir=\${pcfiledir}/../../../$name
  4210. includedir=${includedir}
  4211. Name: $name
  4212. Description: $comment
  4213. Version: $version
  4214. Requires: $requires
  4215. Conflicts:
  4216. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4217. Cflags: -I\${includedir}
  4218. EOF
  4219. }
  4220. libavfilter_pc_deps="libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4221. enabled libavfilter_deps_avcodec && prepend libavfilter_pc_deps "libavcodec${build_suffix} = $LIBAVCODEC_VERSION,"
  4222. enabled libavfilter_deps_avformat && prepend libavfilter_pc_deps "libavformat${build_suffix} = $LIBAVFORMAT_VERSION,"
  4223. enabled libavfilter_deps_avresample && prepend libavfilter_pc_deps "libavresample${build_suffix} = $LIBAVRESAMPLE_VERSION,"
  4224. enabled libavfilter_deps_swscale && prepend libavfilter_pc_deps "libswscale${build_suffix} = $LIBSWSCALE_VERSION,"
  4225. enabled libavfilter_deps_swresample && prepend libavfilter_pc_deps "libswresample${build_suffix} = $LIBSWRESAMPLE_VERSION,"
  4226. enabled libavfilter_deps_postproc && prepend libavfilter_pc_deps "libpostproc${build_suffix} = $LIBPOSTPROC_VERSION,"
  4227. libavfilter_pc_deps=${libavfilter_pc_deps%, }
  4228. libavdevice_pc_deps="libavformat${build_suffix} = $LIBAVFORMAT_VERSION"
  4229. enabled lavfi_indev && prepend libavdevice_pc_deps "libavfilter${build_suffix} = $LIBAVFILTER_VERSION,"
  4230. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  4231. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4232. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec${build_suffix} = $LIBAVCODEC_VERSION"
  4233. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$libavdevice_pc_deps"
  4234. pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$libavfilter_pc_deps"
  4235. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4236. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4237. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4238. pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4239. fix_ffmpeg_remote(){
  4240. git_remote_from=$1
  4241. git_remote_to=$2
  4242. fixme_remote=$(git --git-dir=$source_path/.git --work-tree=$source_path remote -v | grep $git_remote_from | cut -f 1 | sort | uniq)
  4243. if [ "$fixme_remote" != "" ]; then
  4244. echolog "
  4245. Outdated domain in git config, the official domain for ffmpeg git is since
  4246. November 2011, source.ffmpeg.org, both the old and the new point to the same
  4247. repository and server. To update it enter the following commands:
  4248. "
  4249. for remote in $fixme_remote; do
  4250. echolog "git remote set-url $remote $git_remote_to"
  4251. done
  4252. fi
  4253. }
  4254. if test -f "$source_path/.git/config"; then
  4255. remote_from=git.videolan.org
  4256. remote_to=source.ffmpeg.org
  4257. fix_ffmpeg_remote git@$remote_from:ffmpeg git@$remote_to:ffmpeg
  4258. fix_ffmpeg_remote git://$remote_from/ffmpeg git://$remote_to/ffmpeg
  4259. fi