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.

3784 lines
114KB

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