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.

3883 lines
118KB

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