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.

3880 lines
116KB

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