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.

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