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.

3294 lines
96KB

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