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.

4237 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. select_filter_deps="avcodec"
  1715. showspectrum_filter_deps="avcodec"
  1716. super2xsai_filter_deps="gpl"
  1717. tinterlace_filter_deps="gpl"
  1718. yadif_filter_deps="gpl"
  1719. # libraries
  1720. avdevice_deps="avcodec avformat"
  1721. avformat_deps="avcodec"
  1722. postproc_deps="gpl"
  1723. # programs
  1724. ffmpeg_deps="avcodec avfilter avformat swscale swresample"
  1725. ffmpeg_select="buffersink_filter format_filter aformat_filter
  1726. setpts_filter null_filter anull_filter abuffersink_filter"
  1727. ffplay_deps="avcodec avformat swscale swresample sdl"
  1728. ffplay_select="buffersink_filter rdft"
  1729. ffprobe_deps="avcodec avformat"
  1730. ffserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
  1731. ffserver_extralibs='$ldl'
  1732. # documentation
  1733. podpages_deps="perl"
  1734. manpages_deps="perl pod2man"
  1735. htmlpages_deps="texi2html"
  1736. txtpages_deps="makeinfo"
  1737. doc_deps_any="manpages htmlpages podpages txtpages"
  1738. # tests
  1739. colormatrix1_test_deps="colormatrix_filter"
  1740. colormatrix2_test_deps="colormatrix_filter"
  1741. flashsv2_test_deps="zlib"
  1742. mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
  1743. mpng_test_deps="zlib"
  1744. pp_test_deps="mp_filter"
  1745. pp2_test_deps="mp_filter"
  1746. pp3_test_deps="mp_filter"
  1747. pp4_test_deps="mp_filter"
  1748. pp5_test_deps="mp_filter"
  1749. pp6_test_deps="mp_filter"
  1750. seek_lavf_mxf_d10_test_deps="mxf_d10_test"
  1751. zlib_test_deps="zlib"
  1752. zmbv_test_deps="zlib"
  1753. test_deps(){
  1754. suf1=$1
  1755. suf2=$2
  1756. shift 2
  1757. for v; do
  1758. dep=${v%=*}
  1759. tests=${v#*=}
  1760. for name in ${tests}; do
  1761. append ${name}_test_deps ${dep}$suf1 ${dep}$suf2
  1762. done
  1763. done
  1764. }
  1765. test_deps _muxer _demuxer \
  1766. aiff \
  1767. pcm_alaw=alaw \
  1768. asf \
  1769. au \
  1770. avi \
  1771. dv=dv_fmt \
  1772. ffm \
  1773. flv=flv_fmt \
  1774. gxf \
  1775. matroska=mkv \
  1776. mmf \
  1777. mov="mov ismv" \
  1778. pcm_mulaw=mulaw \
  1779. mxf="mxf mxf_d10" \
  1780. nut \
  1781. ogg="ogg ogg_vp3" \
  1782. rawvideo=pixfmt \
  1783. rm \
  1784. swf \
  1785. mpegts=ts \
  1786. voc \
  1787. wav \
  1788. yuv4mpegpipe=yuv4mpeg \
  1789. # default parameters
  1790. logfile="config.log"
  1791. # installation paths
  1792. prefix_default="/usr/local"
  1793. bindir_default='${prefix}/bin'
  1794. datadir_default='${prefix}/share/ffmpeg'
  1795. incdir_default='${prefix}/include'
  1796. libdir_default='${prefix}/lib'
  1797. mandir_default='${prefix}/share/man'
  1798. shlibdir_default="$libdir_default"
  1799. postproc_version_default="current"
  1800. # toolchain
  1801. ar_default="ar"
  1802. cc_default="gcc"
  1803. cxx_default="g++"
  1804. host_cc_default="gcc"
  1805. install="install"
  1806. ln_s="ln -sf"
  1807. nm_default="nm"
  1808. objformat="elf"
  1809. pkg_config_default=pkg-config
  1810. ranlib="ranlib"
  1811. strip_default="strip"
  1812. yasmexe_default="yasm"
  1813. nm_opts='-g'
  1814. nogas=":"
  1815. # machine
  1816. arch_default=$(uname -m)
  1817. cpu="generic"
  1818. # OS
  1819. target_os_default=$(tolower $(uname -s))
  1820. host_os=$target_os_default
  1821. # alternative libpostproc version
  1822. ALT_PP_VER_MAJOR=51
  1823. ALT_PP_VER_MINOR=2
  1824. ALT_PP_VER_MICRO=101
  1825. ALT_PP_VER=$ALT_PP_VER_MAJOR.$ALT_PP_VER_MINOR.$ALT_PP_VER_MICRO
  1826. # configurable options
  1827. enable $PROGRAM_LIST
  1828. enable $DOCUMENT_LIST
  1829. enable avcodec
  1830. enable avdevice
  1831. enable avfilter
  1832. enable avformat
  1833. enable avutil
  1834. enable postproc
  1835. enable stripping
  1836. enable swresample
  1837. enable swscale
  1838. enable asm
  1839. enable debug
  1840. enable doc
  1841. enable network
  1842. enable optimizations
  1843. enable safe_bitstream_reader
  1844. enable static
  1845. enable swscale_alpha
  1846. # build settings
  1847. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1848. FFSERVERLDFLAGS=-Wl,-E
  1849. LIBPREF="lib"
  1850. LIBSUF=".a"
  1851. FULLNAME='$(NAME)$(BUILDSUF)'
  1852. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1853. SLIBPREF="lib"
  1854. SLIBSUF=".so"
  1855. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1856. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1857. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1858. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1859. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  1860. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  1861. asflags_filter=echo
  1862. cflags_filter=echo
  1863. ldflags_filter=echo
  1864. AS_C='-c'
  1865. AS_O='-o $@'
  1866. CC_C='-c'
  1867. CC_E='-E -o $@'
  1868. CC_O='-o $@'
  1869. CXX_C='-c'
  1870. CXX_O='-o $@'
  1871. LD_O='-o $@'
  1872. FORCE_INC="-include"
  1873. HOSTCC_C='-c'
  1874. HOSTCC_O='-o $@'
  1875. host_cflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600 -O3 -g'
  1876. host_libs='-lm'
  1877. host_cflags_filter=echo
  1878. host_ldflags_filter=echo
  1879. target_path='$(CURDIR)'
  1880. # since the object filename is not given with the -MM flag, the compiler
  1881. # is only able to print the basename, and we must add the path ourselves
  1882. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1883. DEPFLAGS='-MM'
  1884. # find source path
  1885. if test -f configure; then
  1886. source_path=.
  1887. else
  1888. source_path=$(cd $(dirname "$0"); pwd)
  1889. echo "$source_path" | grep -q '[[:blank:]]' &&
  1890. die "Out of tree builds are impossible with whitespace in source path."
  1891. test -e "$source_path/config.h" &&
  1892. die "Out of tree builds are impossible with config.h in source dir."
  1893. fi
  1894. for v in "$@"; do
  1895. r=${v#*=}
  1896. l=${v%"$r"}
  1897. r=$(sh_quote "$r")
  1898. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1899. done
  1900. find_things(){
  1901. thing=$1
  1902. pattern=$2
  1903. file=$source_path/$3
  1904. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1905. }
  1906. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1907. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1908. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1909. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1910. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1911. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1912. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1913. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1914. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1915. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1916. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1917. ALL_COMPONENTS="
  1918. $BSF_LIST
  1919. $DECODER_LIST
  1920. $DEMUXER_LIST
  1921. $ENCODER_LIST
  1922. $FILTER_LIST
  1923. $HWACCEL_LIST
  1924. $INDEV_LIST
  1925. $MUXER_LIST
  1926. $OUTDEV_LIST
  1927. $PARSER_LIST
  1928. $PROTOCOL_LIST
  1929. "
  1930. find_tests(){
  1931. map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
  1932. }
  1933. LAVF_FATE_TESTS=$(find_tests lavf-fate)
  1934. LAVF_TESTS=$(find_tests lavf)
  1935. LAVFI_TESTS=$(find_tests lavfi)
  1936. SEEK_TESTS=$(find_tests seek seek_)
  1937. ALL_TESTS="$LAVF_FATE_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS"
  1938. for n in $COMPONENT_LIST; do
  1939. v=$(toupper ${n%s})_LIST
  1940. eval enable \$$v
  1941. eval ${n}_if_any="\$$v"
  1942. done
  1943. enable $ARCH_EXT_LIST $ALL_TESTS
  1944. die_unknown(){
  1945. echo "Unknown option \"$1\"."
  1946. echo "See $0 --help for available options."
  1947. exit 1
  1948. }
  1949. show_list() {
  1950. suffix=_$1
  1951. shift
  1952. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1953. exit 0
  1954. }
  1955. rand_list(){
  1956. IFS=', '
  1957. set -- $*
  1958. unset IFS
  1959. for thing; do
  1960. comp=${thing%:*}
  1961. prob=${thing#$comp}
  1962. prob=${prob#:}
  1963. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  1964. echo "prob ${prob:-0.5}"
  1965. printf '%s\n' $comp
  1966. done
  1967. }
  1968. do_random(){
  1969. action=$1
  1970. shift
  1971. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  1972. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  1973. }
  1974. for opt do
  1975. optval="${opt#*=}"
  1976. case "$opt" in
  1977. --extra-ldflags=*) add_ldflags $optval
  1978. ;;
  1979. --extra-libs=*) add_extralibs $optval
  1980. ;;
  1981. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1982. ;;
  1983. --enable-debug=*) debuglevel="$optval"
  1984. ;;
  1985. --disable-everything)
  1986. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1987. ;;
  1988. --enable-random|--disable-random)
  1989. action=${opt%%-random}
  1990. do_random ${action#--} $COMPONENT_LIST
  1991. ;;
  1992. --enable-random=*|--disable-random=*)
  1993. action=${opt%%-random=*}
  1994. do_random ${action#--} $optval
  1995. ;;
  1996. --enable-*=*|--disable-*=*)
  1997. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1998. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1999. eval list=\$$(toupper $thing)_LIST
  2000. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  2001. $action $(filter "$name" $list)
  2002. ;;
  2003. --enable-?*|--disable-?*)
  2004. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  2005. if is_in $option $COMPONENT_LIST; then
  2006. test $action = disable && action=unset
  2007. eval $action \$$(toupper ${option%s})_LIST
  2008. elif is_in $option $CMDLINE_SELECT; then
  2009. $action $option
  2010. else
  2011. die_unknown $opt
  2012. fi
  2013. ;;
  2014. --list-*)
  2015. NAME="${opt#--list-}"
  2016. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  2017. NAME=${NAME%s}
  2018. eval show_list $NAME \$$(toupper $NAME)_LIST
  2019. ;;
  2020. --help|-h) show_help
  2021. ;;
  2022. *)
  2023. optname="${opt%%=*}"
  2024. optname="${optname#--}"
  2025. optname=$(echo "$optname" | sed 's/-/_/g')
  2026. if is_in $optname $CMDLINE_SET; then
  2027. eval $optname='$optval'
  2028. elif is_in $optname $CMDLINE_APPEND; then
  2029. append $optname "$optval"
  2030. else
  2031. die_unknown $opt
  2032. fi
  2033. ;;
  2034. esac
  2035. done
  2036. disabled logging && logfile=/dev/null
  2037. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  2038. set >> $logfile
  2039. test -n "$cross_prefix" && enable cross_compile
  2040. if enabled cross_compile; then
  2041. test -n "$arch" && test -n "$target_os" ||
  2042. die "Must specify target arch and OS when cross-compiling"
  2043. fi
  2044. set_default arch target_os postproc_version
  2045. # Check if we should build alternative libpostproc version instead of current
  2046. if test "$postproc_version" = $ALT_PP_VER; then
  2047. LIBPOSTPROC_VERSION=$ALT_PP_VER
  2048. LIBPOSTPROC_VERSION_MAJOR=$ALT_PP_VER_MAJOR
  2049. LIBPOSTPROC_VERSION_MINOR=$ALT_PP_VER_MINOR
  2050. LIBPOSTPROC_VERSION_MICRO=$ALT_PP_VER_MICRO
  2051. elif test "$postproc_version" != current; then
  2052. die "Invalid argument to --postproc-version. See --help output."
  2053. fi
  2054. ar_default="${cross_prefix}${ar_default}"
  2055. cc_default="${cross_prefix}${cc_default}"
  2056. cxx_default="${cross_prefix}${cxx_default}"
  2057. nm_default="${cross_prefix}${nm_default}"
  2058. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2059. ranlib="${cross_prefix}${ranlib}"
  2060. strip_default="${cross_prefix}${strip_default}"
  2061. sysinclude_default="${sysroot}/usr/include"
  2062. set_default cc cxx nm pkg_config strip sysinclude yasmexe
  2063. enabled cross_compile || host_cc_default=$cc
  2064. set_default host_cc
  2065. if ! $pkg_config --version >/dev/null 2>&1; then
  2066. warn "$pkg_config not found, library detection may fail."
  2067. pkg_config=false
  2068. fi
  2069. exesuf() {
  2070. case $1 in
  2071. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2072. esac
  2073. }
  2074. EXESUF=$(exesuf $target_os)
  2075. HOSTEXESUF=$(exesuf $host_os)
  2076. # set temporary file name
  2077. : ${TMPDIR:=$TEMPDIR}
  2078. : ${TMPDIR:=$TMP}
  2079. : ${TMPDIR:=/tmp}
  2080. if ! check_cmd mktemp -u XXXXXX; then
  2081. # simple replacement for missing mktemp
  2082. # NOT SAFE FOR GENERAL USE
  2083. mktemp(){
  2084. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2085. }
  2086. fi
  2087. tmpfile(){
  2088. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2089. (set -C; exec > $tmp) 2>/dev/null ||
  2090. die "Unable to create temporary file in $TMPDIR."
  2091. append TMPFILES $tmp
  2092. eval $1=$tmp
  2093. }
  2094. trap 'rm -f -- $TMPFILES' EXIT
  2095. tmpfile TMPASM .asm
  2096. tmpfile TMPC .c
  2097. tmpfile TMPCPP .cpp
  2098. tmpfile TMPE $EXESUF
  2099. tmpfile TMPH .h
  2100. tmpfile TMPO .o
  2101. tmpfile TMPS .S
  2102. tmpfile TMPSH .sh
  2103. tmpfile TMPV .ver
  2104. unset -f mktemp
  2105. chmod +x $TMPE
  2106. # make sure we can execute files in $TMPDIR
  2107. cat > $TMPSH 2>> $logfile <<EOF
  2108. #! /bin/sh
  2109. EOF
  2110. chmod +x $TMPSH >> $logfile 2>&1
  2111. if ! $TMPSH >> $logfile 2>&1; then
  2112. cat <<EOF
  2113. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2114. variable to another directory and make sure that it is not mounted noexec.
  2115. EOF
  2116. die "Sanity test failed."
  2117. fi
  2118. pgi_flags(){
  2119. for flag; do
  2120. case $flag in
  2121. -fomit-frame-pointer) echo -Mnoframe ;;
  2122. -g) echo -gopt ;;
  2123. *) echo $flag ;;
  2124. esac
  2125. done
  2126. }
  2127. suncc_flags(){
  2128. for flag; do
  2129. case $flag in
  2130. -march=*|-mcpu=*)
  2131. case "${flag#*=}" in
  2132. native) echo -xtarget=native ;;
  2133. v9|niagara) echo -xarch=sparc ;;
  2134. ultrasparc) echo -xarch=sparcvis ;;
  2135. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2136. i586|pentium) echo -xchip=pentium ;;
  2137. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2138. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2139. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2140. pentium4*) echo -xtarget=pentium4 ;;
  2141. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2142. *-sse3) echo -xarch=sse3 ;;
  2143. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2144. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  2145. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2146. k8|opteron|athlon64|athlon-fx)
  2147. echo -xarch=sse2a ;;
  2148. athlon*) echo -xarch=pentium_proa ;;
  2149. esac
  2150. ;;
  2151. -std=c99) echo -xc99 ;;
  2152. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2153. -fPIC) echo -KPIC -xcode=pic32 ;;
  2154. -W*,*) echo $flag ;;
  2155. -f*-*|-W*) ;;
  2156. *) echo $flag ;;
  2157. esac
  2158. done
  2159. }
  2160. tms470_flags(){
  2161. for flag; do
  2162. case $flag in
  2163. -march=*|-mcpu=*)
  2164. case "${flag#*=}" in
  2165. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2166. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2167. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2168. armv6*|arm11*) echo -mv=6 ;;
  2169. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2170. echo -mv=5e ;;
  2171. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2172. esac
  2173. ;;
  2174. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2175. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2176. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2177. -msoft-float) echo --float_support=vfplib ;;
  2178. -O[0-3]|-mf=*) echo $flag ;;
  2179. -g) echo -g -mn ;;
  2180. -pds=*) echo $flag ;;
  2181. -D*|-I*) echo $flag ;;
  2182. --gcc|--abi=*) echo $flag ;;
  2183. -me) echo $flag ;;
  2184. esac
  2185. done
  2186. }
  2187. probe_cc(){
  2188. pfx=$1
  2189. _cc=$2
  2190. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags _ldflags
  2191. unset _depflags _DEPCMD _DEPFLAGS
  2192. _flags_filter=echo
  2193. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2194. _type=llvm_gcc
  2195. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2196. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2197. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2198. _cflags_speed='-O3'
  2199. _cflags_size='-Os'
  2200. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2201. _type=gcc
  2202. gcc_version=$($_cc --version | head -n1)
  2203. gcc_basever=$($_cc -dumpversion)
  2204. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2205. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2206. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2207. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2208. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2209. fi
  2210. _cflags_speed='-O3'
  2211. _cflags_size='-Os'
  2212. elif $_cc --version 2>/dev/null | grep -q Intel; then
  2213. _type=icc
  2214. _ident=$($_cc --version | head -n1)
  2215. _depflags='-MMD'
  2216. _cflags_speed='-O3'
  2217. _cflags_size='-Os'
  2218. _cflags_noopt='-O1'
  2219. elif $_cc -v 2>&1 | grep -q xlc; then
  2220. _type=xlc
  2221. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2222. _cflags_speed='-O5'
  2223. _cflags_size='-O5 -qcompact'
  2224. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2225. _type=ccc
  2226. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2227. _DEPFLAGS='-M'
  2228. debuglevel=3
  2229. _ldflags='-Wl,-z,now' # calls to libots crash without this
  2230. _cflags_speed='-fast'
  2231. _cflags_size='-O1'
  2232. elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  2233. test -d "$sysroot" || die "No valid sysroot specified."
  2234. _type=armcc
  2235. _ident=$($_cc --vsn | head -n1)
  2236. armcc_conf="$PWD/armcc.conf"
  2237. $_cc --arm_linux_configure \
  2238. --arm_linux_config_file="$armcc_conf" \
  2239. --configure_sysroot="$sysroot" \
  2240. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2241. die "Error creating armcc configuration file."
  2242. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2243. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2244. as_default="${cross_prefix}gcc"
  2245. _depflags='-MMD'
  2246. _cflags_speed='-O3'
  2247. _cflags_size='-Os'
  2248. elif $_cc -version 2>/dev/null | grep -q TMS470; then
  2249. _type=tms470
  2250. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2251. _flags='--gcc --abi=eabi -me'
  2252. _cflags='-D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__='
  2253. _cc_e='-ppl -fe=$@'
  2254. _cc_o='-fe=$@'
  2255. as_default="${cross_prefix}gcc"
  2256. ld_default="${cross_prefix}gcc"
  2257. _depflags='-ppa -ppd=$(@:.o=.d)'
  2258. _cflags_speed='-O3 -mf=5'
  2259. _cflags_size='-O3 -mf=2'
  2260. _flags_filter=tms470_flags
  2261. elif $_cc -v 2>&1 | grep -q clang; then
  2262. _type=clang
  2263. _ident=$($_cc --version | head -n1)
  2264. _depflags='-MMD'
  2265. _cflags_speed='-O3'
  2266. _cflags_size='-Os'
  2267. elif $_cc -V 2>&1 | grep -q Sun; then
  2268. _type=suncc
  2269. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2270. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2271. _DEPFLAGS='-xM1 -xc99'
  2272. _ldflags='-std=c99'
  2273. _cflags_speed='-O5'
  2274. _cflags_size='-O5 -xspace'
  2275. _flags_filter=suncc_flags
  2276. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2277. _type=pathscale
  2278. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2279. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2280. _cflags_speed='-O2'
  2281. _cflags_size='-Os'
  2282. _flags_filter='filter_out -Wdisabled-optimization'
  2283. elif $_cc -v 2>&1 | grep -q Open64; then
  2284. _type=open64
  2285. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2286. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2287. _cflags_speed='-O2'
  2288. _cflags_size='-Os'
  2289. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2290. elif $_cc -V 2>&1 | grep -q Portland; then
  2291. _type=pgi
  2292. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2293. opt_common='-alias=ansi -Mlre -Mpre'
  2294. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2295. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2296. _cflags_noopt="-O1"
  2297. _flags_filter=pgi_flags
  2298. fi
  2299. eval ${pfx}_type=\$_type
  2300. eval ${pfx}_ident=\$_ident
  2301. }
  2302. set_ccvars(){
  2303. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2304. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2305. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2306. if [ -n "$_depflags" ]; then
  2307. eval ${1}_DEPFLAGS=\$_depflags
  2308. else
  2309. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2310. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2311. eval DEP${1}FLAGS=\$_flags
  2312. fi
  2313. }
  2314. probe_cc cc "$cc"
  2315. cflags_filter=$_flags_filter
  2316. cflags_speed=$_cflags_speed
  2317. cflags_size=$_cflags_size
  2318. cflags_noopt=$_cflags_noopt
  2319. add_cflags $_flags $_cflags
  2320. cc_ldflags=$_ldflags
  2321. set_ccvars CC
  2322. probe_cc hostcc "$host_cc"
  2323. host_cflags_filter=$_flags_filter
  2324. host_ldflags_filter=$_flags_filter
  2325. add_host_cflags $_flags $_cflags
  2326. add_host_ldflags $_flags $_ldflags
  2327. set_ccvars HOSTCC
  2328. test -n "$cc_type" && enable $cc_type ||
  2329. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2330. : ${as_default:=$cc}
  2331. : ${dep_cc_default:=$cc}
  2332. : ${ld_default:=$cc}
  2333. set_default ar as dep_cc ld
  2334. probe_cc as "$as"
  2335. asflags_filter=$_flags_filter
  2336. add_asflags $_flags $_cflags
  2337. set_ccvars AS
  2338. probe_cc ld "$ld"
  2339. ldflags_filter=$_flags_filter
  2340. add_ldflags $_flags $_ldflags
  2341. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2342. LD_O=${_cc_o-$LD_O}
  2343. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2344. probe_cc depcc "$dep_cc"
  2345. CCDEP=${_DEPCMD:-$DEPCMD}
  2346. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2347. DEPCCFLAGS=$_flags
  2348. fi
  2349. add_cflags $extra_cflags
  2350. add_cxxflags $extra_cxxflags
  2351. add_asflags $extra_cflags
  2352. if test -n "$sysroot"; then
  2353. case "$cc_type" in
  2354. gcc|llvm_gcc|clang)
  2355. add_cppflags --sysroot="$sysroot"
  2356. add_ldflags --sysroot="$sysroot"
  2357. ;;
  2358. tms470)
  2359. add_cppflags -I"$sysinclude"
  2360. add_ldflags --sysroot="$sysroot"
  2361. ;;
  2362. esac
  2363. fi
  2364. if test "$cpu" = host; then
  2365. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  2366. case "$cc_type" in
  2367. gcc|llvm_gcc)
  2368. check_native(){
  2369. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2370. sed -n "/cc1.*$1=/{
  2371. s/.*$1=\\([^ ]*\\).*/\\1/
  2372. p
  2373. q
  2374. }" $TMPE
  2375. }
  2376. cpu=$(check_native -march || check_native -mcpu)
  2377. ;;
  2378. esac
  2379. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  2380. fi
  2381. # Deal with common $arch aliases
  2382. case "$arch" in
  2383. arm*|iPad*)
  2384. arch="arm"
  2385. ;;
  2386. mips|mipsel|IP*)
  2387. arch="mips"
  2388. ;;
  2389. mips64*)
  2390. arch="mips"
  2391. subarch="mips64"
  2392. ;;
  2393. parisc|hppa)
  2394. arch="parisc"
  2395. ;;
  2396. parisc64|hppa64)
  2397. arch="parisc"
  2398. subarch="parisc64"
  2399. ;;
  2400. "Power Macintosh"|ppc|powerpc|ppc64|powerpc64)
  2401. arch="ppc"
  2402. ;;
  2403. s390|s390x)
  2404. arch="s390"
  2405. ;;
  2406. sh4|sh)
  2407. arch="sh4"
  2408. ;;
  2409. sun4u|sparc64)
  2410. arch="sparc"
  2411. subarch="sparc64"
  2412. ;;
  2413. i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  2414. arch="x86"
  2415. ;;
  2416. esac
  2417. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2418. enable $arch
  2419. # Add processor-specific flags
  2420. if test "$cpu" = generic; then
  2421. : do nothing
  2422. elif enabled ppc; then
  2423. case $(tolower $cpu) in
  2424. 601|ppc601|powerpc601)
  2425. cpuflags="-mcpu=601"
  2426. disable altivec
  2427. ;;
  2428. 603*|ppc603*|powerpc603*)
  2429. cpuflags="-mcpu=603"
  2430. disable altivec
  2431. ;;
  2432. 604*|ppc604*|powerpc604*)
  2433. cpuflags="-mcpu=604"
  2434. disable altivec
  2435. ;;
  2436. g3|75*|ppc75*|powerpc75*)
  2437. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  2438. disable altivec
  2439. ;;
  2440. g4|745*|ppc745*|powerpc745*)
  2441. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  2442. ;;
  2443. 74*|ppc74*|powerpc74*)
  2444. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  2445. ;;
  2446. g5|970|ppc970|powerpc970)
  2447. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  2448. ;;
  2449. power[3-7]*)
  2450. cpuflags="-mcpu=$cpu -mpowerpc-gfxopt -mpowerpc64"
  2451. ;;
  2452. cell)
  2453. cpuflags="-mcpu=cell"
  2454. enable ldbrx
  2455. ;;
  2456. e500mc)
  2457. cpuflags="-mcpu=e500mc"
  2458. disable altivec
  2459. ;;
  2460. e500v2)
  2461. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2462. disable altivec
  2463. ;;
  2464. e500)
  2465. cpuflags="-mcpu=8540 -mhard-float"
  2466. disable altivec
  2467. ;;
  2468. esac
  2469. elif enabled x86; then
  2470. case $cpu in
  2471. i[345]86|pentium)
  2472. cpuflags="-march=$cpu"
  2473. disable mmx
  2474. ;;
  2475. # targets that do NOT support conditional mov (cmov)
  2476. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2477. cpuflags="-march=$cpu"
  2478. disable cmov
  2479. ;;
  2480. # targets that do support conditional mov (cmov)
  2481. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom)
  2482. cpuflags="-march=$cpu"
  2483. enable cmov
  2484. enable fast_cmov
  2485. ;;
  2486. # targets that do support conditional mov but on which it's slow
  2487. pentium4|pentium4m|prescott|nocona)
  2488. cpuflags="-march=$cpu"
  2489. enable cmov
  2490. disable fast_cmov
  2491. ;;
  2492. esac
  2493. elif enabled sparc; then
  2494. case $cpu in
  2495. niagara)
  2496. cpuflags="-mcpu=$cpu"
  2497. disable vis
  2498. ;;
  2499. sparc64)
  2500. cpuflags="-mcpu=v9"
  2501. ;;
  2502. esac
  2503. elif enabled arm; then
  2504. case $cpu in
  2505. armv*)
  2506. cpuflags="-march=$cpu"
  2507. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2508. ;;
  2509. *)
  2510. cpuflags="-mcpu=$cpu"
  2511. case $cpu in
  2512. cortex-a*) subarch=armv7a ;;
  2513. cortex-r*) subarch=armv7r ;;
  2514. cortex-m*) enable thumb; subarch=armv7m ;;
  2515. arm11*) subarch=armv6 ;;
  2516. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2517. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2518. esac
  2519. ;;
  2520. esac
  2521. elif enabled alpha; then
  2522. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  2523. elif enabled bfin; then
  2524. cpuflags="-mcpu=$cpu"
  2525. elif enabled mips; then
  2526. cpuflags="-march=$cpu"
  2527. case $cpu in
  2528. 24kc)
  2529. disable mipsfpu
  2530. disable mipsdspr1
  2531. disable mipsdspr2
  2532. ;;
  2533. 24kf*)
  2534. disable mipsdspr1
  2535. disable mipsdspr2
  2536. ;;
  2537. 24kec|34kc|1004kc)
  2538. disable mipsfpu
  2539. disable mipsdspr2
  2540. ;;
  2541. 24kef*|34kf*|1004kf*)
  2542. disable mipsdspr2
  2543. ;;
  2544. 74kc)
  2545. disable mipsfpu
  2546. ;;
  2547. esac
  2548. elif enabled avr32; then
  2549. case $cpu in
  2550. ap7[02]0[0-2])
  2551. subarch="avr32_ap"
  2552. cpuflags="-mpart=$cpu"
  2553. ;;
  2554. ap)
  2555. subarch="avr32_ap"
  2556. cpuflags="-march=$cpu"
  2557. ;;
  2558. uc3[ab]*)
  2559. subarch="avr32_uc"
  2560. cpuflags="-mcpu=$cpu"
  2561. ;;
  2562. uc)
  2563. subarch="avr32_uc"
  2564. cpuflags="-march=$cpu"
  2565. ;;
  2566. esac
  2567. fi
  2568. add_cflags $cpuflags
  2569. add_asflags $cpuflags
  2570. # compiler sanity check
  2571. check_exec <<EOF
  2572. int main(void){ return 0; }
  2573. EOF
  2574. if test "$?" != 0; then
  2575. echo "$cc is unable to create an executable file."
  2576. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2577. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2578. echo "Only do this if you know what cross compiling means."
  2579. fi
  2580. die "C compiler test failed."
  2581. fi
  2582. add_cppflags -D_ISOC99_SOURCE
  2583. add_cxxflags -D__STDC_CONSTANT_MACROS
  2584. check_cflags -std=c99
  2585. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2586. #include <stdlib.h>
  2587. EOF
  2588. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2589. #include <stdlib.h>
  2590. EOF
  2591. check_host_cflags -std=c99
  2592. check_host_cflags -Wall
  2593. case "$arch" in
  2594. alpha|ia64|mips|parisc|sparc)
  2595. spic=$shared
  2596. ;;
  2597. x86)
  2598. subarch="x86_32"
  2599. check_code cc "" "int test[(int)sizeof(char*) - 7]" && subarch="x86_64"
  2600. if test "$subarch" = "x86_64"; then
  2601. spic=$shared
  2602. fi
  2603. ;;
  2604. ppc)
  2605. check_cc <<EOF && subarch="ppc64"
  2606. int test[(int)sizeof(char*) - 7];
  2607. EOF
  2608. ;;
  2609. esac
  2610. enable $subarch
  2611. enabled spic && enable pic
  2612. # OS specific
  2613. case $target_os in
  2614. haiku)
  2615. prefix_default="/boot/common"
  2616. network_extralibs="-lnetwork"
  2617. host_libs=
  2618. ;;
  2619. sunos)
  2620. FFSERVERLDFLAGS=""
  2621. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2622. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2623. network_extralibs="-lsocket -lnsl"
  2624. add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  2625. # When using suncc to build, the Solaris linker will mark
  2626. # an executable with each instruction set encountered by
  2627. # the Solaris assembler. As our libraries contain their own
  2628. # guards for processor-specific code, instead suppress
  2629. # generation of the HWCAPS ELF section on Solaris x86 only.
  2630. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  2631. nm_opts='-P -g'
  2632. ;;
  2633. netbsd)
  2634. disable symver
  2635. oss_indev_extralibs="-lossaudio"
  2636. oss_outdev_extralibs="-lossaudio"
  2637. ;;
  2638. openbsd|bitrig)
  2639. # On OpenBSD 4.5. the compiler does not use PIC unless
  2640. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  2641. # however the generated executable will not do anything
  2642. # (simply quits with exit-code 1, no crash, no output).
  2643. # Thus explicitly enable PIC here.
  2644. enable pic
  2645. disable symver
  2646. SHFLAGS='-shared'
  2647. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBVERSION)'
  2648. SLIB_INSTALL_LINKS=
  2649. oss_indev_extralibs="-lossaudio"
  2650. oss_outdev_extralibs="-lossaudio"
  2651. ;;
  2652. dragonfly)
  2653. disable symver
  2654. ;;
  2655. freebsd)
  2656. ;;
  2657. bsd/os)
  2658. add_extralibs -lpoll -lgnugetopt
  2659. strip="strip -d"
  2660. ;;
  2661. darwin)
  2662. gas="gas-preprocessor.pl $cc"
  2663. enabled ppc && add_asflags -force_cpusubtype_ALL
  2664. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  2665. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  2666. strip="${strip} -x"
  2667. add_ldflags -Wl,-dynamic,-search_paths_first
  2668. SLIBSUF=".dylib"
  2669. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2670. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2671. FFSERVERLDFLAGS=-Wl,-bind_at_load
  2672. objformat="macho"
  2673. enabled x86_64 && objformat="macho64"
  2674. enabled_any pic shared ||
  2675. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2676. ;;
  2677. mingw32*)
  2678. if test $target_os = "mingw32ce"; then
  2679. disable network
  2680. else
  2681. target_os=mingw32
  2682. fi
  2683. LIBTARGET=i386
  2684. if enabled x86_64; then
  2685. LIBTARGET="i386:x86-64"
  2686. elif enabled arm; then
  2687. LIBTARGET=arm-wince
  2688. fi
  2689. shlibdir_default="$bindir_default"
  2690. SLIBPREF=""
  2691. SLIBSUF=".dll"
  2692. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2693. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2694. dlltool="${cross_prefix}dlltool"
  2695. if check_cmd lib.exe -list; then
  2696. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  2697. if enabled x86_64; then
  2698. LIBTARGET=x64
  2699. fi
  2700. elif check_cmd $dlltool --version; then
  2701. SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
  2702. fi
  2703. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2704. SLIB_INSTALL_LINKS=
  2705. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2706. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2707. 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'
  2708. objformat="win32"
  2709. enable dos_paths
  2710. check_cflags -fno-common
  2711. check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
  2712. || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2713. die "ERROR: MinGW runtime version must be >= 3.15."
  2714. add_cppflags -U__STRICT_ANSI__
  2715. ;;
  2716. cygwin*)
  2717. target_os=cygwin
  2718. shlibdir_default="$bindir_default"
  2719. SLIBPREF="cyg"
  2720. SLIBSUF=".dll"
  2721. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2722. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2723. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2724. SLIB_INSTALL_LINKS=
  2725. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  2726. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  2727. objformat="win32"
  2728. enable dos_paths
  2729. check_cflags -fno-common
  2730. add_cppflags -U__STRICT_ANSI__
  2731. ;;
  2732. *-dos|freedos|opendos)
  2733. network_extralibs="-lsocket"
  2734. objformat="coff"
  2735. enable dos_paths
  2736. add_cppflags -U__STRICT_ANSI__
  2737. ;;
  2738. linux)
  2739. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2740. enable dv1394
  2741. ;;
  2742. irix*)
  2743. target_os=irix
  2744. ranlib="echo ignoring ranlib"
  2745. ;;
  2746. os/2*)
  2747. strip="lxlite -CS"
  2748. ln_s="cp -f"
  2749. objformat="aout"
  2750. add_cppflags -D_GNU_SOURCE
  2751. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2752. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2753. FFSERVERLDFLAGS=""
  2754. LIBSUF="_s.a"
  2755. SLIBPREF=""
  2756. SLIBSUF=".dll"
  2757. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2758. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2759. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2760. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2761. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2762. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2763. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2764. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2765. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2766. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2767. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  2768. enable dos_paths
  2769. enable_weak os2threads
  2770. ;;
  2771. gnu/kfreebsd)
  2772. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
  2773. ;;
  2774. gnu)
  2775. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2776. ;;
  2777. qnx)
  2778. add_cppflags -D_QNX_SOURCE
  2779. network_extralibs="-lsocket"
  2780. ;;
  2781. symbian)
  2782. SLIBSUF=".dll"
  2783. enable dos_paths
  2784. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  2785. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  2786. add_ldflags -Wl,--target1-abs,--no-undefined \
  2787. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  2788. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  2789. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  2790. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  2791. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  2792. ;;
  2793. none)
  2794. ;;
  2795. *)
  2796. die "Unknown OS '$target_os'."
  2797. ;;
  2798. esac
  2799. esc(){
  2800. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  2801. }
  2802. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
  2803. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2804. set_default $PATHS_LIST
  2805. # we need to build at least one lib type
  2806. if ! enabled_any static shared; then
  2807. cat <<EOF
  2808. At least one library type must be built.
  2809. Specify --enable-static to build the static libraries or --enable-shared to
  2810. build the shared libraries as well. To only build the shared libraries specify
  2811. --disable-static in addition to --enable-shared.
  2812. EOF
  2813. exit 1;
  2814. fi
  2815. die_license_disabled() {
  2816. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2817. }
  2818. die_license_disabled_gpl() {
  2819. enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; }
  2820. }
  2821. die_license_disabled gpl libcdio
  2822. die_license_disabled gpl libutvideo
  2823. die_license_disabled gpl libx264
  2824. die_license_disabled gpl libxavs
  2825. die_license_disabled gpl libxvid
  2826. die_license_disabled gpl x11grab
  2827. die_license_disabled nonfree libaacplus
  2828. die_license_disabled nonfree libfaac
  2829. enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
  2830. enabled gpl && die_license_disabled_gpl nonfree openssl
  2831. die_license_disabled version3 libopencore_amrnb
  2832. die_license_disabled version3 libopencore_amrwb
  2833. die_license_disabled version3 libvo_aacenc
  2834. die_license_disabled version3 libvo_amrwbenc
  2835. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2836. disabled optimizations || check_cflags -fomit-frame-pointer
  2837. enable_pic() {
  2838. enable pic
  2839. add_cppflags -DPIC
  2840. add_cflags -fPIC
  2841. add_asflags -fPIC
  2842. }
  2843. enabled pic && enable_pic
  2844. check_cc <<EOF || die "Symbol mangling check failed."
  2845. int ff_extern;
  2846. EOF
  2847. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2848. extern_prefix=${sym%%ff_extern*}
  2849. check_cc <<EOF && enable inline_asm
  2850. void foo(void) { __asm__ volatile ("" ::); }
  2851. EOF
  2852. _restrict=
  2853. for restrict_keyword in restrict __restrict__ __restrict; do
  2854. check_cc <<EOF && _restrict=$restrict_keyword && break
  2855. void foo(char * $restrict_keyword p);
  2856. EOF
  2857. done
  2858. check_cc <<EOF && enable attribute_packed
  2859. struct { int x; } __attribute__((packed)) x;
  2860. EOF
  2861. check_cc <<EOF && enable attribute_may_alias
  2862. union { int x; } __attribute__((may_alias)) x;
  2863. EOF
  2864. check_cc <<EOF || die "endian test failed"
  2865. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2866. EOF
  2867. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2868. if enabled alpha; then
  2869. check_cflags -mieee
  2870. elif enabled arm; then
  2871. enabled thumb && check_cflags -mthumb || check_cflags -marm
  2872. nogas=die
  2873. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2874. enable vfp_args
  2875. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2876. case "${cross_prefix:-$cc}" in
  2877. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2878. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2879. __asm__ (".eabi_attribute 28, 1");
  2880. int main(void) { return 0; }
  2881. EOF
  2882. esac
  2883. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2884. fi
  2885. enabled armv5te && check_inline_asm armv5te '"qadd r0, r0, r0"'
  2886. enabled armv6 && check_inline_asm armv6 '"sadd16 r0, r0, r0"'
  2887. enabled armv6t2 && check_inline_asm armv6t2 '"movt r0, #0"'
  2888. enabled armvfp && check_inline_asm armvfp '"fadds s0, s0, s0"'
  2889. enabled neon && check_inline_asm neon '"vadd.i16 q0, q0, q0"'
  2890. enabled vfpv3 && check_inline_asm vfpv3 '"vmov.f32 s0, #1.0"'
  2891. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  2892. check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  2893. enabled_all armv6t2 shared !pic && enable_pic
  2894. elif enabled mips; then
  2895. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  2896. enabled mmi && check_inline_asm mmi '"lq $2, 0($2)"'
  2897. enabled mips32r2 && add_cflags "-mips32r2" && add_asflags "-mips32r2" &&
  2898. check_inline_asm mips32r2 '"rotr $t0, $t1, 1"'
  2899. enabled mipsdspr1 && add_cflags "-mdsp" && add_asflags "-mdsp" &&
  2900. check_inline_asm mipsdspr1 '"addu.qb $t0, $t1, $t2"'
  2901. enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
  2902. check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
  2903. enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
  2904. check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"'
  2905. elif enabled ppc; then
  2906. enable local_aligned_8 local_aligned_16
  2907. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2908. check_inline_asm ibm_asm '"add 0, 0, 0"'
  2909. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  2910. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2911. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2912. if enabled altivec; then
  2913. nogas=warn
  2914. check_cflags -maltivec -mabi=altivec &&
  2915. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2916. check_cflags -faltivec
  2917. # check if our compiler supports Motorola AltiVec C API
  2918. check_cc <<EOF || disable altivec
  2919. $inc_altivec_h
  2920. int main(void) {
  2921. vector signed int v1 = (vector signed int) { 0 };
  2922. vector signed int v2 = (vector signed int) { 1 };
  2923. v1 = vec_add(v1, v2);
  2924. return 0;
  2925. }
  2926. EOF
  2927. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  2928. fi
  2929. elif enabled sparc; then
  2930. enabled vis &&
  2931. check_inline_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2932. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2933. elif enabled x86; then
  2934. check_code ld immintrin.h "__xgetbv(0)" "cc" && enable xgetbv
  2935. check_code ld intrin.h "int info[4]; __cpuid(info, 0)" "cc" && enable cpuid
  2936. check_code ld intrin.h "__rdtsc()" "cc" && enable rdtsc
  2937. check_code ld intrin.h "unsigned int x = __readeflags()" "cc" && enable rweflags
  2938. check_code ld mmintrin.h "_mm_empty()" "cc" && enable mm_empty
  2939. enable local_aligned_8 local_aligned_16
  2940. # check whether EBP is available on x86
  2941. # As 'i' is stored on the stack, this program will crash
  2942. # if the base pointer is used to access it because the
  2943. # base pointer is cleared in the inline assembly code.
  2944. check_exec_crash <<EOF && enable ebp_available
  2945. volatile int i=0;
  2946. __asm__ volatile (
  2947. "xorl %%ebp, %%ebp"
  2948. ::: "%ebp");
  2949. return i;
  2950. EOF
  2951. # check whether EBX is available on x86
  2952. check_inline_asm ebx_available '""::"b"(0)' &&
  2953. check_inline_asm ebx_available '"":::"%ebx"'
  2954. # check whether xmm clobbers are supported
  2955. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  2956. # check whether binutils is new enough to compile SSSE3/MMXEXT
  2957. enabled ssse3 && check_inline_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2958. enabled mmxext && check_inline_asm mmxext '"pmaxub %mm0, %mm1"'
  2959. if ! disabled_any asm mmx yasm; then
  2960. if check_cmd $yasmexe --version; then
  2961. enabled x86_64 && yasm_extra="-m amd64"
  2962. yasm_debug="-g dwarf2"
  2963. elif check_cmd nasm -v; then
  2964. yasmexe=nasm
  2965. yasm_debug="-g -F dwarf"
  2966. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  2967. fi
  2968. YASMFLAGS="-f $objformat $yasm_extra"
  2969. enabled pic && append YASMFLAGS "-DPIC"
  2970. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2971. case "$objformat" in
  2972. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  2973. esac
  2974. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  2975. die "yasm not found, use --disable-yasm for a crippled build"
  2976. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
  2977. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4
  2978. check_yasm "CPU amdnop" && enable cpunop
  2979. fi
  2980. case "$cpu" in
  2981. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2982. disable fast_clz
  2983. ;;
  2984. esac
  2985. fi
  2986. if enabled asm; then
  2987. as=${gas:=$as}
  2988. check_inline_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
  2989. $nogas "GNU assembler not found, install gas-preprocessor"
  2990. fi
  2991. check_ldflags -Wl,--as-needed
  2992. if check_func dlopen; then
  2993. ldl=
  2994. elif check_func dlopen -ldl; then
  2995. ldl=-ldl
  2996. fi
  2997. if enabled network; then
  2998. check_type "sys/types.h sys/socket.h" socklen_t
  2999. check_type netdb.h "struct addrinfo"
  3000. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3001. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3002. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3003. check_type netinet/in.h "struct sockaddr_in6"
  3004. check_type poll.h "struct pollfd"
  3005. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3006. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3007. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3008. check_func getaddrinfo $network_extralibs
  3009. # Prefer arpa/inet.h over winsock2
  3010. if check_header arpa/inet.h ; then
  3011. check_func closesocket
  3012. elif check_header winsock2.h ; then
  3013. check_func_headers winsock2.h closesocket -lws2 &&
  3014. network_extralibs="-lws2" ||
  3015. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3016. network_extralibs="-lws2_32"; }
  3017. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3018. check_type ws2tcpip.h socklen_t
  3019. check_type ws2tcpip.h "struct addrinfo"
  3020. check_type ws2tcpip.h "struct group_source_req"
  3021. check_type ws2tcpip.h "struct ip_mreq_source"
  3022. check_type ws2tcpip.h "struct ipv6_mreq"
  3023. check_type winsock2.h "struct pollfd"
  3024. check_type ws2tcpip.h "struct sockaddr_in6"
  3025. check_type ws2tcpip.h "struct sockaddr_storage"
  3026. check_struct winsock2.h "struct sockaddr" sa_len
  3027. else
  3028. disable network
  3029. fi
  3030. fi
  3031. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3032. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  3033. check_func clock_gettime || { check_func clock_gettime -lrt && add_extralibs -lrt; }
  3034. check_func fcntl
  3035. check_func fork
  3036. check_func gethrtime
  3037. check_func getopt
  3038. check_func getrusage
  3039. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3040. check_func gettimeofday
  3041. check_func inet_aton $network_extralibs
  3042. check_func isatty
  3043. check_func localtime_r
  3044. check_func ${malloc_prefix}memalign && enable memalign
  3045. check_func mkstemp
  3046. check_func mmap
  3047. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3048. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3049. check_func setrlimit
  3050. check_func snprintf
  3051. check_func strerror_r
  3052. check_func strptime
  3053. check_func sched_getaffinity
  3054. check_func sysconf
  3055. check_func sysctl
  3056. check_func usleep
  3057. check_func_headers conio.h kbhit
  3058. check_func_headers windows.h PeekNamedPipe
  3059. check_func_headers io.h setmode
  3060. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  3061. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3062. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3063. check_func_headers windows.h GetProcessAffinityMask
  3064. check_func_headers windows.h GetProcessTimes
  3065. check_func_headers windows.h GetSystemTimeAsFileTime
  3066. check_func_headers windows.h MapViewOfFile
  3067. check_func_headers windows.h Sleep
  3068. check_func_headers windows.h VirtualAlloc
  3069. check_func_headers glob.h glob
  3070. # Check for MSVCRT; it has a broken strtod() that can't parse some input.
  3071. # Use old dos symbol to detect it. If we are on mingw, it already provides
  3072. # its own replacement and we don't need to redo that.
  3073. if check_func _get_doserrno; then
  3074. if test $target_os != mingw32; then
  3075. enable broken_strtod
  3076. fi
  3077. fi
  3078. check_header dlfcn.h
  3079. check_header dxva.h
  3080. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  3081. check_header libcrystalhd/libcrystalhd_if.h
  3082. check_header malloc.h
  3083. check_header poll.h
  3084. check_header sys/mman.h
  3085. check_header sys/param.h
  3086. check_header sys/resource.h
  3087. check_header sys/select.h
  3088. check_header sys/time.h
  3089. check_header termios.h
  3090. check_header unistd.h
  3091. check_header vdpau/vdpau.h
  3092. check_header vdpau/vdpau_x11.h
  3093. check_header windows.h
  3094. check_header X11/extensions/XvMClib.h
  3095. check_header asm/types.h
  3096. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3097. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3098. # check for VDA header
  3099. if ! disabled vda; then
  3100. if check_header VideoDecodeAcceleration/VDADecoder.h; then
  3101. enable vda
  3102. add_extralibs -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore
  3103. fi
  3104. fi
  3105. if ! disabled w32threads && ! enabled pthreads; then
  3106. check_func _beginthreadex && enable w32threads
  3107. fi
  3108. # check for some common methods of building with pthread support
  3109. # do this before the optional library checks as some of them require pthreads
  3110. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  3111. enable pthreads
  3112. if check_func pthread_create; then
  3113. :
  3114. elif check_func pthread_create -pthread; then
  3115. add_cflags -pthread
  3116. add_extralibs -pthread
  3117. elif check_func pthread_create -pthreads; then
  3118. add_cflags -pthreads
  3119. add_extralibs -pthreads
  3120. elif check_func pthread_create -lpthreadGC2; then
  3121. add_extralibs -lpthreadGC2
  3122. elif ! check_lib pthread.h pthread_create -lpthread; then
  3123. disable pthreads
  3124. fi
  3125. fi
  3126. for thread in $THREADS_LIST; do
  3127. if enabled $thread; then
  3128. test -n "$thread_type" &&
  3129. die "ERROR: Only one thread type must be selected." ||
  3130. thread_type="$thread"
  3131. fi
  3132. done
  3133. if enabled pthreads; then
  3134. check_func pthread_cancel
  3135. fi
  3136. check_lib math.h sin -lm && LIBM="-lm"
  3137. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  3138. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  3139. check_mathfunc cbrtf
  3140. check_mathfunc exp2
  3141. check_mathfunc exp2f
  3142. check_mathfunc isinf
  3143. check_mathfunc isnan
  3144. check_mathfunc llrint
  3145. check_mathfunc llrintf
  3146. check_mathfunc log2
  3147. check_mathfunc log2f
  3148. check_mathfunc lrint
  3149. check_mathfunc lrintf
  3150. check_mathfunc rint
  3151. check_mathfunc round
  3152. check_mathfunc roundf
  3153. check_mathfunc trunc
  3154. check_mathfunc truncf
  3155. # these are off by default, so fail if requested and not available
  3156. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  3157. enabled fontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  3158. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3159. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3160. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  3161. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  3162. enabled libass && require_pkg_config libass ass/ass.h ass_library_init
  3163. enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray
  3164. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  3165. { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
  3166. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  3167. enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
  3168. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  3169. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  3170. 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"
  3171. enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
  3172. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  3173. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  3174. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  3175. enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
  3176. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  3177. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  3178. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  3179. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  3180. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  3181. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  3182. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  3183. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  3184. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  3185. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  3186. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  3187. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  3188. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  3189. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
  3190. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  3191. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  3192. { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  3193. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  3194. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  3195. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  3196. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  3197. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  3198. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  3199. enabled libvpx && {
  3200. enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  3201. die "ERROR: libvpx decoder must be installed and version must be >=0.9.1"; }
  3202. enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
  3203. die "ERROR: libvpx encoder version must be >=0.9.7"; } }
  3204. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  3205. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  3206. die "ERROR: libx264 must be installed and version must be >= 0.118."; }
  3207. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  3208. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  3209. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  3210. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  3211. die "ERROR: openal not found"; } &&
  3212. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  3213. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  3214. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  3215. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  3216. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  3217. die "ERROR: openssl not found"; }
  3218. if enabled gnutls; then
  3219. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  3220. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  3221. fi
  3222. # libdc1394 check
  3223. if enabled libdc1394; then
  3224. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  3225. enable libdc1394_2; } ||
  3226. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  3227. enable libdc1394_1; } ||
  3228. die "ERROR: No version of libdc1394 found "
  3229. fi
  3230. SDL_CONFIG="${cross_prefix}sdl-config"
  3231. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3232. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3233. enable sdl &&
  3234. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  3235. else
  3236. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  3237. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  3238. sdl_libs=$("${SDL_CONFIG}" --libs)
  3239. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  3240. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3241. enable sdl &&
  3242. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  3243. fi
  3244. fi
  3245. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  3246. texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  3247. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  3248. perl --version > /dev/null 2>&1 && enable perl || disable perl
  3249. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  3250. check_header linux/fb.h
  3251. check_header linux/videodev.h
  3252. check_header linux/videodev2.h
  3253. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  3254. check_header sys/videoio.h
  3255. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  3256. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  3257. # w32api 3.12 had it defined wrong
  3258. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  3259. check_type "dshow.h" IBaseFilter
  3260. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  3261. { check_header dev/bktr/ioctl_meteor.h &&
  3262. check_header dev/bktr/ioctl_bt848.h; } ||
  3263. { check_header machine/ioctl_meteor.h &&
  3264. check_header machine/ioctl_bt848.h; } ||
  3265. { check_header dev/video/meteor/ioctl_meteor.h &&
  3266. check_header dev/video/bktr/ioctl_bt848.h; } ||
  3267. check_header dev/ic/bt8xx.h
  3268. check_header sndio.h
  3269. if check_struct sys/soundcard.h audio_buf_info bytes; then
  3270. enable_safe sys/soundcard.h
  3271. else
  3272. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  3273. #include <sys/soundcard.h>
  3274. audio_buf_info abc;
  3275. EOF
  3276. fi
  3277. check_header soundcard.h
  3278. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  3279. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait &&
  3280. check_func jack_port_get_latency_range -ljack
  3281. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  3282. enabled libcdio &&
  3283. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
  3284. enabled x11grab &&
  3285. require X11 X11/Xlib.h XOpenDisplay -lX11 &&
  3286. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  3287. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  3288. if ! disabled vaapi; then
  3289. check_lib va/va.h vaInitialize -lva && {
  3290. check_cpp_condition va/va_version.h "VA_CHECK_VERSION(0,32,0)" ||
  3291. warn "Please upgrade to VA-API >= 0.32 if you would like full VA-API support.";
  3292. } || disable vaapi
  3293. fi
  3294. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  3295. check_cpp_condition \
  3296. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  3297. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  3298. disable vdpau; }
  3299. fi
  3300. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  3301. enabled coverage && add_cflags "-fprofile-arcs -ftest-coverage" && add_ldflags "-fprofile-arcs -ftest-coverage"
  3302. 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"
  3303. # add some useful compiler flags if supported
  3304. check_cflags -Wdeclaration-after-statement
  3305. check_cflags -Wall
  3306. check_cflags -Wno-parentheses
  3307. check_cflags -Wno-switch
  3308. check_cflags -Wno-format-zero-length
  3309. check_cflags -Wdisabled-optimization
  3310. check_cflags -Wpointer-arith
  3311. check_cflags -Wredundant-decls
  3312. check_cflags -Wno-pointer-sign
  3313. check_cflags -Wwrite-strings
  3314. check_cflags -Wtype-limits
  3315. check_cflags -Wundef
  3316. check_cflags -Wmissing-prototypes
  3317. check_cflags -Wno-pointer-to-int-cast
  3318. check_cflags -Wstrict-prototypes
  3319. enabled extra_warnings && check_cflags -Winline
  3320. # add some linker flags
  3321. check_ldflags -Wl,--warn-common
  3322. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  3323. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  3324. enabled xmm_clobber_test &&
  3325. check_ldflags -Wl,--wrap,avcodec_open2 \
  3326. -Wl,--wrap,avcodec_decode_audio4 \
  3327. -Wl,--wrap,avcodec_decode_video2 \
  3328. -Wl,--wrap,avcodec_decode_subtitle2 \
  3329. -Wl,--wrap,avcodec_encode_audio2 \
  3330. -Wl,--wrap,avcodec_encode_video \
  3331. -Wl,--wrap,avcodec_encode_subtitle \
  3332. -Wl,--wrap,sws_scale ||
  3333. disable xmm_clobber_test
  3334. echo "X{};" > $TMPV
  3335. if test_ldflags -Wl,--version-script,$TMPV; then
  3336. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  3337. check_cc <<EOF && enable symver_asm_label
  3338. void ff_foo(void) __asm__ ("av_foo@VERSION");
  3339. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  3340. EOF
  3341. check_cc <<EOF && enable symver_gnu_asm
  3342. __asm__(".symver ff_foo,av_foo@VERSION");
  3343. void ff_foo(void) {}
  3344. EOF
  3345. fi
  3346. if [ -n "$optflags" ]; then
  3347. add_cflags $optflags
  3348. elif enabled small; then
  3349. add_cflags $cflags_size
  3350. elif enabled optimizations; then
  3351. add_cflags $cflags_speed
  3352. else
  3353. add_cflags $cflags_noopt
  3354. fi
  3355. check_cflags -fno-math-errno
  3356. check_cflags -fno-signed-zeros
  3357. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  3358. int x;
  3359. EOF
  3360. if enabled icc; then
  3361. # Just warnings, no remarks
  3362. check_cflags -w1
  3363. # -wd: Disable following warnings
  3364. # 144, 167, 556: -Wno-pointer-sign
  3365. # 1292: attribute "foo" ignored
  3366. # 1419: external declaration in primary source file
  3367. # 10006: ignoring unknown option -fno-signed-zeros
  3368. # 10148: ignoring unknown option -Wno-parentheses
  3369. # 10156: ignoring option '-W'; no argument required
  3370. check_cflags -wd144,167,556,1292,1419,10006,10148,10156
  3371. # 11030: Warning unknown option --as-needed
  3372. # 10156: ignoring option '-export'; no argument required
  3373. check_ldflags -wd10156,11030
  3374. # Allow to compile with optimizations
  3375. check_ldflags -march=$cpu
  3376. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  3377. enable ebp_available
  3378. if enabled x86_32; then
  3379. icc_version=$($cc -dumpversion)
  3380. test ${icc_version%%.*} -ge 11 &&
  3381. check_cflags -falign-stack=maintain-16-byte ||
  3382. disable aligned_stack
  3383. fi
  3384. elif enabled ccc; then
  3385. # disable some annoying warnings
  3386. add_cflags -msg_disable cvtu32to64
  3387. add_cflags -msg_disable embedcomment
  3388. add_cflags -msg_disable needconstext
  3389. add_cflags -msg_disable nomainieee
  3390. add_cflags -msg_disable ptrmismatch1
  3391. add_cflags -msg_disable unreachcode
  3392. elif enabled gcc; then
  3393. check_cflags -fno-tree-vectorize
  3394. check_cflags -Werror=implicit-function-declaration
  3395. check_cflags -Werror=missing-prototypes
  3396. elif enabled llvm_gcc; then
  3397. check_cflags -mllvm -stack-alignment=16
  3398. elif enabled clang; then
  3399. check_cflags -mllvm -stack-alignment=16
  3400. check_cflags -Qunused-arguments
  3401. elif enabled armcc; then
  3402. # 2523: use of inline assembler is deprecated
  3403. add_cflags -W${armcc_opt},--diag_suppress=2523
  3404. add_cflags -W${armcc_opt},--diag_suppress=1207
  3405. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  3406. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  3407. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  3408. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  3409. elif enabled tms470; then
  3410. add_cflags -pds=824 -pds=837
  3411. elif enabled pathscale; then
  3412. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  3413. fi
  3414. # If a missing snprintf/broken strtod is detected, force-include headers
  3415. # that override prototypes and define it to a prefixed one implemented in
  3416. # libavutil. We do this at the end since -I flags aren't set in configure,
  3417. # and any additional check_cflags() beyond here will thus fail (because
  3418. # it can't find these files, because the -I$(srcdir) wasn't set).
  3419. enabled snprintf || force_include compat/snprintf.h
  3420. enabled broken_strtod && force_include compat/strtod.h
  3421. enabled_any $THREADS_LIST && enable threads
  3422. check_deps $CONFIG_LIST \
  3423. $CONFIG_EXTRA \
  3424. $HAVE_LIST \
  3425. $ALL_COMPONENTS \
  3426. $ALL_TESTS \
  3427. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  3428. if test $target_os = "haiku"; then
  3429. disable memalign
  3430. disable posix_memalign
  3431. fi
  3432. ! enabled_any memalign posix_memalign aligned_malloc &&
  3433. enabled_any $need_memalign && enable memalign_hack
  3434. # add_dep lib dep
  3435. # -> enable ${lib}_deps_${dep}
  3436. # -> add $dep to ${lib}_deps only once
  3437. add_dep() {
  3438. lib=$1
  3439. dep=$2
  3440. enabled "${lib}_deps_${dep}" && return 0
  3441. enable "${lib}_deps_${dep}"
  3442. prepend "${lib}_deps" $dep
  3443. }
  3444. # merge deps lib components
  3445. # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
  3446. merge_deps() {
  3447. lib=$1
  3448. shift
  3449. for comp in $*; do
  3450. enabled $comp || continue
  3451. eval "dep=\"\$${comp}_deps\""
  3452. for d in $dep; do
  3453. add_dep $lib $d
  3454. done
  3455. done
  3456. }
  3457. merge_deps libavfilter $FILTER_LIST
  3458. echo "install prefix $prefix"
  3459. echo "source path $source_path"
  3460. echo "C compiler $cc"
  3461. echo "ARCH $arch ($cpu)"
  3462. if test "$build_suffix" != ""; then
  3463. echo "build suffix $build_suffix"
  3464. fi
  3465. if test "$progs_suffix" != ""; then
  3466. echo "progs suffix $progs_suffix"
  3467. fi
  3468. if test "$extra_version" != ""; then
  3469. echo "version string suffix $extra_version"
  3470. fi
  3471. echo "big-endian ${bigendian-no}"
  3472. echo "runtime cpu detection ${runtime_cpudetect-no}"
  3473. if enabled x86; then
  3474. echo "${yasmexe} ${yasm-no}"
  3475. echo "MMX enabled ${mmx-no}"
  3476. echo "MMXEXT enabled ${mmxext-no}"
  3477. echo "3DNow! enabled ${amd3dnow-no}"
  3478. echo "3DNow! extended enabled ${amd3dnowext-no}"
  3479. echo "SSE enabled ${sse-no}"
  3480. echo "SSSE3 enabled ${ssse3-no}"
  3481. echo "AVX enabled ${avx-no}"
  3482. echo "FMA4 enabled ${fma4-no}"
  3483. echo "CMOV enabled ${cmov-no}"
  3484. echo "CMOV is fast ${fast_cmov-no}"
  3485. echo "EBX available ${ebx_available-no}"
  3486. echo "EBP available ${ebp_available-no}"
  3487. fi
  3488. if enabled arm; then
  3489. echo "ARMv5TE enabled ${armv5te-no}"
  3490. echo "ARMv6 enabled ${armv6-no}"
  3491. echo "ARMv6T2 enabled ${armv6t2-no}"
  3492. echo "ARM VFP enabled ${armvfp-no}"
  3493. echo "NEON enabled ${neon-no}"
  3494. fi
  3495. if enabled mips; then
  3496. echo "MMI enabled ${mmi-no}"
  3497. echo "MIPS FPU enabled ${mipsfpu-no}"
  3498. echo "MIPS32R2 enabled ${mips32r2-no}"
  3499. echo "MIPS DSP R1 enabled ${mipsdspr1-no}"
  3500. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  3501. fi
  3502. if enabled ppc; then
  3503. echo "AltiVec enabled ${altivec-no}"
  3504. echo "PPC 4xx optimizations ${ppc4xx-no}"
  3505. echo "dcbzl available ${dcbzl-no}"
  3506. fi
  3507. if enabled sparc; then
  3508. echo "VIS enabled ${vis-no}"
  3509. fi
  3510. echo "debug symbols ${debug-no}"
  3511. echo "strip symbols ${stripping-no}"
  3512. echo "optimize for size ${small-no}"
  3513. echo "optimizations ${optimizations-no}"
  3514. echo "static ${static-no}"
  3515. echo "shared ${shared-no}"
  3516. echo "postprocessing support ${postproc-no}"
  3517. echo "new filter support ${avfilter-no}"
  3518. echo "network support ${network-no}"
  3519. echo "threading support ${thread_type-no}"
  3520. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  3521. echo "SDL support ${sdl-no}"
  3522. echo "libdxva2 enabled ${dxva2-no}"
  3523. echo "libva enabled ${vaapi-no}"
  3524. echo "libvdpau enabled ${vdpau-no}"
  3525. echo "AVISynth enabled ${avisynth-no}"
  3526. echo "frei0r enabled ${frei0r-no}"
  3527. echo "gnutls enabled ${gnutls-no}"
  3528. echo "libaacplus enabled ${libaacplus-no}"
  3529. echo "libass enabled ${libass-no}"
  3530. echo "libcaca enabled ${libcaca-no}"
  3531. echo "libcdio support ${libcdio-no}"
  3532. echo "libcelt enabled ${libcelt-no}"
  3533. echo "libdc1394 support ${libdc1394-no}"
  3534. echo "libfaac enabled ${libfaac-no}"
  3535. echo "libfdk-aac enabled ${libfdk_aac-no}"
  3536. echo "libgsm enabled ${libgsm-no}"
  3537. echo "libiec61883 support ${libiec61883-no}"
  3538. echo "libilbc enabled ${libilbc-no}"
  3539. echo "libmodplug enabled ${libmodplug-no}"
  3540. echo "libmp3lame enabled ${libmp3lame-no}"
  3541. echo "libnut enabled ${libnut-no}"
  3542. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  3543. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  3544. echo "libopencv support ${libopencv-no}"
  3545. echo "libopenjpeg enabled ${libopenjpeg-no}"
  3546. echo "libopus enabled ${libopus-no}"
  3547. echo "libpulse enabled ${libpulse-no}"
  3548. echo "librtmp enabled ${librtmp-no}"
  3549. echo "libschroedinger enabled ${libschroedinger-no}"
  3550. echo "libspeex enabled ${libspeex-no}"
  3551. echo "libstagefright-h264 enabled ${libstagefright_h264-no}"
  3552. echo "libtheora enabled ${libtheora-no}"
  3553. echo "libtwolame enabled ${libtwolame-no}"
  3554. echo "libutvideo enabled ${libutvideo-no}"
  3555. echo "libv4l2 enabled ${libv4l2-no}"
  3556. echo "libvo-aacenc support ${libvo_aacenc-no}"
  3557. echo "libvo-amrwbenc support ${libvo_amrwbenc-no}"
  3558. echo "libvorbis enabled ${libvorbis-no}"
  3559. echo "libvpx enabled ${libvpx-no}"
  3560. echo "libx264 enabled ${libx264-no}"
  3561. echo "libxavs enabled ${libxavs-no}"
  3562. echo "libxvid enabled ${libxvid-no}"
  3563. echo "openal enabled ${openal-no}"
  3564. echo "openssl enabled ${openssl-no}"
  3565. echo "zlib enabled ${zlib-no}"
  3566. echo "bzlib enabled ${bzlib-no}"
  3567. echo "texi2html enabled ${texi2html-no}"
  3568. echo "perl enabled ${perl-no}"
  3569. echo "pod2man enabled ${pod2man-no}"
  3570. echo "makeinfo enabled ${makeinfo-no}"
  3571. test -n "$random_seed" &&
  3572. echo "random seed ${random_seed}"
  3573. echo
  3574. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  3575. echo "Enabled ${type}s:"
  3576. eval list=\$$(toupper $type)_LIST
  3577. print_enabled '_*' $list | sort | pr -r -3 -t
  3578. echo
  3579. done
  3580. license="LGPL version 2.1 or later"
  3581. if enabled nonfree; then
  3582. license="nonfree and unredistributable"
  3583. elif enabled gplv3; then
  3584. license="GPL version 3 or later"
  3585. elif enabled lgplv3; then
  3586. license="LGPL version 3 or later"
  3587. elif enabled gpl; then
  3588. license="GPL version 2 or later"
  3589. fi
  3590. echo "License: $license"
  3591. echo "Creating config.mak and config.h..."
  3592. test -e Makefile || $ln_s "$source_path/Makefile" .
  3593. enabled stripping || strip="echo skipping strip"
  3594. config_files="$TMPH config.mak"
  3595. cat > config.mak <<EOF
  3596. # Automatically generated by configure - do not modify!
  3597. ifndef FFMPEG_CONFIG_MAK
  3598. FFMPEG_CONFIG_MAK=1
  3599. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  3600. prefix=$prefix
  3601. LIBDIR=\$(DESTDIR)$libdir
  3602. SHLIBDIR=\$(DESTDIR)$shlibdir
  3603. INCDIR=\$(DESTDIR)$incdir
  3604. BINDIR=\$(DESTDIR)$bindir
  3605. DATADIR=\$(DESTDIR)$datadir
  3606. MANDIR=\$(DESTDIR)$mandir
  3607. SRC_PATH=$source_path
  3608. ifndef MAIN_MAKEFILE
  3609. SRC_PATH:=\$(SRC_PATH:.%=..%)
  3610. endif
  3611. CC_IDENT=$cc_ident
  3612. ARCH=$arch
  3613. CC=$cc
  3614. CXX=$cxx
  3615. AS=$as
  3616. LD=$ld
  3617. DEPCC=$dep_cc
  3618. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  3619. DEPAS=$as
  3620. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  3621. YASM=$yasmexe
  3622. DEPYASM=$yasmexe
  3623. AR=$ar
  3624. RANLIB=$ranlib
  3625. CP=cp -p
  3626. LN_S=$ln_s
  3627. STRIP=$strip
  3628. CPPFLAGS=$CPPFLAGS
  3629. CFLAGS=$CFLAGS
  3630. CXXFLAGS=$CXXFLAGS
  3631. ASFLAGS=$ASFLAGS
  3632. AS_C=$AS_C
  3633. AS_O=$AS_O
  3634. CC_C=$CC_C
  3635. CC_O=$CC_O
  3636. CXX_C=$CXX_C
  3637. CXX_O=$CXX_O
  3638. LD_O=$LD_O
  3639. DLLTOOL=$dlltool
  3640. LDFLAGS=$LDFLAGS
  3641. LDFLAGS-ffserver=$FFSERVERLDFLAGS
  3642. SHFLAGS=$SHFLAGS
  3643. YASMFLAGS=$YASMFLAGS
  3644. BUILDSUF=$build_suffix
  3645. PROGSSUF=$progs_suffix
  3646. FULLNAME=$FULLNAME
  3647. LIBPREF=$LIBPREF
  3648. LIBSUF=$LIBSUF
  3649. LIBNAME=$LIBNAME
  3650. SLIBPREF=$SLIBPREF
  3651. SLIBSUF=$SLIBSUF
  3652. EXESUF=$EXESUF
  3653. EXTRA_VERSION=$extra_version
  3654. CCDEP=$CCDEP
  3655. CXXDEP=$CXXDEP
  3656. CCDEP_FLAGS=$CCDEP_FLAGS
  3657. ASDEP=$ASDEP
  3658. ASDEP_FLAGS=$ASDEP_FLAGS
  3659. CC_DEPFLAGS=$CC_DEPFLAGS
  3660. AS_DEPFLAGS=$AS_DEPFLAGS
  3661. HOSTCC=$host_cc
  3662. HOSTCFLAGS=$host_cflags
  3663. HOSTEXESUF=$HOSTEXESUF
  3664. HOSTLDFLAGS=$host_ldflags
  3665. HOSTLIBS=$host_libs
  3666. DEPHOSTCC=$host_cc
  3667. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  3668. HOSTCCDEP=$HOSTCCDEP
  3669. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  3670. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  3671. HOSTCC_C=$HOSTCC_C
  3672. HOSTCC_O=$HOSTCC_O
  3673. TARGET_EXEC=$target_exec
  3674. TARGET_PATH=$target_path
  3675. LIBS-ffplay=$sdl_libs
  3676. CFLAGS-ffplay=$sdl_cflags
  3677. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  3678. EXTRALIBS=$extralibs
  3679. INSTALL=$install
  3680. LIBTARGET=${LIBTARGET}
  3681. SLIBNAME=${SLIBNAME}
  3682. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  3683. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  3684. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  3685. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  3686. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  3687. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  3688. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  3689. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  3690. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  3691. NOREDZONE_FLAGS=$noredzone_flags
  3692. EOF
  3693. get_version(){
  3694. lcname=$1
  3695. name=$(toupper $lcname)
  3696. file=$source_path/$lcname/version.h
  3697. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  3698. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  3699. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  3700. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  3701. }
  3702. get_version_old(){
  3703. name=$1
  3704. file=$source_path/$2
  3705. # This condition will be removed when we stop supporting old libpostproc versions
  3706. if ! test "$name" = LIBPOSTPROC || test "$postproc_version" = current; then
  3707. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  3708. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  3709. fi
  3710. lcname=$(tolower $name)
  3711. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  3712. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  3713. }
  3714. get_version_old LIBPOSTPROC libpostproc/postprocess.h
  3715. get_version_old LIBSWRESAMPLE libswresample/swresample.h
  3716. get_version libavcodec
  3717. get_version libavdevice
  3718. get_version libavfilter
  3719. get_version libavformat
  3720. get_version libavresample
  3721. get_version libavutil
  3722. get_version libswscale
  3723. cat > $TMPH <<EOF
  3724. /* Automatically generated by configure - do not modify! */
  3725. #ifndef FFMPEG_CONFIG_H
  3726. #define FFMPEG_CONFIG_H
  3727. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  3728. #define FFMPEG_LICENSE "$(c_escape $license)"
  3729. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  3730. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  3731. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  3732. #define av_restrict $_restrict
  3733. #define EXTERN_PREFIX "${extern_prefix}"
  3734. #define EXTERN_ASM ${extern_prefix}
  3735. #define SLIBSUF "$SLIBSUF"
  3736. #define HAVE_MMX2 HAVE_MMXEXT
  3737. EOF
  3738. test -n "$assert_level" &&
  3739. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  3740. test -n "$malloc_prefix" &&
  3741. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  3742. if enabled yasm; then
  3743. append config_files $TMPASM
  3744. printf '' >$TMPASM
  3745. fi
  3746. print_config ARCH_ "$config_files" $ARCH_LIST
  3747. print_config HAVE_ "$config_files" $HAVE_LIST
  3748. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  3749. $CONFIG_EXTRA \
  3750. $ALL_COMPONENTS \
  3751. cat >>config.mak <<EOF
  3752. LAVF_FATE_TESTS=$(print_enabled -n _test $LAVF_FATE_TESTS)
  3753. LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
  3754. LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
  3755. SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
  3756. EOF
  3757. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  3758. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  3759. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3760. cp_if_changed $TMPH config.h
  3761. touch .config
  3762. enabled yasm && cp_if_changed $TMPASM config.asm
  3763. cat > $TMPH <<EOF
  3764. /* Generated by ffconf */
  3765. #ifndef AVUTIL_AVCONFIG_H
  3766. #define AVUTIL_AVCONFIG_H
  3767. EOF
  3768. test "$postproc_version" != current && cat >> $TMPH <<EOF
  3769. #define LIBPOSTPROC_VERSION_MAJOR $LIBPOSTPROC_VERSION_MAJOR
  3770. #define LIBPOSTPROC_VERSION_MINOR $LIBPOSTPROC_VERSION_MINOR
  3771. #define LIBPOSTPROC_VERSION_MICRO $LIBPOSTPROC_VERSION_MICRO
  3772. EOF
  3773. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3774. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3775. cp_if_changed $TMPH libavutil/avconfig.h
  3776. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3777. # build pkg-config files
  3778. pkgconfig_generate(){
  3779. name=$1
  3780. shortname=${name#lib}${build_suffix}
  3781. comment=$2
  3782. version=$3
  3783. libs=$4
  3784. requires=$5
  3785. enabled ${name#lib} || return 0
  3786. mkdir -p $name
  3787. cat <<EOF > $name/$name.pc
  3788. prefix=$prefix
  3789. exec_prefix=\${prefix}
  3790. libdir=$libdir
  3791. includedir=$incdir
  3792. Name: $name
  3793. Description: $comment
  3794. Version: $version
  3795. Requires: $(enabled shared || echo $requires)
  3796. Requires.private: $(enabled shared && echo $requires)
  3797. Conflicts:
  3798. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3799. Libs.private: $(enabled shared && echo $libs)
  3800. Cflags: -I\${includedir}
  3801. EOF
  3802. mkdir -p doc/examples/pc-uninstalled
  3803. includedir=${source_path}
  3804. [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
  3805. cat <<EOF > doc/examples/pc-uninstalled/$name.pc
  3806. prefix=
  3807. exec_prefix=
  3808. libdir=\${pcfiledir}/../../../$name
  3809. includedir=${includedir}
  3810. Name: $name
  3811. Description: $comment
  3812. Version: $version
  3813. Requires: $requires
  3814. Conflicts:
  3815. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3816. Cflags: -I\${includedir}
  3817. EOF
  3818. }
  3819. libavfilter_pc_deps=""
  3820. enabled libavfilter_deps_avcodec && prepend libavfilter_pc_deps "libavcodec = $LIBAVCODEC_VERSION,"
  3821. enabled libavfilter_deps_avformat && prepend libavfilter_pc_deps "libavformat = $LIBAVFORMAT_VERSION,"
  3822. enabled libavfilter_deps_swscale && prepend libavfilter_pc_deps "libswscale = $LIBSWSCALE_VERSION,"
  3823. enabled libavfilter_deps_swresample && prepend libavfilter_pc_deps "libswresample = $LIBSWRESAMPLE_VERSION,"
  3824. enabled libavfilter_deps_postproc && prepend libavfilter_pc_deps "libpostproc = $LIBPOSTPROC_VERSION,"
  3825. libavfilter_pc_deps=${libavfilter_pc_deps%, }
  3826. libavdevice_pc_deps="libavformat = $LIBAVFORMAT_VERSION"
  3827. enabled lavfi_indev && prepend libavdevice_pc_deps "libavfilter = $LIBAVFILTER_VERSION,"
  3828. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  3829. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3830. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3831. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$libavdevice_pc_deps"
  3832. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$libavfilter_pc_deps"
  3833. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  3834. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs"
  3835. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
  3836. pkgconfig_generate libswresample "FFmpeg audio rescaling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"