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.

3982 lines
119KB

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