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.

3957 lines
118KB

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