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.

3827 lines
116KB

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