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.

3202 lines
93KB

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