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.

4238 lines
128KB

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