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.

3874 lines
117KB

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