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.

3417 lines
101KB

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