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.

4700 lines
142KB

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