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.

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