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.

3828 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 encoding and 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. libutvideo_encoder_deps="libutvideo gpl"
  1443. # demuxers / muxers
  1444. ac3_demuxer_select="ac3_parser"
  1445. asf_stream_muxer_select="asf_muxer"
  1446. avisynth_demuxer_deps="avisynth"
  1447. dirac_demuxer_select="dirac_parser"
  1448. eac3_demuxer_select="ac3_parser"
  1449. flac_demuxer_select="flac_parser"
  1450. ipod_muxer_select="mov_muxer"
  1451. libnut_demuxer_deps="libnut"
  1452. libnut_muxer_deps="libnut"
  1453. matroska_audio_muxer_select="matroska_muxer"
  1454. matroska_demuxer_suggest="zlib bzlib"
  1455. mov_demuxer_suggest="zlib"
  1456. mp3_demuxer_select="mpegaudio_parser"
  1457. mp4_muxer_select="mov_muxer"
  1458. mpegtsraw_demuxer_select="mpegts_demuxer"
  1459. mxf_d10_muxer_select="mxf_muxer"
  1460. ogg_demuxer_select="golomb"
  1461. psp_muxer_select="mov_muxer"
  1462. rtp_demuxer_select="sdp_demuxer"
  1463. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1464. rtsp_demuxer_select="http_protocol rtpdec"
  1465. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
  1466. sap_demuxer_select="sdp_demuxer"
  1467. sap_muxer_select="rtp_muxer rtp_protocol"
  1468. sdp_demuxer_select="rtpdec"
  1469. spdif_muxer_select="aac_parser"
  1470. tg2_muxer_select="mov_muxer"
  1471. tgp_muxer_select="mov_muxer"
  1472. w64_demuxer_deps="wav_demuxer"
  1473. # indevs / outdevs
  1474. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1475. alsa_outdev_deps="alsa_asoundlib_h"
  1476. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1477. dshow_indev_deps="IBaseFilter"
  1478. dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid"
  1479. dv1394_indev_deps="dv1394 dv_demuxer"
  1480. fbdev_indev_deps="linux_fb_h"
  1481. jack_indev_deps="jack_jack_h sem_timedwait"
  1482. lavfi_indev_deps="avfilter"
  1483. libcdio_indev_deps="libcdio"
  1484. libdc1394_indev_deps="libdc1394"
  1485. libv4l2_indev_deps="libv4l2"
  1486. openal_indev_deps="openal"
  1487. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1488. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1489. pulse_indev_deps="libpulse"
  1490. sdl_outdev_deps="sdl"
  1491. sndio_indev_deps="sndio_h"
  1492. sndio_outdev_deps="sndio_h"
  1493. v4l_indev_deps="linux_videodev_h"
  1494. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1495. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1496. vfwcap_indev_extralibs="-lavicap32"
  1497. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1498. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1499. # protocols
  1500. bluray_protocol_deps="libbluray"
  1501. gopher_protocol_deps="network"
  1502. httpproxy_protocol_deps="network"
  1503. httpproxy_protocol_select="tcp_protocol"
  1504. http_protocol_deps="network"
  1505. http_protocol_select="tcp_protocol"
  1506. https_protocol_select="tls_protocol"
  1507. librtmp_protocol_deps="librtmp"
  1508. librtmpe_protocol_deps="librtmp"
  1509. librtmps_protocol_deps="librtmp"
  1510. librtmpt_protocol_deps="librtmp"
  1511. librtmpte_protocol_deps="librtmp"
  1512. mmsh_protocol_select="http_protocol"
  1513. mmst_protocol_deps="network"
  1514. rtmp_protocol_deps="!librtmp_protocol"
  1515. rtmp_protocol_select="tcp_protocol"
  1516. rtp_protocol_select="udp_protocol"
  1517. tcp_protocol_deps="network"
  1518. tls_protocol_deps_any="openssl gnutls"
  1519. tls_protocol_select="tcp_protocol"
  1520. udp_protocol_deps="network"
  1521. # filters
  1522. aconvert_filter_deps="swresample"
  1523. amovie_filter_deps="avcodec avformat"
  1524. aresample_filter_deps="swresample"
  1525. ass_filter_deps="libass"
  1526. blackframe_filter_deps="gpl"
  1527. boxblur_filter_deps="gpl"
  1528. cropdetect_filter_deps="gpl"
  1529. delogo_filter_deps="gpl"
  1530. drawtext_filter_deps="libfreetype"
  1531. frei0r_filter_deps="frei0r dlopen"
  1532. frei0r_src_filter_deps="frei0r dlopen"
  1533. hqdn3d_filter_deps="gpl"
  1534. movie_filter_deps="avcodec avformat"
  1535. mp_filter_deps="gpl avcodec swscale postproc"
  1536. mptestsrc_filter_deps="gpl"
  1537. negate_filter_deps="lut_filter"
  1538. ocv_filter_deps="libopencv"
  1539. pan_filter_deps="swresample"
  1540. scale_filter_deps="swscale"
  1541. tinterlace_filter_deps="gpl"
  1542. yadif_filter_deps="gpl"
  1543. # libraries
  1544. avdevice_deps="avcodec avformat"
  1545. avformat_deps="avcodec"
  1546. postproc_deps="gpl"
  1547. # programs
  1548. ffplay_deps="avcodec avformat swscale swresample sdl"
  1549. ffplay_select="buffersink_filter rdft"
  1550. ffprobe_deps="avcodec avformat"
  1551. ffserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
  1552. ffserver_extralibs='$ldl'
  1553. ffmpeg_deps="avcodec avformat swscale swresample"
  1554. ffmpeg_select="buffersink_filter"
  1555. doc_deps="texi2html"
  1556. # tests
  1557. test_deps(){
  1558. suf1=$1
  1559. suf2=$2
  1560. shift 2
  1561. for v; do
  1562. dep=${v%=*}
  1563. tests=${v#*=}
  1564. for name in ${tests}; do
  1565. append ${name}_test_deps ${dep}$suf1 ${dep}$suf2
  1566. done
  1567. done
  1568. }
  1569. mxf_d10_test_deps="avfilter"
  1570. seek_lavf_mxf_d10_test_deps="mxf_d10_test"
  1571. test_deps _encoder _decoder \
  1572. adpcm_ima_qt \
  1573. adpcm_ima_wav \
  1574. adpcm_ms \
  1575. adpcm_swf \
  1576. adpcm_yamaha=adpcm_yam \
  1577. alac \
  1578. asv1 \
  1579. asv2 \
  1580. bmp \
  1581. dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \
  1582. dvvideo="dv dv_411 dv50" \
  1583. ffv1 \
  1584. flac \
  1585. flashsv \
  1586. flv \
  1587. adpcm_g726=g726 \
  1588. gif \
  1589. h261 \
  1590. h263="h263 h263p" \
  1591. huffyuv \
  1592. jpegls \
  1593. mjpeg="jpg mjpeg ljpeg" \
  1594. mp2 \
  1595. mpeg1video="mpeg mpeg1b" \
  1596. mpeg2video="mpeg2 mpeg2_422 mpeg2_idct_int mpeg2_ilace mpeg2_ivlc_qprd" \
  1597. mpeg2video="mpeg2thread mpeg2thread_ilace" \
  1598. mpeg4="mpeg4 mpeg4_adap mpeg4_qpel mpeg4_qprd mpeg4adv mpeg4nr" \
  1599. mpeg4="mpeg4thread error rc" \
  1600. msmpeg4v3=msmpeg4 \
  1601. msmpeg4v2 \
  1602. pbm=pbmpipe \
  1603. pcx \
  1604. pgm="pgm pgmpipe" \
  1605. png \
  1606. ppm="ppm ppmpipe" \
  1607. rawvideo="rgb yuv" \
  1608. roq \
  1609. rv10 \
  1610. rv20 \
  1611. sgi \
  1612. snow="snow snowll" \
  1613. svq1 \
  1614. targa=tga \
  1615. tiff \
  1616. wmav1 \
  1617. wmav2 \
  1618. wmv1 \
  1619. wmv2 \
  1620. test_deps _muxer _demuxer \
  1621. aiff \
  1622. pcm_alaw=alaw \
  1623. asf \
  1624. au \
  1625. avi \
  1626. dv=dv_fmt \
  1627. ffm \
  1628. flv=flv_fmt \
  1629. gxf \
  1630. matroska=mkv \
  1631. mmf \
  1632. mov="mov ismv" \
  1633. pcm_mulaw=mulaw \
  1634. mxf="mxf mxf_d10" \
  1635. nut \
  1636. ogg="ogg ogg_vp3" \
  1637. rawvideo=pixfmt \
  1638. rm \
  1639. swf \
  1640. mpegts=ts \
  1641. voc \
  1642. wav \
  1643. yuv4mpegpipe=yuv4mpeg \
  1644. ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder"
  1645. mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
  1646. # default parameters
  1647. logfile="config.log"
  1648. # installation paths
  1649. prefix_default="/usr/local"
  1650. bindir_default='${prefix}/bin'
  1651. datadir_default='${prefix}/share/ffmpeg'
  1652. incdir_default='${prefix}/include'
  1653. libdir_default='${prefix}/lib'
  1654. mandir_default='${prefix}/share/man'
  1655. shlibdir_default="$libdir_default"
  1656. postproc_version_default="current"
  1657. # toolchain
  1658. ar_default="ar"
  1659. cc_default="gcc"
  1660. cxx_default="g++"
  1661. cc_version=\"unknown\"
  1662. host_cc_default="gcc"
  1663. install="install"
  1664. ln_s="ln -sf"
  1665. nm_default="nm"
  1666. objformat="elf"
  1667. pkg_config_default=pkg-config
  1668. ranlib="ranlib"
  1669. strip_default="strip"
  1670. yasmexe_default="yasm"
  1671. nm_opts='-g'
  1672. nogas=":"
  1673. # machine
  1674. arch_default=$(uname -m)
  1675. cpu="generic"
  1676. # OS
  1677. target_os_default=$(tolower $(uname -s))
  1678. host_os=$target_os_default
  1679. # alternative libpostproc version
  1680. ALT_PP_VER_MAJOR=51
  1681. ALT_PP_VER_MINOR=2
  1682. ALT_PP_VER_MICRO=101
  1683. ALT_PP_VER=$ALT_PP_VER_MAJOR.$ALT_PP_VER_MINOR.$ALT_PP_VER_MICRO
  1684. # configurable options
  1685. enable $PROGRAM_LIST
  1686. enable avcodec
  1687. enable avdevice
  1688. enable avfilter
  1689. enable avformat
  1690. enable avutil
  1691. enable postproc
  1692. enable stripping
  1693. enable swresample
  1694. enable swscale
  1695. enable asm
  1696. enable debug
  1697. enable doc
  1698. enable fastdiv
  1699. enable network
  1700. enable optimizations
  1701. enable safe_bitstream_reader
  1702. enable static
  1703. enable swscale_alpha
  1704. # build settings
  1705. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1706. FFSERVERLDFLAGS=-Wl,-E
  1707. LIBPREF="lib"
  1708. LIBSUF=".a"
  1709. FULLNAME='$(NAME)$(BUILDSUF)'
  1710. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1711. SLIBPREF="lib"
  1712. SLIBSUF=".so"
  1713. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1714. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1715. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1716. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1717. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  1718. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  1719. AS_O='-o $@'
  1720. CC_O='-o $@'
  1721. CXX_O='-o $@'
  1722. host_cflags='-D_ISOC99_SOURCE -O3 -g'
  1723. host_libs='-lm'
  1724. target_path='$(CURDIR)'
  1725. # since the object filename is not given with the -MM flag, the compiler
  1726. # is only able to print the basename, and we must add the path ourselves
  1727. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1728. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1729. # find source path
  1730. if test -f configure; then
  1731. source_path=.
  1732. else
  1733. source_path=$(cd $(dirname "$0"); pwd)
  1734. echo "$source_path" | grep -q '[[:blank:]]' &&
  1735. die "Out of tree builds are impossible with whitespace in source path."
  1736. test -e "$source_path/config.h" &&
  1737. die "Out of tree builds are impossible with config.h in source dir."
  1738. fi
  1739. for v in "$@"; do
  1740. r=${v#*=}
  1741. l=${v%"$r"}
  1742. r=$(sh_quote "$r")
  1743. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1744. done
  1745. find_things(){
  1746. thing=$1
  1747. pattern=$2
  1748. file=$source_path/$3
  1749. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1750. }
  1751. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1752. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1753. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1754. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1755. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1756. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1757. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1758. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1759. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1760. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1761. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1762. ALL_COMPONENTS="
  1763. $BSF_LIST
  1764. $DECODER_LIST
  1765. $DEMUXER_LIST
  1766. $ENCODER_LIST
  1767. $FILTER_LIST
  1768. $HWACCEL_LIST
  1769. $INDEV_LIST
  1770. $MUXER_LIST
  1771. $OUTDEV_LIST
  1772. $PARSER_LIST
  1773. $PROTOCOL_LIST
  1774. "
  1775. find_tests(){
  1776. map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
  1777. }
  1778. ACODEC_TESTS=$(find_tests acodec)
  1779. VCODEC_TESTS=$(find_tests vsynth1)
  1780. LAVF_FATE_TESTS=$(find_tests lavf-fate)
  1781. LAVF_TESTS=$(find_tests lavf)
  1782. LAVFI_TESTS=$(find_tests lavfi)
  1783. SEEK_TESTS=$(find_tests seek seek_)
  1784. ALL_TESTS="$ACODEC_TESTS $VCODEC_TESTS $LAVF_FATE_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS"
  1785. pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
  1786. for n in $COMPONENT_LIST; do
  1787. v=$(toupper ${n%s})_LIST
  1788. eval enable \$$v
  1789. eval ${n}_if_any="\$$v"
  1790. done
  1791. enable $ARCH_EXT_LIST $ALL_TESTS
  1792. die_unknown(){
  1793. echo "Unknown option \"$1\"."
  1794. echo "See $0 --help for available options."
  1795. exit 1
  1796. }
  1797. show_list() {
  1798. suffix=_$1
  1799. shift
  1800. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1801. exit 0
  1802. }
  1803. for opt do
  1804. optval="${opt#*=}"
  1805. case "$opt" in
  1806. --extra-ldflags=*) add_ldflags $optval
  1807. ;;
  1808. --extra-libs=*) add_extralibs $optval
  1809. ;;
  1810. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1811. ;;
  1812. --enable-debug=*) debuglevel="$optval"
  1813. ;;
  1814. --disable-everything)
  1815. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1816. ;;
  1817. --enable-*=*|--disable-*=*)
  1818. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1819. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1820. eval list=\$$(toupper $thing)_LIST
  1821. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1822. $action $(filter "$name" $list)
  1823. ;;
  1824. --enable-?*|--disable-?*)
  1825. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1826. if is_in $option $COMPONENT_LIST; then
  1827. test $action = disable && action=unset
  1828. eval $action \$$(toupper ${option%s})_LIST
  1829. elif is_in $option $CMDLINE_SELECT; then
  1830. $action $option
  1831. else
  1832. die_unknown $opt
  1833. fi
  1834. ;;
  1835. --list-*)
  1836. NAME="${opt#--list-}"
  1837. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1838. NAME=${NAME%s}
  1839. eval show_list $NAME \$$(toupper $NAME)_LIST
  1840. ;;
  1841. --help|-h) show_help
  1842. ;;
  1843. *)
  1844. optname="${opt%%=*}"
  1845. optname="${optname#--}"
  1846. optname=$(echo "$optname" | sed 's/-/_/g')
  1847. if is_in $optname $CMDLINE_SET; then
  1848. eval $optname='$optval'
  1849. elif is_in $optname $CMDLINE_APPEND; then
  1850. append $optname "$optval"
  1851. else
  1852. die_unknown $opt
  1853. fi
  1854. ;;
  1855. esac
  1856. done
  1857. disabled logging && logfile=/dev/null
  1858. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1859. set >> $logfile
  1860. test -n "$cross_prefix" && enable cross_compile
  1861. if enabled cross_compile; then
  1862. test -n "$arch" && test -n "$target_os" ||
  1863. die "Must specify target arch and OS when cross-compiling"
  1864. fi
  1865. set_default arch target_os postproc_version
  1866. # Check if we should build alternative libpostproc version instead of current
  1867. if test "$postproc_version" = $ALT_PP_VER; then
  1868. LIBPOSTPROC_VERSION=$ALT_PP_VER
  1869. LIBPOSTPROC_VERSION_MAJOR=$ALT_PP_VER_MAJOR
  1870. LIBPOSTPROC_VERSION_MINOR=$ALT_PP_VER_MINOR
  1871. LIBPOSTPROC_VERSION_MICRO=$ALT_PP_VER_MICRO
  1872. elif test "$postproc_version" != current; then
  1873. die "Invalid argument to --postproc-version. See --help output."
  1874. fi
  1875. ar_default="${cross_prefix}${ar_default}"
  1876. cc_default="${cross_prefix}${cc_default}"
  1877. cxx_default="${cross_prefix}${cxx_default}"
  1878. nm_default="${cross_prefix}${nm_default}"
  1879. pkg_config_default="${cross_prefix}${pkg_config_default}"
  1880. ranlib="${cross_prefix}${ranlib}"
  1881. strip_default="${cross_prefix}${strip_default}"
  1882. sysinclude_default="${sysroot}/usr/include"
  1883. set_default cc cxx nm pkg_config strip sysinclude yasmexe
  1884. enabled cross_compile || host_cc_default=$cc
  1885. set_default host_cc
  1886. if ! $pkg_config --version >/dev/null 2>&1; then
  1887. warn "$pkg_config not found, library detection may fail."
  1888. pkg_config=false
  1889. fi
  1890. exesuf() {
  1891. case $1 in
  1892. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  1893. esac
  1894. }
  1895. EXESUF=$(exesuf $target_os)
  1896. HOSTEXESUF=$(exesuf $host_os)
  1897. # set temporary file name
  1898. : ${TMPDIR:=$TEMPDIR}
  1899. : ${TMPDIR:=$TMP}
  1900. : ${TMPDIR:=/tmp}
  1901. if ! check_cmd mktemp -u XXXXXX; then
  1902. # simple replacement for missing mktemp
  1903. # NOT SAFE FOR GENERAL USE
  1904. mktemp(){
  1905. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  1906. }
  1907. fi
  1908. tmpfile(){
  1909. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1910. (set -C; exec > $tmp) 2>/dev/null ||
  1911. die "Unable to create temporary file in $TMPDIR."
  1912. append TMPFILES $tmp
  1913. eval $1=$tmp
  1914. }
  1915. trap 'rm -f -- $TMPFILES' EXIT
  1916. tmpfile TMPASM .asm
  1917. tmpfile TMPC .c
  1918. tmpfile TMPCPP .cpp
  1919. tmpfile TMPE $EXESUF
  1920. tmpfile TMPH .h
  1921. tmpfile TMPO .o
  1922. tmpfile TMPS .S
  1923. tmpfile TMPSH .sh
  1924. tmpfile TMPV .ver
  1925. unset -f mktemp
  1926. chmod +x $TMPE
  1927. # make sure we can execute files in $TMPDIR
  1928. cat > $TMPSH 2>> $logfile <<EOF
  1929. #! /bin/sh
  1930. EOF
  1931. chmod +x $TMPSH >> $logfile 2>&1
  1932. if ! $TMPSH >> $logfile 2>&1; then
  1933. cat <<EOF
  1934. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1935. variable to another directory and make sure that it is not mounted noexec.
  1936. EOF
  1937. die "Sanity test failed."
  1938. fi
  1939. filter_asflags=echo
  1940. filter_cflags=echo
  1941. filter_cppflags=echo
  1942. if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  1943. cc_type=llvm_gcc
  1944. cc_version=__VERSION__
  1945. gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
  1946. cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
  1947. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1948. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1949. speed_cflags='-O3'
  1950. size_cflags='-Os'
  1951. elif $cc -v 2>&1 | grep -qi ^gcc; then
  1952. cc_type=gcc
  1953. cc_version=__VERSION__
  1954. gcc_version=$($cc --version | head -n1)
  1955. gcc_basever=$($cc -dumpversion)
  1956. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  1957. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  1958. cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  1959. if ! $cc -dumpversion | grep -q '^2\.'; then
  1960. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1961. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1962. fi
  1963. speed_cflags='-O3'
  1964. size_cflags='-Os'
  1965. elif $cc --version 2>/dev/null | grep -q Intel; then
  1966. cc_type=icc
  1967. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1968. cc_ident=$($cc --version | head -n1)
  1969. icc_version=$($cc -dumpversion)
  1970. CC_DEPFLAGS='-MMD'
  1971. AS_DEPFLAGS='-MMD'
  1972. speed_cflags='-O3'
  1973. size_cflags='-Os'
  1974. noopt_cflags='-O1'
  1975. elif $cc -v 2>&1 | grep -q xlc; then
  1976. cc_type=xlc
  1977. cc_version="AV_STRINGIFY(__IBMC__)"
  1978. cc_ident=$($cc -qversion 2>/dev/null | head -n1)
  1979. speed_cflags='-O5'
  1980. size_cflags='-O5 -qcompact'
  1981. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1982. cc_type=ccc
  1983. cc_version="AV_STRINGIFY(__DECC_VER)"
  1984. cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
  1985. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1986. debuglevel=3
  1987. add_ldflags -Wl,-z,now # calls to libots crash without this
  1988. speed_cflags='-fast'
  1989. size_cflags='-O1'
  1990. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1991. test -d "$sysroot" || die "No valid sysroot specified."
  1992. cc_type=armcc
  1993. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1994. cc_ident=$($cc --vsn | head -n1)
  1995. armcc_conf="$PWD/armcc.conf"
  1996. $cc --arm_linux_configure \
  1997. --arm_linux_config_file="$armcc_conf" \
  1998. --configure_sysroot="$sysroot" \
  1999. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2000. die "Error creating armcc configuration file."
  2001. $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2002. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  2003. as_default="${cross_prefix}gcc"
  2004. CC_DEPFLAGS='-MMD'
  2005. AS_DEPFLAGS='-MMD'
  2006. speed_cflags='-O3'
  2007. size_cflags='-Os'
  2008. filter_asflags="filter_out -W${armcc_opt}*"
  2009. elif $cc -version 2>/dev/null | grep -q TMS470; then
  2010. cc_type=tms470
  2011. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  2012. cc_ident=$($cc -version | head -n1 | tr -s ' ')
  2013. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  2014. CC_O='-fr=$(@D)'
  2015. as_default="${cross_prefix}gcc"
  2016. ld_default="${cross_prefix}gcc"
  2017. TMPO=$(basename $TMPC .c).o
  2018. append TMPFILES $TMPO
  2019. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  2020. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  2021. AS_DEPFLAGS='-MMD'
  2022. speed_cflags='-O3 -mf=5'
  2023. size_cflags='-O3 -mf=2'
  2024. filter_cflags=tms470_flags
  2025. tms470_flags(){
  2026. for flag; do
  2027. case $flag in
  2028. -march=*|-mcpu=*)
  2029. case "${flag#*=}" in
  2030. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2031. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2032. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2033. armv6*|arm11*) echo -mv=6 ;;
  2034. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2035. echo -mv=5e ;;
  2036. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2037. esac
  2038. ;;
  2039. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2040. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2041. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2042. -msoft-float) echo --float_support=vfplib ;;
  2043. -O[0-3]|-mf=*) echo $flag ;;
  2044. -g) echo -g -mn ;;
  2045. -pds=*) echo $flag ;;
  2046. esac
  2047. done
  2048. }
  2049. elif $cc -v 2>&1 | grep -q clang; then
  2050. cc_type=clang
  2051. $cc -dM -E $TMPC | grep -q __clang_version__ &&
  2052. cc_version=__clang_version__ || cc_version=__VERSION__
  2053. cc_ident=$($cc --version | head -n1)
  2054. CC_DEPFLAGS='-MMD'
  2055. AS_DEPFLAGS='-MMD'
  2056. speed_cflags='-O3'
  2057. size_cflags='-Os'
  2058. elif $cc -V 2>&1 | grep -q Sun; then
  2059. cc_type=suncc
  2060. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  2061. cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2062. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2063. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  2064. add_ldflags -xc99
  2065. speed_cflags='-O5'
  2066. size_cflags='-O5 -xspace'
  2067. filter_cflags=suncc_flags
  2068. suncc_flags(){
  2069. for flag; do
  2070. case $flag in
  2071. -march=*|-mcpu=*)
  2072. case "${flag#*=}" in
  2073. native) echo -xtarget=native ;;
  2074. v9|niagara) echo -xarch=sparc ;;
  2075. ultrasparc) echo -xarch=sparcvis ;;
  2076. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2077. i586|pentium) echo -xchip=pentium ;;
  2078. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2079. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2080. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2081. pentium4*) echo -xtarget=pentium4 ;;
  2082. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2083. *-sse3) echo -xarch=sse3 ;;
  2084. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2085. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  2086. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2087. k8|opteron|athlon64|athlon-fx)
  2088. echo -xarch=sse2a ;;
  2089. athlon*) echo -xarch=pentium_proa ;;
  2090. esac
  2091. ;;
  2092. -std=c99) echo -xc99 ;;
  2093. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2094. -fPIC) echo -KPIC -xcode=pic32 ;;
  2095. -W*,*) echo $flag ;;
  2096. -f*-*|-W*) ;;
  2097. *) echo $flag ;;
  2098. esac
  2099. done
  2100. }
  2101. elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2102. cc_type=pathscale
  2103. cc_version=__PATHSCALE__
  2104. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  2105. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2106. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2107. speed_cflags='-O2'
  2108. size_cflags='-Os'
  2109. filter_cflags='filter_out -Wdisabled-optimization'
  2110. elif $cc -v 2>&1 | grep -q Open64; then
  2111. cc_type=open64
  2112. cc_version=__OPEN64__
  2113. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  2114. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2115. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  2116. speed_cflags='-O2'
  2117. size_cflags='-Os'
  2118. filter_cflags='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2119. fi
  2120. test -n "$cc_type" && enable $cc_type ||
  2121. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2122. : ${as_default:=$cc}
  2123. : ${dep_cc_default:=$cc}
  2124. : ${ld_default:=$cc}
  2125. set_default ar as dep_cc ld
  2126. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  2127. test -n "$CXX_DEPFLAGS" || CXXDEP=$DEPEND_CMD
  2128. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  2129. add_cflags $extra_cflags
  2130. add_cxxflags $extra_cxxflags
  2131. add_asflags $extra_cflags
  2132. if test -n "$sysroot"; then
  2133. case "$cc_type" in
  2134. gcc|llvm_gcc|clang)
  2135. add_cppflags --sysroot="$sysroot"
  2136. add_ldflags --sysroot="$sysroot"
  2137. ;;
  2138. tms470)
  2139. add_cppflags -I"$sysinclude"
  2140. add_ldflags --sysroot="$sysroot"
  2141. ;;
  2142. esac
  2143. fi
  2144. if test "$cpu" = host; then
  2145. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  2146. case "$cc_type" in
  2147. gcc|llvm_gcc)
  2148. check_native(){
  2149. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2150. sed -n "/cc1.*$1=/{
  2151. s/.*$1=\\([^ ]*\\).*/\\1/
  2152. p
  2153. q
  2154. }" $TMPE
  2155. }
  2156. cpu=$(check_native -march || check_native -mcpu)
  2157. ;;
  2158. esac
  2159. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  2160. fi
  2161. # Deal with common $arch aliases
  2162. case "$arch" in
  2163. arm*|iPad*)
  2164. arch="arm"
  2165. ;;
  2166. mips|mipsel|IP*)
  2167. arch="mips"
  2168. ;;
  2169. mips64*)
  2170. arch="mips"
  2171. subarch="mips64"
  2172. ;;
  2173. parisc|hppa)
  2174. arch="parisc"
  2175. ;;
  2176. parisc64|hppa64)
  2177. arch="parisc"
  2178. subarch="parisc64"
  2179. ;;
  2180. "Power Macintosh"|ppc|powerpc|ppc64|powerpc64)
  2181. arch="ppc"
  2182. ;;
  2183. s390|s390x)
  2184. arch="s390"
  2185. ;;
  2186. sh4|sh)
  2187. arch="sh4"
  2188. ;;
  2189. sun4u|sparc64)
  2190. arch="sparc"
  2191. subarch="sparc64"
  2192. ;;
  2193. i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  2194. arch="x86"
  2195. ;;
  2196. esac
  2197. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2198. enable $arch
  2199. # Add processor-specific flags
  2200. if test "$cpu" = generic; then
  2201. : do nothing
  2202. elif enabled ppc; then
  2203. case $(tolower $cpu) in
  2204. 601|ppc601|powerpc601)
  2205. cpuflags="-mcpu=601"
  2206. disable altivec
  2207. ;;
  2208. 603*|ppc603*|powerpc603*)
  2209. cpuflags="-mcpu=603"
  2210. disable altivec
  2211. ;;
  2212. 604*|ppc604*|powerpc604*)
  2213. cpuflags="-mcpu=604"
  2214. disable altivec
  2215. ;;
  2216. g3|75*|ppc75*|powerpc75*)
  2217. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  2218. disable altivec
  2219. ;;
  2220. g4|745*|ppc745*|powerpc745*)
  2221. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  2222. ;;
  2223. 74*|ppc74*|powerpc74*)
  2224. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  2225. ;;
  2226. g5|970|ppc970|powerpc970|power4*)
  2227. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  2228. ;;
  2229. cell)
  2230. cpuflags="-mcpu=cell"
  2231. enable ldbrx
  2232. ;;
  2233. e500v2)
  2234. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2235. disable altivec
  2236. ;;
  2237. e500)
  2238. cpuflags="-mcpu=8540 -mhard-float"
  2239. disable altivec
  2240. ;;
  2241. esac
  2242. elif enabled x86; then
  2243. case $cpu in
  2244. i[345]86|pentium)
  2245. cpuflags="-march=$cpu"
  2246. disable mmx
  2247. ;;
  2248. # targets that do NOT support conditional mov (cmov)
  2249. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2250. cpuflags="-march=$cpu"
  2251. disable cmov
  2252. ;;
  2253. # targets that do support conditional mov (cmov)
  2254. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|amdfam10|barcelona|atom)
  2255. cpuflags="-march=$cpu"
  2256. enable cmov
  2257. enable fast_cmov
  2258. ;;
  2259. # targets that do support conditional mov but on which it's slow
  2260. pentium4|pentium4m|prescott|nocona)
  2261. cpuflags="-march=$cpu"
  2262. enable cmov
  2263. disable fast_cmov
  2264. ;;
  2265. esac
  2266. elif enabled sparc; then
  2267. case $cpu in
  2268. niagara)
  2269. cpuflags="-mcpu=$cpu"
  2270. disable vis
  2271. ;;
  2272. sparc64)
  2273. cpuflags="-mcpu=v9"
  2274. ;;
  2275. esac
  2276. elif enabled arm; then
  2277. case $cpu in
  2278. armv*)
  2279. cpuflags="-march=$cpu"
  2280. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2281. ;;
  2282. *)
  2283. cpuflags="-mcpu=$cpu"
  2284. case $cpu in
  2285. cortex-a*) subarch=armv7a ;;
  2286. cortex-r*) subarch=armv7r ;;
  2287. cortex-m*) enable thumb; subarch=armv7m ;;
  2288. arm11*) subarch=armv6 ;;
  2289. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2290. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2291. esac
  2292. ;;
  2293. esac
  2294. elif enabled alpha; then
  2295. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  2296. elif enabled bfin; then
  2297. cpuflags="-mcpu=$cpu"
  2298. elif enabled mips; then
  2299. cpuflags="-march=$cpu"
  2300. elif enabled avr32; then
  2301. case $cpu in
  2302. ap7[02]0[0-2])
  2303. subarch="avr32_ap"
  2304. cpuflags="-mpart=$cpu"
  2305. ;;
  2306. ap)
  2307. subarch="avr32_ap"
  2308. cpuflags="-march=$cpu"
  2309. ;;
  2310. uc3[ab]*)
  2311. subarch="avr32_uc"
  2312. cpuflags="-mcpu=$cpu"
  2313. ;;
  2314. uc)
  2315. subarch="avr32_uc"
  2316. cpuflags="-march=$cpu"
  2317. ;;
  2318. esac
  2319. fi
  2320. add_cflags $cpuflags
  2321. add_asflags $cpuflags
  2322. # compiler sanity check
  2323. check_exec <<EOF
  2324. int main(void){ return 0; }
  2325. EOF
  2326. if test "$?" != 0; then
  2327. echo "$cc is unable to create an executable file."
  2328. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2329. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2330. echo "Only do this if you know what cross compiling means."
  2331. fi
  2332. die "C compiler test failed."
  2333. fi
  2334. add_cppflags -D_ISOC99_SOURCE
  2335. add_cxxflags -D__STDC_CONSTANT_MACROS
  2336. check_cflags -std=c99
  2337. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2338. #include <stdlib.h>
  2339. EOF
  2340. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2341. #include <stdlib.h>
  2342. EOF
  2343. check_host_cflags -std=c99
  2344. check_host_cflags -Wall
  2345. case "$arch" in
  2346. alpha|ia64|mips|parisc|sparc)
  2347. spic=$shared
  2348. ;;
  2349. x86)
  2350. subarch="x86_32"
  2351. check_cc <<EOF && subarch="x86_64"
  2352. int test[(int)sizeof(char*) - 7];
  2353. EOF
  2354. if test "$subarch" = "x86_64"; then
  2355. spic=$shared
  2356. fi
  2357. ;;
  2358. ppc)
  2359. check_cc <<EOF && subarch="ppc64"
  2360. int test[(int)sizeof(char*) - 7];
  2361. EOF
  2362. ;;
  2363. esac
  2364. enable $subarch
  2365. enabled spic && enable pic
  2366. # OS specific
  2367. case $target_os in
  2368. haiku)
  2369. prefix_default="/boot/common"
  2370. network_extralibs="-lnetwork"
  2371. host_libs=
  2372. ;;
  2373. sunos)
  2374. FFSERVERLDFLAGS=""
  2375. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2376. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2377. network_extralibs="-lsocket -lnsl"
  2378. add_cppflags -D__EXTENSIONS__
  2379. # When using suncc to build, the Solaris linker will mark
  2380. # an executable with each instruction set encountered by
  2381. # the Solaris assembler. As our libraries contain their own
  2382. # guards for processor-specific code, instead suppress
  2383. # generation of the HWCAPS ELF section on Solaris x86 only.
  2384. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  2385. nm_opts='-P -g'
  2386. ;;
  2387. netbsd)
  2388. disable symver
  2389. oss_indev_extralibs="-lossaudio"
  2390. oss_outdev_extralibs="-lossaudio"
  2391. ;;
  2392. openbsd)
  2393. enable malloc_aligned
  2394. # On OpenBSD 4.5. the compiler does not use PIC unless
  2395. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  2396. # however the generated executable will not do anything
  2397. # (simply quits with exit-code 1, no crash, no output).
  2398. # Thus explicitly enable PIC here.
  2399. enable pic
  2400. disable symver
  2401. SHFLAGS='-shared'
  2402. oss_indev_extralibs="-lossaudio"
  2403. oss_outdev_extralibs="-lossaudio"
  2404. ;;
  2405. dragonfly)
  2406. enable malloc_aligned
  2407. disable symver
  2408. ;;
  2409. freebsd)
  2410. enable malloc_aligned
  2411. ;;
  2412. bsd/os)
  2413. add_extralibs -lpoll -lgnugetopt
  2414. strip="strip -d"
  2415. ;;
  2416. darwin)
  2417. enable malloc_aligned
  2418. gas="gas-preprocessor.pl $cc"
  2419. enabled ppc && add_asflags -force_cpusubtype_ALL
  2420. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  2421. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  2422. strip="${strip} -x"
  2423. add_ldflags -Wl,-dynamic,-search_paths_first
  2424. SLIBSUF=".dylib"
  2425. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2426. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2427. FFSERVERLDFLAGS=-Wl,-bind_at_load
  2428. objformat="macho"
  2429. enabled x86_64 && objformat="macho64"
  2430. enabled_any pic shared ||
  2431. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2432. ;;
  2433. mingw32*)
  2434. if test $target_os = "mingw32ce"; then
  2435. disable network
  2436. else
  2437. target_os=mingw32
  2438. fi
  2439. LIBTARGET=i386
  2440. if enabled x86_64; then
  2441. enable malloc_aligned
  2442. LIBTARGET=x64
  2443. elif enabled arm; then
  2444. LIBTARGET=arm-wince
  2445. fi
  2446. shlibdir_default="$bindir_default"
  2447. SLIBPREF=""
  2448. SLIBSUF=".dll"
  2449. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2450. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2451. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  2452. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  2453. SLIB_INSTALL_LINKS=
  2454. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  2455. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  2456. 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'
  2457. objformat="win32"
  2458. enable dos_paths
  2459. check_cflags -fno-common
  2460. check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
  2461. || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2462. die "ERROR: MinGW runtime version must be >= 3.15."
  2463. add_cppflags -U__STRICT_ANSI__
  2464. ;;
  2465. cygwin*)
  2466. target_os=cygwin
  2467. shlibdir_default="$bindir_default"
  2468. SLIBPREF="cyg"
  2469. SLIBSUF=".dll"
  2470. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2471. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2472. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2473. objformat="win32"
  2474. enable dos_paths
  2475. check_cflags -fno-common
  2476. add_cppflags -U__STRICT_ANSI__
  2477. ;;
  2478. *-dos|freedos|opendos)
  2479. network_extralibs="-lsocket"
  2480. objformat="coff"
  2481. enable dos_paths
  2482. add_cppflags -U__STRICT_ANSI__
  2483. ;;
  2484. linux)
  2485. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2486. enable dv1394
  2487. ;;
  2488. irix*)
  2489. target_os=irix
  2490. ranlib="echo ignoring ranlib"
  2491. ;;
  2492. os/2*)
  2493. strip="lxlite -CS"
  2494. ln_s="cp -f"
  2495. objformat="aout"
  2496. add_cppflags -D_GNU_SOURCE
  2497. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2498. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2499. FFSERVERLDFLAGS=""
  2500. LIBSUF="_s.a"
  2501. SLIBPREF=""
  2502. SLIBSUF=".dll"
  2503. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2504. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2505. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2506. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2507. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2508. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2509. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2510. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2511. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2512. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2513. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  2514. enable dos_paths
  2515. enable_weak os2threads
  2516. ;;
  2517. gnu/kfreebsd)
  2518. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
  2519. ;;
  2520. gnu)
  2521. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  2522. ;;
  2523. qnx)
  2524. add_cppflags -D_QNX_SOURCE
  2525. network_extralibs="-lsocket"
  2526. ;;
  2527. symbian)
  2528. SLIBSUF=".dll"
  2529. enable dos_paths
  2530. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  2531. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  2532. add_ldflags -Wl,--target1-abs,--no-undefined \
  2533. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  2534. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  2535. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  2536. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  2537. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  2538. ;;
  2539. none)
  2540. ;;
  2541. *)
  2542. die "Unknown OS '$target_os'."
  2543. ;;
  2544. esac
  2545. echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate
  2546. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2547. set_default $PATHS_LIST
  2548. # we need to build at least one lib type
  2549. if ! enabled_any static shared; then
  2550. cat <<EOF
  2551. At least one library type must be built.
  2552. Specify --enable-static to build the static libraries or --enable-shared to
  2553. build the shared libraries as well. To only build the shared libraries specify
  2554. --disable-static in addition to --enable-shared.
  2555. EOF
  2556. exit 1;
  2557. fi
  2558. die_license_disabled() {
  2559. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2560. }
  2561. die_license_disabled gpl libcdio
  2562. die_license_disabled gpl libx264
  2563. die_license_disabled gpl libxavs
  2564. die_license_disabled gpl libxvid
  2565. die_license_disabled gpl x11grab
  2566. die_license_disabled nonfree libaacplus
  2567. die_license_disabled nonfree libfaac
  2568. die_license_disabled nonfree openssl
  2569. die_license_disabled version3 libopencore_amrnb
  2570. die_license_disabled version3 libopencore_amrwb
  2571. die_license_disabled version3 libvo_aacenc
  2572. die_license_disabled version3 libvo_amrwbenc
  2573. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2574. disabled optimizations || check_cflags -fomit-frame-pointer
  2575. enable_pic() {
  2576. enable pic
  2577. add_cppflags -DPIC
  2578. add_cflags -fPIC
  2579. add_asflags -fPIC
  2580. }
  2581. enabled pic && enable_pic
  2582. check_cc <<EOF || die "Symbol mangling check failed."
  2583. int ff_extern;
  2584. EOF
  2585. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2586. extern_prefix=${sym%%ff_extern*}
  2587. check_cc <<EOF && enable inline_asm
  2588. void foo(void) { __asm__ volatile ("" ::); }
  2589. EOF
  2590. _restrict=
  2591. for restrict_keyword in restrict __restrict__ __restrict; do
  2592. check_cc <<EOF && _restrict=$restrict_keyword && break
  2593. void foo(char * $restrict_keyword p);
  2594. EOF
  2595. done
  2596. check_cc <<EOF && enable attribute_packed
  2597. struct { int x; } __attribute__((packed)) x;
  2598. EOF
  2599. check_cc <<EOF && enable attribute_may_alias
  2600. union { int x; } __attribute__((may_alias)) x;
  2601. EOF
  2602. check_cc <<EOF || die "endian test failed"
  2603. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2604. EOF
  2605. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2606. if enabled alpha; then
  2607. check_cflags -mieee
  2608. elif enabled arm; then
  2609. enabled thumb && check_cflags -mthumb || check_cflags -marm
  2610. nogas=die
  2611. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2612. enable vfp_args
  2613. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2614. case "${cross_prefix:-$cc}" in
  2615. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2616. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2617. __asm__ (".eabi_attribute 28, 1");
  2618. int main(void) { return 0; }
  2619. EOF
  2620. esac
  2621. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2622. fi
  2623. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2624. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2625. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2626. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2627. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2628. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2629. enabled vfpv3 && check_asm vfpv3 '"vmov.f32 s0, #1.0"'
  2630. check_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  2631. enabled_all armv6t2 shared !pic && enable_pic
  2632. elif enabled mips; then
  2633. check_asm loongson '"dmult.g $1, $2, $3"'
  2634. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2635. elif enabled ppc; then
  2636. enable local_aligned_8 local_aligned_16
  2637. check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2638. check_asm ibm_asm '"add 0, 0, 0"'
  2639. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2640. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2641. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2642. if enabled altivec; then
  2643. nogas=warn
  2644. check_cflags -maltivec -mabi=altivec &&
  2645. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2646. check_cflags -faltivec
  2647. # check if our compiler supports Motorola AltiVec C API
  2648. check_cc <<EOF || disable altivec
  2649. $inc_altivec_h
  2650. int main(void) {
  2651. vector signed int v1, v2, v3;
  2652. v1 = vec_add(v2,v3);
  2653. return 0;
  2654. }
  2655. EOF
  2656. # check if our compiler supports braces for vector declarations
  2657. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2658. $inc_altivec_h
  2659. int main (void) { (vector int) {1}; return 0; }
  2660. EOF
  2661. fi
  2662. elif enabled sparc; then
  2663. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2664. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2665. elif enabled x86; then
  2666. enable local_aligned_8 local_aligned_16
  2667. # check whether EBP is available on x86
  2668. # As 'i' is stored on the stack, this program will crash
  2669. # if the base pointer is used to access it because the
  2670. # base pointer is cleared in the inline assembly code.
  2671. check_exec_crash <<EOF && enable ebp_available
  2672. volatile int i=0;
  2673. __asm__ volatile (
  2674. "xorl %%ebp, %%ebp"
  2675. ::: "%ebp");
  2676. return i;
  2677. EOF
  2678. # check whether EBX is available on x86
  2679. check_asm ebx_available '""::"b"(0)' &&
  2680. check_asm ebx_available '"":::"%ebx"'
  2681. # check whether xmm clobbers are supported
  2682. check_asm xmm_clobbers '"":::"%xmm0"'
  2683. # check whether binutils is new enough to compile SSSE3/MMX2
  2684. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2685. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2686. if ! disabled_any asm mmx yasm; then
  2687. if check_cmd $yasmexe --version; then
  2688. enabled x86_64 && yasm_extra="-m amd64"
  2689. yasm_debug="-g dwarf2"
  2690. elif check_cmd nasm -v; then
  2691. yasmexe=nasm
  2692. yasm_debug="-g -F dwarf"
  2693. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  2694. fi
  2695. YASMFLAGS="-f $objformat $yasm_extra"
  2696. enabled pic && append YASMFLAGS "-DPIC"
  2697. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2698. case "$objformat" in
  2699. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  2700. esac
  2701. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  2702. die "yasm not found, use --disable-yasm for a crippled build"
  2703. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
  2704. fi
  2705. case "$cpu" in
  2706. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2707. disable fast_clz
  2708. ;;
  2709. esac
  2710. fi
  2711. if enabled asm; then
  2712. as=${gas:=$as}
  2713. check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
  2714. $nogas "GNU assembler not found, install gas-preprocessor"
  2715. fi
  2716. check_ldflags -Wl,--as-needed
  2717. if check_func dlopen; then
  2718. ldl=
  2719. elif check_func dlopen -ldl; then
  2720. ldl=-ldl
  2721. fi
  2722. if enabled network; then
  2723. check_type "sys/types.h sys/socket.h" socklen_t
  2724. check_type netdb.h "struct addrinfo"
  2725. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  2726. check_type netinet/in.h "struct sockaddr_in6"
  2727. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2728. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2729. # Prefer arpa/inet.h over winsock2
  2730. if check_header arpa/inet.h ; then
  2731. check_func closesocket
  2732. elif check_header winsock2.h ; then
  2733. check_func_headers winsock2.h closesocket -lws2 && \
  2734. network_extralibs="-lws2" || \
  2735. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2736. network_extralibs="-lws2_32"; }
  2737. check_type ws2tcpip.h socklen_t
  2738. check_type ws2tcpip.h "struct addrinfo"
  2739. check_type ws2tcpip.h "struct ipv6_mreq"
  2740. check_type ws2tcpip.h "struct sockaddr_in6"
  2741. check_type ws2tcpip.h "struct sockaddr_storage"
  2742. check_struct winsock2.h "struct sockaddr" sa_len
  2743. else
  2744. disable network
  2745. fi
  2746. fi
  2747. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2748. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2749. check_func fcntl
  2750. check_func fork
  2751. check_func getaddrinfo $network_extralibs
  2752. check_func gethrtime
  2753. check_func getrusage
  2754. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2755. check_func inet_aton $network_extralibs
  2756. check_func isatty
  2757. check_func localtime_r
  2758. check_func ${malloc_prefix}memalign && enable memalign
  2759. check_func mkstemp
  2760. check_func mmap
  2761. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2762. check_func setrlimit
  2763. check_func strerror_r
  2764. check_func strptime
  2765. check_func sched_getaffinity
  2766. check_func sysconf
  2767. check_func sysctl
  2768. check_func_headers conio.h kbhit
  2769. check_func_headers windows.h PeekNamedPipe
  2770. check_func_headers io.h setmode
  2771. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2772. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2773. check_func_headers windows.h GetProcessAffinityMask
  2774. check_func_headers windows.h GetProcessTimes
  2775. check_func_headers windows.h MapViewOfFile
  2776. check_func_headers windows.h VirtualAlloc
  2777. check_header dlfcn.h
  2778. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  2779. check_header libcrystalhd/libcrystalhd_if.h
  2780. check_header malloc.h
  2781. check_header poll.h
  2782. check_header sys/mman.h
  2783. check_header sys/param.h
  2784. check_header sys/resource.h
  2785. check_header sys/select.h
  2786. check_header termios.h
  2787. check_header vdpau/vdpau.h
  2788. check_header vdpau/vdpau_x11.h
  2789. check_header X11/extensions/XvMClib.h
  2790. check_header asm/types.h
  2791. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2792. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2793. # check for VDA header
  2794. if ! disabled vda; then
  2795. if check_header VideoDecodeAcceleration/VDADecoder.h; then
  2796. enable vda
  2797. add_extralibs -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore
  2798. fi
  2799. fi
  2800. if ! disabled w32threads && ! enabled pthreads; then
  2801. check_func _beginthreadex && enable w32threads
  2802. fi
  2803. # check for some common methods of building with pthread support
  2804. # do this before the optional library checks as some of them require pthreads
  2805. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  2806. enable pthreads
  2807. if check_func pthread_create; then
  2808. :
  2809. elif check_func pthread_create -pthread; then
  2810. add_cflags -pthread
  2811. add_extralibs -pthread
  2812. elif check_func pthread_create -pthreads; then
  2813. add_cflags -pthreads
  2814. add_extralibs -pthreads
  2815. elif check_func pthread_create -lpthreadGC2; then
  2816. add_extralibs -lpthreadGC2
  2817. elif ! check_lib pthread.h pthread_create -lpthread; then
  2818. disable pthreads
  2819. fi
  2820. fi
  2821. for thread in $THREADS_LIST; do
  2822. if enabled $thread; then
  2823. test -n "$thread_type" &&
  2824. die "ERROR: Only one thread type must be selected." ||
  2825. thread_type="$thread"
  2826. fi
  2827. done
  2828. check_lib math.h sin -lm && LIBM="-lm"
  2829. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  2830. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  2831. check_mathfunc cbrtf
  2832. check_mathfunc exp2
  2833. check_mathfunc exp2f
  2834. check_mathfunc llrint
  2835. check_mathfunc llrintf
  2836. check_mathfunc log2
  2837. check_mathfunc log2f
  2838. check_mathfunc lrint
  2839. check_mathfunc lrintf
  2840. check_mathfunc round
  2841. check_mathfunc roundf
  2842. check_mathfunc trunc
  2843. check_mathfunc truncf
  2844. # these are off by default, so fail if requested and not available
  2845. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2846. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  2847. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  2848. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  2849. enabled libass && require_pkg_config libass ass/ass.h ass_library_init
  2850. enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray
  2851. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  2852. { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
  2853. die "ERROR: libcelt version must be >= 0.11.0."; }
  2854. enabled libdirac && require_pkg_config dirac \
  2855. "libdirac_decoder/dirac_parser.h" \
  2856. "dirac_decoder_init"
  2857. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2858. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  2859. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2860. enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
  2861. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  2862. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2863. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  2864. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  2865. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  2866. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2867. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  2868. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  2869. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  2870. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2871. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  2872. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  2873. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder
  2874. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2875. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  2876. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  2877. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  2878. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  2879. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2880. enabled libvpx && {
  2881. enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  2882. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  2883. enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
  2884. die "ERROR: libvpx encoder version must be >=0.9.6"; } }
  2885. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  2886. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  2887. die "ERROR: libx264 version must be >= 0.118."; }
  2888. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  2889. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2890. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  2891. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  2892. die "ERROR: openal not found"; } &&
  2893. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  2894. die "ERROR: openal version must be 1.1 or compatible"; }
  2895. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  2896. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  2897. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  2898. die "ERROR: openssl not found"; }
  2899. # libdc1394 check
  2900. if enabled libdc1394; then
  2901. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2902. enable libdc1394_2; } ||
  2903. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2904. enable libdc1394_1; } ||
  2905. die "ERROR: No version of libdc1394 found "
  2906. fi
  2907. SDL_CONFIG="${cross_prefix}sdl-config"
  2908. if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
  2909. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2910. enable sdl &&
  2911. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2912. else
  2913. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2914. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2915. sdl_libs=$("${SDL_CONFIG}" --libs)
  2916. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  2917. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2918. enable sdl &&
  2919. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2920. fi
  2921. fi
  2922. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  2923. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2924. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  2925. check_header linux/fb.h
  2926. check_header linux/videodev.h
  2927. check_header linux/videodev2.h
  2928. check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
  2929. check_header sys/videoio.h
  2930. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2931. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  2932. # w32api 3.12 had it defined wrong
  2933. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  2934. check_type "dshow.h" IBaseFilter
  2935. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2936. { check_header dev/bktr/ioctl_meteor.h &&
  2937. check_header dev/bktr/ioctl_bt848.h; } ||
  2938. { check_header machine/ioctl_meteor.h &&
  2939. check_header machine/ioctl_bt848.h; } ||
  2940. { check_header dev/video/meteor/ioctl_meteor.h &&
  2941. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2942. check_header dev/ic/bt8xx.h
  2943. check_header sndio.h
  2944. if check_struct sys/soundcard.h audio_buf_info bytes; then
  2945. enable_safe sys/soundcard.h
  2946. else
  2947. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  2948. #include <sys/soundcard.h>
  2949. audio_buf_info abc;
  2950. EOF
  2951. fi
  2952. check_header soundcard.h
  2953. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2954. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait
  2955. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  2956. enabled libcdio &&
  2957. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open "-lcdio_paranoia -lcdio_cdda -lcdio"
  2958. enabled x11grab &&
  2959. check_header X11/Xlib.h &&
  2960. check_header X11/extensions/XShm.h &&
  2961. check_header X11/extensions/Xfixes.h &&
  2962. check_func XOpenDisplay -lX11 &&
  2963. check_func XShmCreateImage -lX11 -lXext &&
  2964. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2965. if ! disabled vaapi; then
  2966. check_lib va/va.h vaInitialize -lva && {
  2967. check_cpp_condition va/va_version.h "VA_CHECK_VERSION(0,32,0)" ||
  2968. warn "Please upgrade to VA-API >= 0.32 if you would like full VA-API support.";
  2969. } || disable vaapi
  2970. fi
  2971. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2972. check_cpp_condition \
  2973. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2974. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2975. disable vdpau; }
  2976. fi
  2977. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2978. enabled coverage && add_cflags "-fprofile-arcs -ftest-coverage" && add_ldflags "-fprofile-arcs -ftest-coverage"
  2979. 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"
  2980. # add some useful compiler flags if supported
  2981. check_cflags -Wdeclaration-after-statement
  2982. check_cflags -Wall
  2983. check_cflags -Wno-parentheses
  2984. check_cflags -Wno-switch
  2985. check_cflags -Wno-format-zero-length
  2986. check_cflags -Wdisabled-optimization
  2987. check_cflags -Wpointer-arith
  2988. check_cflags -Wredundant-decls
  2989. check_cflags -Wno-pointer-sign
  2990. check_cflags -Wcast-qual
  2991. check_cflags -Wwrite-strings
  2992. check_cflags -Wtype-limits
  2993. check_cflags -Wundef
  2994. check_cflags -Wmissing-prototypes
  2995. check_cflags -Wno-pointer-to-int-cast
  2996. check_cflags -Wstrict-prototypes
  2997. enabled extra_warnings && check_cflags -Winline
  2998. # add some linker flags
  2999. check_ldflags -Wl,--warn-common
  3000. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
  3001. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  3002. enabled xmm_clobber_test && \
  3003. check_ldflags -Wl,--wrap,avcodec_open2 \
  3004. -Wl,--wrap,avcodec_decode_audio4 \
  3005. -Wl,--wrap,avcodec_decode_video2 \
  3006. -Wl,--wrap,avcodec_decode_subtitle2 \
  3007. -Wl,--wrap,avcodec_encode_audio2 \
  3008. -Wl,--wrap,avcodec_encode_video \
  3009. -Wl,--wrap,avcodec_encode_subtitle \
  3010. -Wl,--wrap,sws_scale || \
  3011. disable xmm_clobber_test
  3012. echo "X{};" > $TMPV
  3013. if test_ldflags -Wl,--version-script,$TMPV; then
  3014. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  3015. check_cc <<EOF && enable symver_asm_label
  3016. void ff_foo(void) __asm__ ("av_foo@VERSION");
  3017. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  3018. EOF
  3019. check_cc <<EOF && enable symver_gnu_asm
  3020. __asm__(".symver ff_foo,av_foo@VERSION");
  3021. void ff_foo(void) {}
  3022. EOF
  3023. fi
  3024. if [ -n "$optflags" ]; then
  3025. add_cflags $optflags
  3026. elif enabled small; then
  3027. add_cflags $size_cflags
  3028. elif enabled optimizations; then
  3029. add_cflags $speed_cflags
  3030. else
  3031. add_cflags $noopt_cflags
  3032. fi
  3033. check_cflags -fno-math-errno
  3034. check_cflags -fno-signed-zeros
  3035. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  3036. int x;
  3037. EOF
  3038. if enabled icc; then
  3039. # Just warnings, no remarks
  3040. check_cflags -w1
  3041. # -wd: Disable following warnings
  3042. # 144, 167, 556: -Wno-pointer-sign
  3043. # 1292: attribute "foo" ignored
  3044. # 10006: ignoring unknown option -fno-signed-zeros
  3045. # 10148: ignoring unknown option -Wno-parentheses
  3046. # 10156: ignoring option '-W'; no argument required
  3047. check_cflags -wd144,167,556,1292,10006,10148,10156
  3048. # 11030: Warning unknown option --as-needed
  3049. # 10156: ignoring option '-export'; no argument required
  3050. check_ldflags -wd10156,11030
  3051. # Allow to compile with optimizations
  3052. check_ldflags -march=$cpu
  3053. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  3054. enable ebp_available
  3055. if enabled x86_32; then
  3056. test ${icc_version%%.*} -ge 11 && \
  3057. check_cflags -falign-stack=maintain-16-byte || \
  3058. disable aligned_stack
  3059. fi
  3060. elif enabled ccc; then
  3061. # disable some annoying warnings
  3062. add_cflags -msg_disable cvtu32to64
  3063. add_cflags -msg_disable embedcomment
  3064. add_cflags -msg_disable needconstext
  3065. add_cflags -msg_disable nomainieee
  3066. add_cflags -msg_disable ptrmismatch1
  3067. add_cflags -msg_disable unreachcode
  3068. elif enabled gcc; then
  3069. check_cflags -fno-tree-vectorize
  3070. check_cflags -Werror=implicit-function-declaration
  3071. check_cflags -Werror=missing-prototypes
  3072. elif enabled llvm_gcc; then
  3073. check_cflags -mllvm -stack-alignment=16
  3074. elif enabled clang; then
  3075. check_cflags -mllvm -stack-alignment=16
  3076. check_cflags -Qunused-arguments
  3077. elif enabled armcc; then
  3078. # 2523: use of inline assembler is deprecated
  3079. add_cflags -W${armcc_opt},--diag_suppress=2523
  3080. add_cflags -W${armcc_opt},--diag_suppress=1207
  3081. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  3082. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  3083. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  3084. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  3085. elif enabled tms470; then
  3086. add_cflags -pds=824 -pds=837
  3087. elif enabled pathscale; then
  3088. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  3089. fi
  3090. enabled_any $THREADS_LIST && enable threads
  3091. check_deps $CONFIG_LIST \
  3092. $CONFIG_EXTRA \
  3093. $HAVE_LIST \
  3094. $ALL_COMPONENTS \
  3095. $ALL_TESTS \
  3096. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  3097. if test $target_os = "haiku"; then
  3098. disable memalign
  3099. disable posix_memalign
  3100. fi
  3101. ! enabled_any memalign posix_memalign malloc_aligned &&
  3102. enabled_any $need_memalign && enable memalign_hack
  3103. # add_dep lib dep
  3104. # -> enable ${lib}_deps_${dep}
  3105. # -> add $dep to ${lib}_deps only once
  3106. add_dep() {
  3107. lib=$1
  3108. dep=$2
  3109. enabled "${lib}_deps_${dep}" && return 0
  3110. enable "${lib}_deps_${dep}"
  3111. prepend "${lib}_deps" $dep
  3112. }
  3113. # merge deps lib components
  3114. # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
  3115. merge_deps() {
  3116. lib=$1
  3117. shift
  3118. for comp in $*; do
  3119. enabled $comp || continue
  3120. eval "dep=\"\$${comp}_deps\""
  3121. for d in $dep; do
  3122. add_dep $lib $d
  3123. done
  3124. done
  3125. }
  3126. merge_deps libavfilter $FILTER_LIST
  3127. echo "install prefix $prefix"
  3128. echo "source path $source_path"
  3129. echo "C compiler $cc"
  3130. echo "ARCH $arch ($cpu)"
  3131. if test "$build_suffix" != ""; then
  3132. echo "build suffix $build_suffix"
  3133. fi
  3134. if test "$progs_suffix" != ""; then
  3135. echo "progs suffix $progs_suffix"
  3136. fi
  3137. if test "$extra_version" != ""; then
  3138. echo "version string suffix $extra_version"
  3139. fi
  3140. echo "big-endian ${bigendian-no}"
  3141. echo "runtime cpu detection ${runtime_cpudetect-no}"
  3142. if enabled x86; then
  3143. echo "${yasmexe} ${yasm-no}"
  3144. echo "MMX enabled ${mmx-no}"
  3145. echo "MMX2 enabled ${mmx2-no}"
  3146. echo "3DNow! enabled ${amd3dnow-no}"
  3147. echo "3DNow! extended enabled ${amd3dnowext-no}"
  3148. echo "SSE enabled ${sse-no}"
  3149. echo "SSSE3 enabled ${ssse3-no}"
  3150. echo "AVX enabled ${avx-no}"
  3151. echo "CMOV enabled ${cmov-no}"
  3152. echo "CMOV is fast ${fast_cmov-no}"
  3153. echo "EBX available ${ebx_available-no}"
  3154. echo "EBP available ${ebp_available-no}"
  3155. fi
  3156. if enabled arm; then
  3157. echo "ARMv5TE enabled ${armv5te-no}"
  3158. echo "ARMv6 enabled ${armv6-no}"
  3159. echo "ARMv6T2 enabled ${armv6t2-no}"
  3160. echo "ARM VFP enabled ${armvfp-no}"
  3161. echo "IWMMXT enabled ${iwmmxt-no}"
  3162. echo "NEON enabled ${neon-no}"
  3163. fi
  3164. if enabled mips; then
  3165. echo "MMI enabled ${mmi-no}"
  3166. fi
  3167. if enabled ppc; then
  3168. echo "AltiVec enabled ${altivec-no}"
  3169. echo "PPC 4xx optimizations ${ppc4xx-no}"
  3170. echo "dcbzl available ${dcbzl-no}"
  3171. fi
  3172. if enabled sparc; then
  3173. echo "VIS enabled ${vis-no}"
  3174. fi
  3175. echo "debug symbols ${debug-no}"
  3176. echo "strip symbols ${stripping-no}"
  3177. echo "optimize for size ${small-no}"
  3178. echo "optimizations ${optimizations-no}"
  3179. echo "static ${static-no}"
  3180. echo "shared ${shared-no}"
  3181. echo "postprocessing support ${postproc-no}"
  3182. echo "new filter support ${avfilter-no}"
  3183. echo "network support ${network-no}"
  3184. echo "threading support ${thread_type-no}"
  3185. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  3186. echo "SDL support ${sdl-no}"
  3187. echo "libdxva2 enabled ${dxva2-no}"
  3188. echo "libva enabled ${vaapi-no}"
  3189. echo "libvdpau enabled ${vdpau-no}"
  3190. echo "AVISynth enabled ${avisynth-no}"
  3191. echo "frei0r enabled ${frei0r-no}"
  3192. echo "gnutls enabled ${gnutls-no}"
  3193. echo "libaacplus enabled ${libaacplus-no}"
  3194. echo "libass enabled ${libass-no}"
  3195. echo "libcdio support ${libcdio-no}"
  3196. echo "libcelt enabled ${libcelt-no}"
  3197. echo "libdc1394 support ${libdc1394-no}"
  3198. echo "libdirac enabled ${libdirac-no}"
  3199. echo "libfaac enabled ${libfaac-no}"
  3200. echo "libgsm enabled ${libgsm-no}"
  3201. echo "libmodplug enabled ${libmodplug-no}"
  3202. echo "libmp3lame enabled ${libmp3lame-no}"
  3203. echo "libnut enabled ${libnut-no}"
  3204. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  3205. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  3206. echo "libopencv support ${libopencv-no}"
  3207. echo "libopenjpeg enabled ${libopenjpeg-no}"
  3208. echo "libpulse enabled ${libpulse-no}"
  3209. echo "librtmp enabled ${librtmp-no}"
  3210. echo "libschroedinger enabled ${libschroedinger-no}"
  3211. echo "libspeex enabled ${libspeex-no}"
  3212. echo "libstagefright-h264 enabled ${libstagefright_h264-no}"
  3213. echo "libtheora enabled ${libtheora-no}"
  3214. echo "libutvideo enabled ${libutvideo-no}"
  3215. echo "libv4l2 enabled ${libv4l2-no}"
  3216. echo "libvo-aacenc support ${libvo_aacenc-no}"
  3217. echo "libvo-amrwbenc support ${libvo_amrwbenc-no}"
  3218. echo "libvorbis enabled ${libvorbis-no}"
  3219. echo "libvpx enabled ${libvpx-no}"
  3220. echo "libx264 enabled ${libx264-no}"
  3221. echo "libxavs enabled ${libxavs-no}"
  3222. echo "libxvid enabled ${libxvid-no}"
  3223. echo "openal enabled ${openal-no}"
  3224. echo "openssl enabled ${openssl-no}"
  3225. echo "zlib enabled ${zlib-no}"
  3226. echo "bzlib enabled ${bzlib-no}"
  3227. echo
  3228. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  3229. echo "Enabled ${type}s:"
  3230. eval list=\$$(toupper $type)_LIST
  3231. print_enabled '_*' $list | sort | pr -r -3 -t
  3232. echo
  3233. done
  3234. license="LGPL version 2.1 or later"
  3235. if enabled nonfree; then
  3236. license="nonfree and unredistributable"
  3237. elif enabled gplv3; then
  3238. license="GPL version 3 or later"
  3239. elif enabled lgplv3; then
  3240. license="LGPL version 3 or later"
  3241. elif enabled gpl; then
  3242. license="GPL version 2 or later"
  3243. fi
  3244. echo "License: $license"
  3245. echo "Creating config.mak and config.h..."
  3246. test -e Makefile || $ln_s "$source_path/Makefile" .
  3247. enabled stripping || strip="echo skipping strip"
  3248. config_files="$TMPH config.mak"
  3249. cat > config.mak <<EOF
  3250. # Automatically generated by configure - do not modify!
  3251. ifndef FFMPEG_CONFIG_MAK
  3252. FFMPEG_CONFIG_MAK=1
  3253. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  3254. prefix=$prefix
  3255. LIBDIR=\$(DESTDIR)$libdir
  3256. SHLIBDIR=\$(DESTDIR)$shlibdir
  3257. INCDIR=\$(DESTDIR)$incdir
  3258. BINDIR=\$(DESTDIR)$bindir
  3259. DATADIR=\$(DESTDIR)$datadir
  3260. MANDIR=\$(DESTDIR)$mandir
  3261. SRC_PATH=$source_path
  3262. ifndef MAIN_MAKEFILE
  3263. SRC_PATH:=\$(SRC_PATH:.%=..%)
  3264. endif
  3265. CC_IDENT=$cc_ident
  3266. ARCH=$arch
  3267. CC=$cc
  3268. CXX=$cxx
  3269. AS=$as
  3270. LD=$ld
  3271. DEPCC=$dep_cc
  3272. YASM=$yasmexe
  3273. YASMDEP=$yasmexe
  3274. AR=$ar
  3275. RANLIB=$ranlib
  3276. CP=cp -p
  3277. LN_S=$ln_s
  3278. STRIP=$strip
  3279. CPPFLAGS=$CPPFLAGS
  3280. CFLAGS=$CFLAGS
  3281. CXXFLAGS=$CXXFLAGS
  3282. ASFLAGS=$ASFLAGS
  3283. AS_O=$CC_O
  3284. CC_O=$CC_O
  3285. CXX_O=$CXX_O
  3286. LDFLAGS=$LDFLAGS
  3287. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  3288. SHFLAGS=$SHFLAGS
  3289. YASMFLAGS=$YASMFLAGS
  3290. BUILDSUF=$build_suffix
  3291. PROGSSUF=$progs_suffix
  3292. FULLNAME=$FULLNAME
  3293. LIBPREF=$LIBPREF
  3294. LIBSUF=$LIBSUF
  3295. LIBNAME=$LIBNAME
  3296. SLIBPREF=$SLIBPREF
  3297. SLIBSUF=$SLIBSUF
  3298. EXESUF=$EXESUF
  3299. EXTRA_VERSION=$extra_version
  3300. DEPFLAGS=$DEPFLAGS
  3301. CCDEP=$CCDEP
  3302. CXXDEP=$CXXDEP
  3303. ASDEP=$ASDEP
  3304. CC_DEPFLAGS=$CC_DEPFLAGS
  3305. AS_DEPFLAGS=$AS_DEPFLAGS
  3306. HOSTCC=$host_cc
  3307. HOSTCFLAGS=$host_cflags
  3308. HOSTEXESUF=$HOSTEXESUF
  3309. HOSTLDFLAGS=$host_ldflags
  3310. HOSTLIBS=$host_libs
  3311. TARGET_EXEC=$target_exec
  3312. TARGET_PATH=$target_path
  3313. SDL_LIBS=$sdl_libs
  3314. SDL_CFLAGS=$sdl_cflags
  3315. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  3316. EXTRALIBS=$extralibs
  3317. INSTALL=$install
  3318. LIBTARGET=${LIBTARGET}
  3319. SLIBNAME=${SLIBNAME}
  3320. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  3321. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  3322. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  3323. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  3324. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  3325. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  3326. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  3327. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  3328. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  3329. NOREDZONE_FLAGS=$noredzone_flags
  3330. EOF
  3331. get_version(){
  3332. name=$1
  3333. file=$source_path/$2
  3334. # This condition will be removed when we stop supporting old libpostproc versions
  3335. if ! test "$name" = LIBPOSTPROC || test "$postproc_version" = current; then
  3336. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  3337. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  3338. fi
  3339. lcname=$(tolower $name)
  3340. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  3341. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  3342. }
  3343. get_version LIBAVCODEC libavcodec/version.h
  3344. get_version LIBAVDEVICE libavdevice/avdevice.h
  3345. get_version LIBAVFILTER libavfilter/version.h
  3346. get_version LIBAVFORMAT libavformat/version.h
  3347. get_version LIBAVUTIL libavutil/avutil.h
  3348. get_version LIBPOSTPROC libpostproc/postprocess.h
  3349. get_version LIBSWRESAMPLE libswresample/swresample.h
  3350. get_version LIBSWSCALE libswscale/swscale.h
  3351. cat > $TMPH <<EOF
  3352. /* Automatically generated by configure - do not modify! */
  3353. #ifndef FFMPEG_CONFIG_H
  3354. #define FFMPEG_CONFIG_H
  3355. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  3356. #define FFMPEG_LICENSE "$(c_escape $license)"
  3357. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  3358. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  3359. #define CC_TYPE "$cc_type"
  3360. #define CC_VERSION $cc_version
  3361. #define restrict $_restrict
  3362. #define EXTERN_PREFIX "${extern_prefix}"
  3363. #define EXTERN_ASM ${extern_prefix}
  3364. #define SLIBSUF "$SLIBSUF"
  3365. EOF
  3366. test -n "$malloc_prefix" &&
  3367. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  3368. if enabled small || disabled optimizations; then
  3369. echo "#undef av_always_inline" >> $TMPH
  3370. if enabled small; then
  3371. echo "#define av_always_inline inline" >> $TMPH
  3372. else
  3373. echo "#define av_always_inline av_unused" >> $TMPH
  3374. fi
  3375. fi
  3376. if enabled yasm; then
  3377. append config_files $TMPASM
  3378. printf '' >$TMPASM
  3379. fi
  3380. print_config ARCH_ "$config_files" $ARCH_LIST
  3381. print_config HAVE_ "$config_files" $HAVE_LIST
  3382. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  3383. $CONFIG_EXTRA \
  3384. $ALL_COMPONENTS \
  3385. cat >>config.mak <<EOF
  3386. ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
  3387. VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS)
  3388. LAVF_FATE_TESTS=$(print_enabled -n _test $LAVF_FATE_TESTS)
  3389. LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
  3390. LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
  3391. SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
  3392. EOF
  3393. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  3394. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  3395. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3396. cp_if_changed $TMPH config.h
  3397. touch .config
  3398. enabled yasm && cp_if_changed $TMPASM config.asm
  3399. cat > $TMPH <<EOF
  3400. /* Generated by ffconf */
  3401. #ifndef AVUTIL_AVCONFIG_H
  3402. #define AVUTIL_AVCONFIG_H
  3403. EOF
  3404. test "$postproc_version" != current && cat >> $TMPH <<EOF
  3405. #define LIBPOSTPROC_VERSION_MAJOR $LIBPOSTPROC_VERSION_MAJOR
  3406. #define LIBPOSTPROC_VERSION_MINOR $LIBPOSTPROC_VERSION_MINOR
  3407. #define LIBPOSTPROC_VERSION_MICRO $LIBPOSTPROC_VERSION_MICRO
  3408. EOF
  3409. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3410. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3411. cp_if_changed $TMPH libavutil/avconfig.h
  3412. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3413. # build pkg-config files
  3414. pkgconfig_generate(){
  3415. name=$1
  3416. shortname=${name#lib}${build_suffix}
  3417. comment=$2
  3418. version=$3
  3419. libs=$4
  3420. requires=$5
  3421. enabled ${name#lib} || return 0
  3422. mkdir -p $name
  3423. cat <<EOF > $name/$name.pc
  3424. prefix=$prefix
  3425. exec_prefix=\${prefix}
  3426. libdir=$libdir
  3427. includedir=$incdir
  3428. Name: $name
  3429. Description: $comment
  3430. Version: $version
  3431. Requires: $(enabled shared || echo $requires)
  3432. Requires.private: $(enabled shared && echo $requires)
  3433. Conflicts:
  3434. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3435. Libs.private: $(enabled shared && echo $libs)
  3436. Cflags: -I\${includedir}
  3437. EOF
  3438. cat <<EOF > $name/$name-uninstalled.pc
  3439. prefix=
  3440. exec_prefix=
  3441. libdir=\${pcfiledir}
  3442. includedir=${source_path}
  3443. Name: $name
  3444. Description: $comment
  3445. Version: $version
  3446. Requires: $requires
  3447. Conflicts:
  3448. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3449. Cflags: -I\${includedir}
  3450. EOF
  3451. }
  3452. libavfilter_pc_deps=""
  3453. enabled libavfilter_deps_avcodec && prepend libavfilter_pc_deps "libavcodec = $LIBAVCODEC_VERSION,"
  3454. enabled libavfilter_deps_avformat && prepend libavfilter_pc_deps "libavformat = $LIBAVFORMAT_VERSION,"
  3455. enabled libavfilter_deps_swscale && prepend libavfilter_pc_deps "libswscale = $LIBSWSCALE_VERSION,"
  3456. enabled libavfilter_deps_swresample && prepend libavfilter_pc_deps "libswresample = $LIBSWRESAMPLE_VERSION,"
  3457. enabled libavfilter_deps_postproc && prepend libavfilter_pc_deps "libpostproc = $LIBPOSTPROC_VERSION,"
  3458. libavfilter_pc_deps=${libavfilter_pc_deps%, }
  3459. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  3460. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  3461. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3462. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3463. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$libavfilter_pc_deps"
  3464. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
  3465. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"
  3466. pkgconfig_generate libswresample "FFmpeg audio rescaling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil = $LIBAVUTIL_VERSION"