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.

4717 lines
142KB

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