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.

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