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.

3201 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. mdct_select="fft"
  1046. rdft_select="fft"
  1047. # decoders / encoders / hardware accelerators
  1048. aac_decoder_select="mdct rdft"
  1049. aac_encoder_select="mdct"
  1050. ac3_decoder_select="mdct ac3_parser"
  1051. alac_encoder_select="lpc"
  1052. amrnb_decoder_select="lsp"
  1053. atrac1_decoder_select="mdct"
  1054. atrac3_decoder_select="mdct"
  1055. binkaudio_dct_decoder_select="mdct rdft dct"
  1056. binkaudio_rdft_decoder_select="mdct rdft"
  1057. cavs_decoder_select="golomb"
  1058. cook_decoder_select="mdct"
  1059. cscd_decoder_suggest="zlib"
  1060. dca_decoder_select="mdct"
  1061. dnxhd_encoder_select="aandct"
  1062. dxa_decoder_select="zlib"
  1063. eac3_decoder_select="ac3_decoder"
  1064. eamad_decoder_select="aandct"
  1065. eatgq_decoder_select="aandct"
  1066. eatqi_decoder_select="aandct"
  1067. ffv1_decoder_select="golomb"
  1068. flac_decoder_select="golomb"
  1069. flac_encoder_select="golomb lpc"
  1070. flashsv_decoder_select="zlib"
  1071. flashsv_encoder_select="zlib"
  1072. flv_decoder_select="h263_decoder"
  1073. flv_encoder_select="h263_encoder"
  1074. h261_encoder_select="aandct"
  1075. h263_decoder_select="h263_parser"
  1076. h263_encoder_select="aandct"
  1077. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1078. h263i_decoder_select="h263_decoder"
  1079. h263p_encoder_select="h263_encoder"
  1080. h264_decoder_select="golomb h264dsp"
  1081. h264_dxva2_hwaccel_deps="dxva2api_h"
  1082. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1083. h264_vaapi_hwaccel_select="vaapi"
  1084. h264_vdpau_decoder_select="vdpau h264_decoder"
  1085. imc_decoder_select="fft mdct"
  1086. jpegls_decoder_select="golomb"
  1087. jpegls_encoder_select="golomb"
  1088. ljpeg_encoder_select="aandct"
  1089. loco_decoder_select="golomb"
  1090. mjpeg_encoder_select="aandct"
  1091. mlp_decoder_select="mlp_parser"
  1092. mp1float_decoder_select="dct"
  1093. mp2float_decoder_select="dct"
  1094. mp3adufloat_decoder_select="dct"
  1095. mp3float_decoder_select="dct"
  1096. mp3on4float_decoder_select="dct"
  1097. mpeg1video_encoder_select="aandct"
  1098. mpeg2video_encoder_select="aandct"
  1099. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1100. mpeg4_encoder_select="h263_encoder"
  1101. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1102. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1103. mpeg2_dxva2_hwaccel_deps="dxva2api_h"
  1104. mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder"
  1105. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1106. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  1107. mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
  1108. mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
  1109. mpeg_xvmc_decoder_select="mpegvideo_decoder"
  1110. msmpeg4v1_decoder_select="h263_decoder"
  1111. msmpeg4v1_encoder_select="h263_encoder"
  1112. msmpeg4v2_decoder_select="h263_decoder"
  1113. msmpeg4v2_encoder_select="h263_encoder"
  1114. msmpeg4v3_decoder_select="h263_decoder"
  1115. msmpeg4v3_encoder_select="h263_encoder"
  1116. nellymoser_decoder_select="mdct"
  1117. nellymoser_encoder_select="mdct"
  1118. png_decoder_select="zlib"
  1119. png_encoder_select="zlib"
  1120. qcelp_decoder_select="lsp"
  1121. qdm2_decoder_select="mdct rdft"
  1122. ra_144_encoder_select="lpc"
  1123. rv10_decoder_select="h263_decoder"
  1124. rv10_encoder_select="h263_encoder"
  1125. rv20_decoder_select="h263_decoder"
  1126. rv20_encoder_select="h263_encoder"
  1127. rv30_decoder_select="golomb h264dsp"
  1128. rv40_decoder_select="golomb h264dsp"
  1129. shorten_decoder_select="golomb"
  1130. sipr_decoder_select="lsp"
  1131. snow_decoder_select="dwt"
  1132. snow_encoder_select="aandct dwt"
  1133. sonic_decoder_select="golomb"
  1134. sonic_encoder_select="golomb"
  1135. sonic_ls_encoder_select="golomb"
  1136. svq1_encoder_select="aandct"
  1137. svq3_decoder_select="golomb h264dsp"
  1138. svq3_decoder_suggest="zlib"
  1139. theora_decoder_select="vp3_decoder"
  1140. tiff_decoder_suggest="zlib"
  1141. tiff_encoder_suggest="zlib"
  1142. truehd_decoder_select="mlp_decoder"
  1143. tscc_decoder_select="zlib"
  1144. twinvq_decoder_select="mdct lsp"
  1145. vc1_decoder_select="h263_decoder"
  1146. vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
  1147. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1148. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1149. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1150. vorbis_decoder_select="mdct"
  1151. vorbis_encoder_select="mdct"
  1152. vp6a_decoder_select="vp6_decoder"
  1153. vp6f_decoder_select="vp6_decoder"
  1154. vp8_decoder_select="h264dsp"
  1155. wmapro_decoder_select="mdct"
  1156. wmav1_decoder_select="mdct"
  1157. wmav1_encoder_select="mdct"
  1158. wmav2_decoder_select="mdct"
  1159. wmav2_encoder_select="mdct"
  1160. wmavoice_decoder_select="lsp rdft dct mdct"
  1161. wmv1_decoder_select="h263_decoder"
  1162. wmv1_encoder_select="h263_encoder"
  1163. wmv2_decoder_select="h263_decoder"
  1164. wmv2_encoder_select="h263_encoder"
  1165. wmv3_decoder_select="vc1_decoder"
  1166. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1167. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1168. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1169. zlib_decoder_select="zlib"
  1170. zlib_encoder_select="zlib"
  1171. zmbv_decoder_select="zlib"
  1172. zmbv_encoder_select="zlib"
  1173. vaapi_deps="va_va_h"
  1174. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1175. # parsers
  1176. h264_parser_select="golomb h264dsp"
  1177. # external libraries
  1178. libdirac_decoder_deps="libdirac !libschroedinger"
  1179. libdirac_encoder_deps="libdirac"
  1180. libfaac_encoder_deps="libfaac"
  1181. libgsm_decoder_deps="libgsm"
  1182. libgsm_encoder_deps="libgsm"
  1183. libgsm_ms_decoder_deps="libgsm"
  1184. libgsm_ms_encoder_deps="libgsm"
  1185. libmp3lame_encoder_deps="libmp3lame"
  1186. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1187. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1188. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1189. libopenjpeg_decoder_deps="libopenjpeg"
  1190. libschroedinger_decoder_deps="libschroedinger"
  1191. libschroedinger_encoder_deps="libschroedinger"
  1192. libspeex_decoder_deps="libspeex"
  1193. libtheora_encoder_deps="libtheora"
  1194. libvorbis_encoder_deps="libvorbis"
  1195. libvpx_decoder_deps="libvpx"
  1196. libvpx_encoder_deps="libvpx"
  1197. libx264_encoder_deps="libx264"
  1198. libxvid_encoder_deps="libxvid"
  1199. # demuxers / muxers
  1200. ac3_demuxer_deps="ac3_parser"
  1201. asf_stream_muxer_select="asf_muxer"
  1202. avisynth_demuxer_deps="avisynth"
  1203. dirac_demuxer_deps="dirac_parser"
  1204. eac3_demuxer_select="ac3_parser"
  1205. ipod_muxer_select="mov_muxer"
  1206. libnut_demuxer_deps="libnut"
  1207. libnut_muxer_deps="libnut"
  1208. matroska_audio_muxer_select="matroska_muxer"
  1209. matroska_demuxer_suggest="zlib bzlib"
  1210. mov_demuxer_suggest="zlib"
  1211. mp3_demuxer_deps="mpegaudio_parser"
  1212. mp4_muxer_select="mov_muxer"
  1213. mpegtsraw_demuxer_select="mpegts_demuxer"
  1214. mxf_d10_muxer_select="mxf_muxer"
  1215. ogg_demuxer_select="golomb"
  1216. psp_muxer_select="mov_muxer"
  1217. rtsp_demuxer_deps="sdp_demuxer"
  1218. rtsp_muxer_deps="sdp_demuxer"
  1219. rtsp_muxer_select="rtp_muxer"
  1220. sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
  1221. sdp_demuxer_select="asf_demuxer rm_demuxer"
  1222. spdif_muxer_select="aac_parser"
  1223. tg2_muxer_select="mov_muxer"
  1224. tgp_muxer_select="mov_muxer"
  1225. w64_demuxer_deps="wav_demuxer"
  1226. # indevs / outdevs
  1227. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1228. alsa_indev_extralibs="-lasound"
  1229. alsa_outdev_deps="alsa_asoundlib_h"
  1230. alsa_outdev_extralibs="-lasound"
  1231. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1232. dv1394_indev_deps="dv1394 dv_demuxer"
  1233. jack_indev_deps="jack_jack_h"
  1234. jack_indev_extralibs="-ljack"
  1235. libdc1394_indev_deps="libdc1394"
  1236. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1237. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1238. v4l_indev_deps="linux_videodev_h"
  1239. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1240. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1241. vfwcap_indev_extralibs="-lavicap32"
  1242. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1243. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1244. # protocols
  1245. gopher_protocol_deps="network"
  1246. http_protocol_deps="network"
  1247. http_protocol_select="tcp_protocol"
  1248. mmst_protocol_deps="network"
  1249. rtmp_protocol_select="tcp_protocol"
  1250. rtp_protocol_select="udp_protocol"
  1251. tcp_protocol_deps="network"
  1252. udp_protocol_deps="network"
  1253. # filters
  1254. movie_filter_deps="avfilter_lavf"
  1255. avfilter_lavf_deps="avformat"
  1256. # libraries
  1257. avdevice_deps="avcodec avformat"
  1258. avformat_deps="avcodec"
  1259. # programs
  1260. ffmpeg_deps="avcodec avformat swscale"
  1261. ffmpeg_select="buffer_filter"
  1262. ffplay_deps="avcodec avformat swscale sdl"
  1263. ffplay_select="rdft"
  1264. ffprobe_deps="avcodec avformat"
  1265. ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer"
  1266. ffserver_extralibs='$ldl'
  1267. doc_deps="texi2html"
  1268. # tests
  1269. test_deps(){
  1270. suf1=$1
  1271. suf2=$2
  1272. shift 2
  1273. for v; do
  1274. dep=${v%=*}
  1275. tests=${v#*=}
  1276. for name in ${tests}; do
  1277. eval ${name}_test_deps="'${dep}$suf1 ${dep}$suf2'"
  1278. done
  1279. done
  1280. }
  1281. test_deps _encoder _decoder \
  1282. ac3 \
  1283. adpcm_g726=g726 \
  1284. adpcm_ima_qt \
  1285. adpcm_ima_wav \
  1286. adpcm_ms \
  1287. adpcm_swf \
  1288. adpcm_yamaha=adpcm_yam \
  1289. alac \
  1290. asv1 \
  1291. asv2 \
  1292. bmp \
  1293. dnxhd="hdxhd_1080i dnxhd_720p dnxhd_720p_rd" \
  1294. dvvideo="dv dv50" \
  1295. ffv1 \
  1296. flac \
  1297. flashsv \
  1298. flv \
  1299. gif \
  1300. h261 \
  1301. h263="h263 h263p" \
  1302. huffyuv \
  1303. jpegls \
  1304. mjpeg="jpg mjpeg ljpeg" \
  1305. mp2 \
  1306. mpeg1video="mpeg mpeg1b" \
  1307. mpeg2video="mpeg2 mpeg2thread" \
  1308. mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc" \
  1309. msmpeg4v1=msmpeg4 \
  1310. msmpeg4v2 \
  1311. pbm=pbmpipe \
  1312. pcx \
  1313. pgm="pgm pgmpipe" \
  1314. ppm="ppm ppmpipe" \
  1315. rawvideo="rgb yuv" \
  1316. roq \
  1317. rv10 \
  1318. rv20 \
  1319. sgi \
  1320. snow="snow snowll" \
  1321. svq1 \
  1322. targa=tga \
  1323. tiff \
  1324. wmav1 \
  1325. wmav2 \
  1326. wmv1 \
  1327. wmv2 \
  1328. test_deps _muxer _demuxer \
  1329. aiff \
  1330. pcm_alaw=alaw \
  1331. asf \
  1332. au \
  1333. avi \
  1334. dv=dv_fmt \
  1335. ffm \
  1336. flv=flv_fmt \
  1337. gxf \
  1338. matroska=mkv \
  1339. mmf \
  1340. mov \
  1341. pcm_mulaw=mulaw \
  1342. mxf \
  1343. nut \
  1344. ogg \
  1345. rawvideo=pixfmt \
  1346. rm \
  1347. swf \
  1348. mpegts=ts \
  1349. voc \
  1350. wav \
  1351. yuv4mpegpipe=yuv4mpeg \
  1352. mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
  1353. # default parameters
  1354. logfile="config.log"
  1355. # installation paths
  1356. prefix_default="/usr/local"
  1357. bindir_default='${prefix}/bin'
  1358. datadir_default='${prefix}/share/ffmpeg'
  1359. incdir_default='${prefix}/include'
  1360. libdir_default='${prefix}/lib'
  1361. mandir_default='${prefix}/share/man'
  1362. shlibdir_default="$libdir_default"
  1363. # toolchain
  1364. ar_default="ar"
  1365. cc_default="gcc"
  1366. cc_version=\"unknown\"
  1367. host_cc_default="gcc"
  1368. ln_s="ln -sf"
  1369. nm_default="nm"
  1370. objformat="elf"
  1371. ranlib="ranlib"
  1372. strip_default="strip"
  1373. yasmexe="yasm"
  1374. nogas=":"
  1375. nm_opts='-g'
  1376. # machine
  1377. arch_default=$(uname -m)
  1378. cpu="generic"
  1379. # OS
  1380. target_os_default=$(tolower $(uname -s))
  1381. host_os=$target_os_default
  1382. # configurable options
  1383. enable avcodec
  1384. enable avdevice
  1385. enable avfilter
  1386. enable avformat
  1387. enable avutil
  1388. enable asm
  1389. enable debug
  1390. enable doc
  1391. enable fastdiv
  1392. enable ffmpeg
  1393. enable ffplay
  1394. enable ffprobe
  1395. enable ffserver
  1396. enable mpegaudio_hp
  1397. enable network
  1398. enable optimizations
  1399. enable protocols
  1400. enable static
  1401. enable stripping
  1402. enable swscale
  1403. enable swscale_alpha
  1404. # build settings
  1405. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1406. FFSERVERLDFLAGS=-Wl,-E
  1407. LIBPREF="lib"
  1408. LIBSUF=".a"
  1409. FULLNAME='$(NAME)$(BUILDSUF)'
  1410. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1411. SLIBPREF="lib"
  1412. SLIBSUF=".so"
  1413. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1414. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1415. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1416. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1417. CC_O='-o $@'
  1418. host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
  1419. host_libs='-lm'
  1420. target_path='$(CURDIR)'
  1421. # since the object filename is not given with the -MM flag, the compiler
  1422. # is only able to print the basename, and we must add the path ourselves
  1423. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1424. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1425. # find source path
  1426. source_path="$(dirname "$0")"
  1427. enable source_path_used
  1428. if test -f configure; then
  1429. source_path="$(pwd)"
  1430. disable source_path_used
  1431. else
  1432. source_path="$(cd "$source_path"; pwd)"
  1433. echo "$source_path" | grep -q '[[:blank:]]' &&
  1434. die "Out of tree builds are impossible with whitespace in source path."
  1435. test -e "$source_path/config.h" &&
  1436. die "Out of tree builds are impossible with config.h in source dir."
  1437. fi
  1438. for v in "$@"; do
  1439. r=${v#*=}
  1440. l=${v%"$r"}
  1441. r=$(sh_quote "$r")
  1442. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  1443. done
  1444. find_things(){
  1445. thing=$1
  1446. pattern=$2
  1447. file=$source_path/$3
  1448. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1449. }
  1450. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1451. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1452. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1453. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1454. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1455. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1456. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1457. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1458. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1459. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1460. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1461. find_tests(){
  1462. map 'echo ${v}_test' $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
  1463. }
  1464. ACODEC_TESTS=$(find_tests acodec)
  1465. VCODEC_TESTS=$(find_tests vsynth1)
  1466. LAVF_TESTS=$(find_tests lavf)
  1467. pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
  1468. for n in $COMPONENT_LIST; do
  1469. v=$(toupper ${n%s})_LIST
  1470. eval enable \$$v
  1471. eval ${n}_if_any="\$$v"
  1472. done
  1473. enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS
  1474. die_unknown(){
  1475. echo "Unknown option \"$1\"."
  1476. echo "See $0 --help for available options."
  1477. exit 1
  1478. }
  1479. show_list() {
  1480. suffix=_$1
  1481. shift
  1482. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1483. exit 0
  1484. }
  1485. for opt do
  1486. optval="${opt#*=}"
  1487. case "$opt" in
  1488. --extra-ldflags=*) add_ldflags $optval
  1489. ;;
  1490. --extra-libs=*) add_extralibs $optval
  1491. ;;
  1492. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1493. ;;
  1494. --enable-debug=*) debuglevel="$optval"
  1495. ;;
  1496. --disable-everything)
  1497. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1498. ;;
  1499. --enable-*=*|--disable-*=*)
  1500. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1501. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1502. eval list=\$$(toupper $thing)_LIST
  1503. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1504. $action $(filter "$name" $list)
  1505. ;;
  1506. --enable-?*|--disable-?*)
  1507. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1508. if is_in $option $COMPONENT_LIST; then
  1509. test $action = disable && action=unset
  1510. eval $action \$$(toupper ${option%s})_LIST
  1511. elif is_in $option $CMDLINE_SELECT; then
  1512. $action $option
  1513. else
  1514. die_unknown $opt
  1515. fi
  1516. ;;
  1517. --list-*)
  1518. NAME="${opt#--list-}"
  1519. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1520. NAME=${NAME%s}
  1521. eval show_list $NAME \$$(toupper $NAME)_LIST
  1522. ;;
  1523. --help|-h) show_help
  1524. ;;
  1525. *)
  1526. optname="${opt%%=*}"
  1527. optname="${optname#--}"
  1528. optname=$(echo "$optname" | sed 's/-/_/g')
  1529. if is_in $optname $CMDLINE_SET; then
  1530. eval $optname='$optval'
  1531. elif is_in $optname $CMDLINE_APPEND; then
  1532. append $optname "$optval"
  1533. else
  1534. die_unknown $opt
  1535. fi
  1536. ;;
  1537. esac
  1538. done
  1539. disabled logging && logfile=/dev/null
  1540. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1541. set >> $logfile
  1542. test -n "$cross_prefix" && enable cross_compile
  1543. if enabled cross_compile; then
  1544. test -n "$arch" && test -n "$target_os" ||
  1545. die "Must specify target arch and OS when cross-compiling"
  1546. fi
  1547. set_default arch target_os
  1548. ar_default="${cross_prefix}${ar_default}"
  1549. cc_default="${cross_prefix}${cc_default}"
  1550. nm_default="${cross_prefix}${nm_default}"
  1551. ranlib="${cross_prefix}${ranlib}"
  1552. strip_default="${cross_prefix}${strip_default}"
  1553. sysinclude_default="${sysroot}/usr/include"
  1554. set_default cc nm strip sysinclude
  1555. enabled cross_compile || host_cc_default=$cc
  1556. set_default host_cc
  1557. exesuf() {
  1558. case $1 in
  1559. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
  1560. esac
  1561. }
  1562. EXESUF=$(exesuf $target_os)
  1563. HOSTEXESUF=$(exesuf $host_os)
  1564. # set temporary file name
  1565. : ${TMPDIR:=$TEMPDIR}
  1566. : ${TMPDIR:=$TMP}
  1567. : ${TMPDIR:=/tmp}
  1568. if ! check_cmd type mktemp; then
  1569. # simple replacement for missing mktemp
  1570. # NOT SAFE FOR GENERAL USE
  1571. mktemp(){
  1572. echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
  1573. }
  1574. fi
  1575. tmpfile(){
  1576. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1577. (set -C; exec > $tmp) 2>/dev/null ||
  1578. die "Unable to create temporary file in $TMPDIR."
  1579. append TMPFILES $tmp
  1580. eval $1=$tmp
  1581. }
  1582. trap 'rm -f -- $TMPFILES' EXIT
  1583. trap exit HUP INT TERM
  1584. tmpfile TMPC .c
  1585. tmpfile TMPE $EXESUF
  1586. tmpfile TMPH .h
  1587. tmpfile TMPO .o
  1588. tmpfile TMPS .S
  1589. tmpfile TMPV .ver
  1590. tmpfile TMPSH .sh
  1591. unset -f mktemp
  1592. # make sure we can execute files in $TMPDIR
  1593. cat > $TMPSH 2>> $logfile <<EOF
  1594. #! /bin/sh
  1595. EOF
  1596. chmod +x $TMPSH >> $logfile 2>&1
  1597. if ! $TMPSH >> $logfile 2>&1; then
  1598. cat <<EOF
  1599. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1600. variable to another directory and make sure that it is not mounted noexec.
  1601. EOF
  1602. die "Sanity test failed."
  1603. fi
  1604. filter_cflags=echo
  1605. filter_cppflags=echo
  1606. filter_asflags=echo
  1607. if $cc -v 2>&1 | grep -qi ^gcc; then
  1608. cc_type=gcc
  1609. cc_version=__VERSION__
  1610. if ! $cc -dumpversion | grep -q '^2\.'; then
  1611. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1612. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1613. fi
  1614. speed_cflags='-O3'
  1615. size_cflags='-Os'
  1616. elif $cc --version 2>/dev/null | grep -q Intel; then
  1617. cc_type=icc
  1618. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1619. CC_DEPFLAGS='-MMD'
  1620. AS_DEPFLAGS='-MMD'
  1621. speed_cflags='-O3'
  1622. size_cflags='-Os'
  1623. noopt_cflags='-O1'
  1624. elif $cc -v 2>&1 | grep -q xlc; then
  1625. cc_type=xlc
  1626. cc_version="AV_STRINGIFY(__IBMC__)"
  1627. speed_cflags='-O5'
  1628. size_cflags='-O5 -qcompact'
  1629. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1630. cc_type=ccc
  1631. cc_version="AV_STRINGIFY(__DECC_VER)"
  1632. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1633. debuglevel=3
  1634. add_ldflags -Wl,-z,now # calls to libots crash without this
  1635. speed_cflags='-fast'
  1636. size_cflags='-O1'
  1637. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1638. test -d "$sysroot" || die "No valid sysroot specified."
  1639. cc_type=armcc
  1640. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1641. armcc_conf="$PWD/armcc.conf"
  1642. $cc --arm_linux_configure \
  1643. --arm_linux_config_file="$armcc_conf" \
  1644. --configure_sysroot="$sysroot" \
  1645. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1646. die "Error creating armcc configuration file."
  1647. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1648. as_default="${cross_prefix}gcc"
  1649. CC_DEPFLAGS='-MMD'
  1650. AS_DEPFLAGS='-MMD'
  1651. speed_cflags='-O3'
  1652. size_cflags='-Os'
  1653. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1654. cc_type=tms470
  1655. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1656. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1657. CC_O='-fr=$(@D)'
  1658. as_default="${cross_prefix}gcc"
  1659. ld_default="${cross_prefix}gcc"
  1660. TMPO=$(basename $TMPC .c).o
  1661. append TMPFILES $TMPO
  1662. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1663. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1664. AS_DEPFLAGS='-MMD'
  1665. speed_cflags='-O3 -mf=5'
  1666. size_cflags='-O3 -mf=2'
  1667. filter_cflags=tms470_flags
  1668. tms470_flags(){
  1669. for flag; do
  1670. case $flag in
  1671. -march=*|-mcpu=*)
  1672. case "${flag#*=}" in
  1673. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1674. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1675. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1676. armv6*|arm11*) echo -mv=6 ;;
  1677. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1678. echo -mv=5e ;;
  1679. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1680. esac
  1681. ;;
  1682. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1683. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1684. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1685. -msoft-float) echo --float_support=vfplib ;;
  1686. -O[0-3]|-mf=*) echo $flag ;;
  1687. -g) echo -g -mn ;;
  1688. -pds=*) echo $flag ;;
  1689. esac
  1690. done
  1691. }
  1692. elif $cc -v 2>&1 | grep -q clang; then
  1693. cc_type=clang
  1694. $cc -dM -E $TMPC | grep -q __clang_version__ &&
  1695. cc_version=__clang_version__ || cc_version=__VERSION__
  1696. CC_DEPFLAGS='-MMD'
  1697. AS_DEPFLAGS='-MMD'
  1698. speed_cflags='-O3'
  1699. size_cflags='-Os'
  1700. elif $cc -V 2>&1 | grep -q Sun; then
  1701. cc_type=suncc
  1702. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1703. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1704. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1705. speed_cflags='-O5'
  1706. size_cflags='-O5 -xspace'
  1707. filter_cflags=suncc_flags
  1708. suncc_flags(){
  1709. for flag; do
  1710. case $flag in
  1711. -march=*|-mcpu=*)
  1712. case "${flag#*=}" in
  1713. native) echo -xtarget=native ;;
  1714. v9|niagara) echo -xarch=sparc ;;
  1715. ultrasparc) echo -xarch=sparcvis ;;
  1716. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  1717. i586|pentium) echo -xchip=pentium ;;
  1718. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1719. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1720. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1721. pentium4*) echo -xtarget=pentium4 ;;
  1722. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1723. *-sse3) echo -xarch=sse3 ;;
  1724. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1725. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1726. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1727. k8|opteron|athlon64|athlon-fx)
  1728. echo -xarch=sse2a ;;
  1729. athlon*) echo -xarch=pentium_proa ;;
  1730. esac
  1731. ;;
  1732. -std=c99) echo -xc99 ;;
  1733. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1734. -fPIC) echo -KPIC -xcode=pic32 ;;
  1735. -W*,*) echo $flag ;;
  1736. -f*-*|-W*) ;;
  1737. *) echo $flag ;;
  1738. esac
  1739. done
  1740. }
  1741. fi
  1742. test -n "$cc_type" && enable $cc_type ||
  1743. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  1744. : ${as_default:=$cc}
  1745. : ${dep_cc_default:=$cc}
  1746. : ${ld_default:=$cc}
  1747. set_default ar as dep_cc ld
  1748. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  1749. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  1750. add_cflags $extra_cflags
  1751. add_asflags $extra_cflags
  1752. if test -n "$sysroot"; then
  1753. case "$cc_type" in
  1754. gcc)
  1755. add_cppflags --sysroot="$sysroot"
  1756. add_ldflags --sysroot="$sysroot"
  1757. ;;
  1758. tms470)
  1759. add_cppflags -I"$sysinclude"
  1760. add_ldflags --sysroot="$sysroot"
  1761. ;;
  1762. clang)
  1763. add_cppflags -isysroot "$sysroot"
  1764. add_ldflags -isysroot "$sysroot"
  1765. ;;
  1766. esac
  1767. fi
  1768. if test "$cpu" = host; then
  1769. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  1770. case "$cc_type" in
  1771. gcc)
  1772. check_native(){
  1773. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  1774. sed -n "/$1=/{
  1775. s/.*$1=\\([^ ]*\\).*/\\1/
  1776. p
  1777. q
  1778. }" $TMPE
  1779. }
  1780. cpu=$(check_native -march || check_native -mcpu)
  1781. ;;
  1782. esac
  1783. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  1784. fi
  1785. # Deal with common $arch aliases
  1786. case "$arch" in
  1787. arm*)
  1788. arch="arm"
  1789. ;;
  1790. mips|mipsel|IP*)
  1791. arch="mips"
  1792. ;;
  1793. mips64*)
  1794. arch="mips"
  1795. subarch="mips64"
  1796. ;;
  1797. parisc|hppa)
  1798. arch="parisc"
  1799. ;;
  1800. parisc64|hppa64)
  1801. arch="parisc"
  1802. subarch="parisc64"
  1803. ;;
  1804. "Power Macintosh"|ppc|powerpc)
  1805. arch="ppc"
  1806. ;;
  1807. ppc64|powerpc64)
  1808. arch="ppc"
  1809. subarch="ppc64"
  1810. ;;
  1811. s390|s390x)
  1812. arch="s390"
  1813. ;;
  1814. sh4|sh)
  1815. arch="sh4"
  1816. ;;
  1817. sun4u|sparc64)
  1818. arch="sparc"
  1819. subarch="sparc64"
  1820. ;;
  1821. i[3-6]86|i86pc|BePC|x86_64|amd64)
  1822. arch="x86"
  1823. ;;
  1824. esac
  1825. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  1826. enable $arch
  1827. # Add processor-specific flags
  1828. if test "$cpu" = generic; then
  1829. : do nothing
  1830. elif enabled ppc; then
  1831. case $(tolower $cpu) in
  1832. 601|ppc601|powerpc601)
  1833. cpuflags="-mcpu=601"
  1834. disable altivec
  1835. ;;
  1836. 603*|ppc603*|powerpc603*)
  1837. cpuflags="-mcpu=603"
  1838. disable altivec
  1839. ;;
  1840. 604*|ppc604*|powerpc604*)
  1841. cpuflags="-mcpu=604"
  1842. disable altivec
  1843. ;;
  1844. g3|75*|ppc75*|powerpc75*)
  1845. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  1846. disable altivec
  1847. ;;
  1848. g4|745*|ppc745*|powerpc745*)
  1849. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  1850. ;;
  1851. 74*|ppc74*|powerpc74*)
  1852. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  1853. ;;
  1854. g5|970|ppc970|powerpc970|power4*)
  1855. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1856. ;;
  1857. cell)
  1858. cpuflags="-mcpu=cell"
  1859. enable ldbrx
  1860. ;;
  1861. e500v2)
  1862. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  1863. disable altivec
  1864. ;;
  1865. e500)
  1866. cpuflags="-mcpu=8540 -mhard-float"
  1867. disable altivec
  1868. ;;
  1869. esac
  1870. elif enabled x86; then
  1871. case $cpu in
  1872. i[345]86|pentium)
  1873. cpuflags="-march=$cpu"
  1874. disable mmx
  1875. ;;
  1876. # targets that do NOT support conditional mov (cmov)
  1877. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  1878. cpuflags="-march=$cpu"
  1879. disable cmov
  1880. ;;
  1881. # targets that do support conditional mov (cmov)
  1882. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10|barcelona)
  1883. cpuflags="-march=$cpu"
  1884. enable cmov
  1885. enable fast_cmov
  1886. ;;
  1887. # targets that do support conditional mov but on which it's slow
  1888. pentium4|pentium4m|prescott|nocona)
  1889. cpuflags="-march=$cpu"
  1890. enable cmov
  1891. disable fast_cmov
  1892. ;;
  1893. esac
  1894. elif enabled sparc; then
  1895. case $cpu in
  1896. niagara)
  1897. cpuflags="-mcpu=$cpu"
  1898. disable vis
  1899. ;;
  1900. sparc64)
  1901. cpuflags="-mcpu=v9"
  1902. ;;
  1903. esac
  1904. elif enabled arm; then
  1905. case $cpu in
  1906. armv*)
  1907. cpuflags="-march=$cpu"
  1908. ;;
  1909. *)
  1910. cpuflags="-mcpu=$cpu"
  1911. ;;
  1912. esac
  1913. elif enabled alpha; then
  1914. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  1915. elif enabled bfin; then
  1916. cpuflags="-mcpu=$cpu"
  1917. elif enabled mips; then
  1918. cpuflags="-march=$cpu"
  1919. elif enabled avr32; then
  1920. case $cpu in
  1921. ap7[02]0[0-2])
  1922. subarch="avr32_ap"
  1923. cpuflags="-mpart=$cpu"
  1924. ;;
  1925. ap)
  1926. subarch="avr32_ap"
  1927. cpuflags="-march=$cpu"
  1928. ;;
  1929. uc3[ab]*)
  1930. subarch="avr32_uc"
  1931. cpuflags="-mcpu=$cpu"
  1932. ;;
  1933. uc)
  1934. subarch="avr32_uc"
  1935. cpuflags="-march=$cpu"
  1936. ;;
  1937. esac
  1938. fi
  1939. add_cflags $cpuflags
  1940. add_asflags $cpuflags
  1941. # compiler sanity check
  1942. check_exec <<EOF
  1943. int main(void){ return 0; }
  1944. EOF
  1945. if test "$?" != 0; then
  1946. echo "$cc is unable to create an executable file."
  1947. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  1948. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  1949. echo "Only do this if you know what cross compiling means."
  1950. fi
  1951. die "C compiler test failed."
  1952. fi
  1953. add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  1954. check_cflags -std=c99
  1955. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  1956. #include <stdlib.h>
  1957. EOF
  1958. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  1959. #include <stdlib.h>
  1960. EOF
  1961. check_host_cflags -std=c99
  1962. case "$arch" in
  1963. alpha|ia64|mips|parisc|sparc)
  1964. spic=$shared
  1965. ;;
  1966. x86)
  1967. subarch="x86_32"
  1968. check_cc <<EOF && subarch="x86_64"
  1969. int test[(int)sizeof(char*) - 7];
  1970. EOF
  1971. if test "$subarch" = "x86_64"; then
  1972. spic=$shared
  1973. fi
  1974. ;;
  1975. esac
  1976. enable $subarch
  1977. enabled spic && enable pic
  1978. # OS specific
  1979. case $target_os in
  1980. haiku)
  1981. prefix_default="/boot/common"
  1982. network_extralibs="-lnetwork"
  1983. ;;
  1984. sunos)
  1985. FFSERVERLDFLAGS=""
  1986. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1987. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  1988. network_extralibs="-lsocket -lnsl"
  1989. add_cppflags -D__EXTENSIONS__
  1990. nm_opts='-P -g'
  1991. ;;
  1992. netbsd)
  1993. oss_indev_extralibs="-lossaudio"
  1994. oss_outdev_extralibs="-lossaudio"
  1995. add_cppflags -D_XOPEN_SOURCE=600
  1996. ;;
  1997. openbsd)
  1998. enable malloc_aligned
  1999. # On OpenBSD 4.5. the compiler does not use PIC unless
  2000. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  2001. # however the generated executable will not do anything
  2002. # (simply quits with exit-code 1, no crash, no output).
  2003. # Thus explicitly enable PIC here.
  2004. enable pic
  2005. SHFLAGS='-shared'
  2006. oss_indev_extralibs="-lossaudio"
  2007. oss_outdev_extralibs="-lossaudio"
  2008. ;;
  2009. freebsd|dragonfly)
  2010. enable malloc_aligned
  2011. ;;
  2012. bsd/os)
  2013. add_extralibs -lpoll -lgnugetopt
  2014. strip="strip -d"
  2015. ;;
  2016. darwin)
  2017. enable malloc_aligned
  2018. gas="gas-preprocessor.pl $cc"
  2019. enabled ppc && add_asflags -force_cpusubtype_ALL
  2020. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  2021. strip="${strip} -x"
  2022. add_ldflags -Wl,-dynamic,-search_paths_first
  2023. SLIBSUF=".dylib"
  2024. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2025. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2026. FFSERVERLDFLAGS=-Wl,-bind_at_load
  2027. objformat="macho"
  2028. enabled x86_64 && objformat="macho64"
  2029. enabled_any pic shared ||
  2030. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2031. ;;
  2032. mingw32*)
  2033. if test $target_os = "mingw32ce"; then
  2034. disable network
  2035. else
  2036. target_os=mingw32
  2037. fi
  2038. LIBTARGET=i386
  2039. if enabled x86_64; then
  2040. enable malloc_aligned
  2041. LIBTARGET=x64
  2042. elif enabled arm; then
  2043. LIBTARGET=arm
  2044. fi
  2045. shlibdir_default="$bindir_default"
  2046. disable ffserver
  2047. SLIBPREF=""
  2048. SLIBSUF=".dll"
  2049. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2050. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2051. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  2052. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  2053. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
  2054. install -d "$(LIBDIR)"; \
  2055. install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
  2056. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  2057. 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'
  2058. objformat="win32"
  2059. enable dos_paths
  2060. check_cflags -fno-common
  2061. check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
  2062. || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2063. die "ERROR: MinGW runtime version must be >= 3.15."
  2064. ;;
  2065. cygwin*)
  2066. target_os=cygwin
  2067. shlibdir_default="$bindir_default"
  2068. SLIBPREF="cyg"
  2069. SLIBSUF=".dll"
  2070. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2071. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2072. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2073. objformat="win32"
  2074. enable dos_paths
  2075. check_cflags -fno-common
  2076. ;;
  2077. *-dos|freedos|opendos)
  2078. disable ffplay ffserver
  2079. disable $INDEV_LIST $OUTDEV_LIST
  2080. network_extralibs="-lsocket"
  2081. objformat="coff"
  2082. enable dos_paths
  2083. ;;
  2084. linux)
  2085. enable dv1394
  2086. ;;
  2087. irix*)
  2088. target_os=irix
  2089. ranlib="echo ignoring ranlib"
  2090. ;;
  2091. os/2*)
  2092. strip="lxlite"
  2093. ln_s="cp -f"
  2094. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2095. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2096. FFSERVERLDFLAGS=""
  2097. LIBSUF="_s.a"
  2098. SLIBPREF=""
  2099. SLIBSUF=".dll"
  2100. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2101. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2102. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2103. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2104. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2105. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2106. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2107. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2108. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2109. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2110. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  2111. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  2112. enable dos_paths
  2113. ;;
  2114. gnu/kfreebsd)
  2115. ;;
  2116. gnu)
  2117. ;;
  2118. none)
  2119. ;;
  2120. *)
  2121. die "Unknown OS '$target_os'."
  2122. ;;
  2123. esac
  2124. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2125. set_default $PATHS_LIST
  2126. # we need to build at least one lib type
  2127. if ! enabled_any static shared; then
  2128. cat <<EOF
  2129. At least one library type must be built.
  2130. Specify --enable-static to build the static libraries or --enable-shared to
  2131. build the shared libraries as well. To only build the shared libraries specify
  2132. --disable-static in addition to --enable-shared.
  2133. EOF
  2134. exit 1;
  2135. fi
  2136. disabled static && LIBNAME=""
  2137. die_license_disabled() {
  2138. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2139. }
  2140. die_license_disabled gpl libx264
  2141. die_license_disabled gpl libxvid
  2142. die_license_disabled gpl postproc
  2143. die_license_disabled gpl x11grab
  2144. die_license_disabled nonfree libfaac
  2145. die_license_disabled version3 libopencore_amrnb
  2146. die_license_disabled version3 libopencore_amrwb
  2147. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2148. check_deps $ARCH_EXT_LIST
  2149. disabled optimizations || check_cflags -fomit-frame-pointer
  2150. enable_pic() {
  2151. enable pic
  2152. add_cppflags -DPIC
  2153. add_cflags -fPIC
  2154. add_asflags -fPIC
  2155. }
  2156. enabled pic && enable_pic
  2157. check_cc <<EOF || die "Symbol mangling check failed."
  2158. int ff_extern;
  2159. EOF
  2160. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2161. extern_prefix=${sym%%ff_extern*}
  2162. check_cc <<EOF && enable inline_asm
  2163. void foo(void) { __asm__ volatile ("" ::); }
  2164. EOF
  2165. _restrict=
  2166. for restrict_keyword in restrict __restrict__ __restrict; do
  2167. check_cc <<EOF && _restrict=$restrict_keyword && break
  2168. void foo(char * $restrict_keyword p);
  2169. EOF
  2170. done
  2171. check_cc <<EOF && enable attribute_packed
  2172. struct { int x; } __attribute__((packed)) x;
  2173. EOF
  2174. check_cc <<EOF && enable attribute_may_alias
  2175. union { int x; } __attribute__((may_alias)) x;
  2176. EOF
  2177. check_cc <<EOF || die "endian test failed"
  2178. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2179. EOF
  2180. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2181. if enabled alpha; then
  2182. check_cflags -mieee
  2183. elif enabled arm; then
  2184. check_cflags -marm
  2185. nogas=die
  2186. check_ld <<EOF && enable vfp_args
  2187. __asm__ (".eabi_attribute 28, 1");
  2188. int main(void) { return 0; }
  2189. EOF
  2190. # We have to check if pld is a nop and disable it.
  2191. check_asm pld '"pld [r0]"'
  2192. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2193. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2194. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2195. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2196. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2197. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2198. enabled_all armv6t2 shared !pic && enable_pic
  2199. elif enabled mips; then
  2200. check_asm loongson '"dmult.g $1, $2, $3"'
  2201. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2202. elif enabled ppc; then
  2203. enable local_aligned_8 local_aligned_16
  2204. check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2205. check_asm ibm_asm '"add 0, 0, 0"'
  2206. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2207. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2208. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2209. if enabled altivec; then
  2210. nogas=warn
  2211. check_cflags -maltivec -mabi=altivec &&
  2212. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2213. check_cflags -faltivec
  2214. # check if our compiler supports Motorola AltiVec C API
  2215. check_cc <<EOF || disable altivec
  2216. $inc_altivec_h
  2217. int main(void) {
  2218. vector signed int v1, v2, v3;
  2219. v1 = vec_add(v2,v3);
  2220. return 0;
  2221. }
  2222. EOF
  2223. # check if our compiler supports braces for vector declarations
  2224. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2225. $inc_altivec_h
  2226. int main (void) { (vector int) {1}; return 0; }
  2227. EOF
  2228. fi
  2229. elif enabled sparc; then
  2230. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2231. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2232. elif enabled x86; then
  2233. enable local_aligned_8 local_aligned_16
  2234. # check whether EBP is available on x86
  2235. # As 'i' is stored on the stack, this program will crash
  2236. # if the base pointer is used to access it because the
  2237. # base pointer is cleared in the inline assembly code.
  2238. check_exec_crash <<EOF && enable ebp_available
  2239. volatile int i=0;
  2240. __asm__ volatile (
  2241. "xorl %%ebp, %%ebp"
  2242. ::: "%ebp");
  2243. return i;
  2244. EOF
  2245. # check whether EBX is available on x86
  2246. check_asm ebx_available '""::"b"(0)' &&
  2247. check_asm ebx_available '"":::"%ebx"'
  2248. # check whether more than 10 operands are supported
  2249. check_cc <<EOF && enable ten_operands
  2250. int main(void) {
  2251. int x=0;
  2252. __asm__ volatile(
  2253. ""
  2254. :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
  2255. );
  2256. return 0;
  2257. }
  2258. EOF
  2259. # check whether binutils is new enough to compile SSSE3/MMX2
  2260. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2261. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2262. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2263. YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
  2264. enabled x86_64 && append YASMFLAGS "-m amd64"
  2265. enabled pic && append YASMFLAGS "-DPIC"
  2266. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2267. case "$objformat" in
  2268. elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
  2269. esac
  2270. if ! disabled yasm; then
  2271. check_yasm "pabsw xmm0, xmm0" && enable yasm ||
  2272. warn "yasm not found, performance will suffer"
  2273. fi
  2274. case "$cpu" in
  2275. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2276. disable fast_clz
  2277. ;;
  2278. esac
  2279. fi
  2280. if enabled asm; then
  2281. as=${gas:=$as}
  2282. check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
  2283. $nogas "GNU assembler not found, install gas-preprocessor"
  2284. fi
  2285. if check_func dlopen; then
  2286. ldl=
  2287. elif check_func dlopen -ldl; then
  2288. ldl=-ldl
  2289. fi
  2290. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2291. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2292. check_func fcntl
  2293. check_func fork
  2294. check_func getaddrinfo $network_extralibs
  2295. check_func gethrtime
  2296. check_func getrusage
  2297. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2298. check_func inet_aton $network_extralibs
  2299. check_func isatty
  2300. check_func ${malloc_prefix}memalign && enable memalign
  2301. check_func mkstemp
  2302. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2303. check_func setrlimit
  2304. check_func strerror_r
  2305. check_func_headers io.h setmode
  2306. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2307. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2308. check_func_headers windows.h GetProcessTimes
  2309. check_func_headers windows.h VirtualAlloc
  2310. check_header conio.h
  2311. check_header dlfcn.h
  2312. check_header dxva2api.h
  2313. check_header malloc.h
  2314. check_header poll.h
  2315. check_header sys/mman.h
  2316. check_header sys/resource.h
  2317. check_header sys/select.h
  2318. check_header termios.h
  2319. check_header vdpau/vdpau.h
  2320. check_header vdpau/vdpau_x11.h
  2321. check_header X11/extensions/XvMClib.h
  2322. check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
  2323. if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
  2324. enabled_any $need_memalign ; then
  2325. die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  2326. fi
  2327. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2328. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2329. # check for some common methods of building with pthread support
  2330. # do this before the optional library checks as some of them require pthreads
  2331. if ! disabled pthreads && ! enabled w32threads; then
  2332. enable pthreads
  2333. if check_func pthread_create; then
  2334. :
  2335. elif check_func pthread_create -pthread; then
  2336. add_cflags -pthread
  2337. add_extralibs -pthread
  2338. elif check_func pthread_create -pthreads; then
  2339. add_cflags -pthreads
  2340. add_extralibs -pthreads
  2341. elif check_func pthread_create -lpthreadGC2; then
  2342. add_extralibs -lpthreadGC2
  2343. elif ! check_lib pthread.h pthread_create -lpthread; then
  2344. disable pthreads
  2345. fi
  2346. fi
  2347. for thread in $THREADS_LIST; do
  2348. if enabled $thread; then
  2349. test -n "$thread_type" &&
  2350. die "ERROR: Only one thread type must be selected." ||
  2351. thread_type="$thread"
  2352. fi
  2353. done
  2354. check_lib math.h sin -lm
  2355. disabled vaapi || check_lib va/va.h vaInitialize -lva
  2356. check_mathfunc exp2
  2357. check_mathfunc exp2f
  2358. check_mathfunc llrint
  2359. check_mathfunc llrintf
  2360. check_mathfunc log2
  2361. check_mathfunc log2f
  2362. check_mathfunc lrint
  2363. check_mathfunc lrintf
  2364. check_mathfunc round
  2365. check_mathfunc roundf
  2366. check_mathfunc truncf
  2367. # these are off by default, so fail if requested and not available
  2368. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2369. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  2370. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
  2371. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
  2372. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2373. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2374. enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame
  2375. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2376. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  2377. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  2378. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2379. enabled librtmp && { check_lib librtmp/rtmp.h RTMP_Socket $(pkg-config --libs librtmp) ||
  2380. die "ERROR: librtmp not found or RTMP_Socket() missing, librtmp version must be >= 2.2.f"; }
  2381. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  2382. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  2383. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2384. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2385. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2386. enabled libvpx && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx &&
  2387. check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
  2388. die "ERROR: libvpx version must be >=0.9.1"; }
  2389. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  2390. { check_cpp_condition x264.h "X264_BUILD >= 98" ||
  2391. die "ERROR: libx264 version must be >= 0.98."; }
  2392. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2393. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2394. # libdc1394 check
  2395. if enabled libdc1394; then
  2396. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2397. enable libdc1394_2; } ||
  2398. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2399. enable libdc1394_1; } ||
  2400. die "ERROR: No version of libdc1394 found "
  2401. fi
  2402. SDL_CONFIG="${cross_prefix}sdl-config"
  2403. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2404. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2405. sdl_libs=$("${SDL_CONFIG}" --libs)
  2406. check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
  2407. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2408. enable sdl &&
  2409. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2410. fi
  2411. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2412. if enabled network; then
  2413. check_type "sys/types.h sys/socket.h" socklen_t
  2414. check_type netdb.h "struct addrinfo"
  2415. check_type netinet/in.h "struct ipv6_mreq"
  2416. check_type netinet/in.h "struct sockaddr_in6"
  2417. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2418. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2419. # Prefer arpa/inet.h over winsock2
  2420. if check_header arpa/inet.h ; then
  2421. check_func closesocket
  2422. elif check_header winsock2.h ; then
  2423. check_func_headers winsock2.h closesocket -lws2 && \
  2424. network_extralibs="-lws2" || \
  2425. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2426. network_extralibs="-lws2_32"; }
  2427. check_type ws2tcpip.h socklen_t
  2428. check_type ws2tcpip.h "struct addrinfo"
  2429. check_type ws2tcpip.h "struct ipv6_mreq"
  2430. check_type ws2tcpip.h "struct sockaddr_in6"
  2431. check_type ws2tcpip.h "struct sockaddr_storage"
  2432. check_struct winsock2.h "struct sockaddr" sa_len
  2433. else
  2434. disable network
  2435. fi
  2436. fi
  2437. check_header linux/videodev.h
  2438. check_header linux/videodev2.h
  2439. check_header sys/videoio.h
  2440. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2441. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  2442. # w32api 3.12 had it defined wrong
  2443. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  2444. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2445. { check_header dev/bktr/ioctl_meteor.h &&
  2446. check_header dev/bktr/ioctl_bt848.h; } ||
  2447. { check_header machine/ioctl_meteor.h &&
  2448. check_header machine/ioctl_bt848.h; } ||
  2449. { check_header dev/video/meteor/ioctl_meteor.h &&
  2450. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2451. check_header dev/ic/bt8xx.h
  2452. check_header sys/soundcard.h
  2453. check_header soundcard.h
  2454. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2455. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
  2456. enabled x11grab &&
  2457. check_header X11/Xlib.h &&
  2458. check_header X11/extensions/XShm.h &&
  2459. check_header X11/extensions/Xfixes.h &&
  2460. check_func XOpenDisplay -lX11 &&
  2461. check_func XShmCreateImage -lX11 -lXext &&
  2462. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2463. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2464. check_cpp_condition \
  2465. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2466. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2467. disable vdpau; }
  2468. fi
  2469. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2470. # add some useful compiler flags if supported
  2471. check_cflags -Wdeclaration-after-statement
  2472. check_cflags -Wall
  2473. check_cflags -Wno-switch
  2474. check_cflags -Wdisabled-optimization
  2475. check_cflags -Wpointer-arith
  2476. check_cflags -Wredundant-decls
  2477. check_cflags -Wno-pointer-sign
  2478. check_cflags -Wcast-qual
  2479. check_cflags -Wwrite-strings
  2480. check_cflags -Wtype-limits
  2481. check_cflags -Wundef
  2482. check_cflags -Wmissing-prototypes
  2483. enabled extra_warnings && check_cflags -Winline
  2484. # add some linker flags
  2485. check_ldflags -Wl,--warn-common
  2486. check_ldflags -Wl,--as-needed
  2487. 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'
  2488. check_ldflags -Wl,-Bsymbolic
  2489. echo "X{};" > $TMPV
  2490. if test_ldflags -Wl,--version-script,$TMPV; then
  2491. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2492. check_cc <<EOF && enable symver_asm_label
  2493. void ff_foo(void) __asm__ ("av_foo@VERSION");
  2494. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  2495. EOF
  2496. check_cc <<EOF && enable symver_gnu_asm
  2497. __asm__(".symver ff_foo,av_foo@VERSION");
  2498. void ff_foo(void) {}
  2499. EOF
  2500. fi
  2501. if enabled small; then
  2502. add_cflags $size_cflags
  2503. optimizations="small"
  2504. elif enabled optimizations; then
  2505. add_cflags $speed_cflags
  2506. else
  2507. add_cflags $noopt_cflags
  2508. fi
  2509. check_cflags -fno-math-errno
  2510. check_cflags -fno-signed-zeros
  2511. if enabled icc; then
  2512. # Just warnings, no remarks
  2513. check_cflags -w1
  2514. # -wd: Disable following warnings
  2515. # 144, 167, 556: -Wno-pointer-sign
  2516. # 10006: ignoring unknown option -fno-signed-zeros
  2517. # 10156: ignoring option '-W'; no argument required
  2518. check_cflags -wd144,167,556,10006,10156
  2519. # 11030: Warning unknown option --as-needed
  2520. # 10156: ignoring option '-export'; no argument required
  2521. check_ldflags -wd10156,11030
  2522. # Allow to compile with optimizations
  2523. check_ldflags -march=$cpu
  2524. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2525. enable ebp_available
  2526. elif enabled ccc; then
  2527. # disable some annoying warnings
  2528. add_cflags -msg_disable cvtu32to64
  2529. add_cflags -msg_disable embedcomment
  2530. add_cflags -msg_disable needconstext
  2531. add_cflags -msg_disable nomainieee
  2532. add_cflags -msg_disable ptrmismatch1
  2533. add_cflags -msg_disable unreachcode
  2534. elif enabled gcc; then
  2535. check_cflags -fno-tree-vectorize
  2536. check_cflags -Werror=implicit-function-declaration
  2537. check_cflags -Werror=missing-prototypes
  2538. elif enabled clang; then
  2539. check_cflags -Qunused-arguments
  2540. elif enabled armcc; then
  2541. # 2523: use of inline assembler is deprecated
  2542. add_cflags -Wrvct,--diag_suppress=2523
  2543. add_cflags -Wrvct,--diag_suppress=1207
  2544. elif enabled tms470; then
  2545. add_cflags -pds=824 -pds=837
  2546. fi
  2547. enabled_any $THREADS_LIST && enable threads
  2548. check_deps $CONFIG_LIST \
  2549. $CONFIG_EXTRA \
  2550. $HAVE_LIST \
  2551. $DECODER_LIST \
  2552. $ENCODER_LIST \
  2553. $HWACCEL_LIST \
  2554. $PARSER_LIST \
  2555. $BSF_LIST \
  2556. $DEMUXER_LIST \
  2557. $MUXER_LIST \
  2558. $FILTER_LIST \
  2559. $INDEV_LIST \
  2560. $OUTDEV_LIST \
  2561. $PROTOCOL_LIST \
  2562. $ACODEC_TESTS \
  2563. $VCODEC_TESTS \
  2564. $LAVF_TESTS \
  2565. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  2566. echo "install prefix $prefix"
  2567. echo "source path $source_path"
  2568. echo "C compiler $cc"
  2569. echo "ARCH $arch ($cpu)"
  2570. if test "$build_suffix" != ""; then
  2571. echo "build suffix $build_suffix"
  2572. fi
  2573. if test "$extra_version" != ""; then
  2574. echo "version string suffix $extra_version"
  2575. fi
  2576. echo "big-endian ${bigendian-no}"
  2577. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2578. if enabled x86; then
  2579. echo "yasm ${yasm-no}"
  2580. echo "MMX enabled ${mmx-no}"
  2581. echo "MMX2 enabled ${mmx2-no}"
  2582. echo "3DNow! enabled ${amd3dnow-no}"
  2583. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2584. echo "SSE enabled ${sse-no}"
  2585. echo "SSSE3 enabled ${ssse3-no}"
  2586. echo "CMOV enabled ${cmov-no}"
  2587. echo "CMOV is fast ${fast_cmov-no}"
  2588. echo "EBX available ${ebx_available-no}"
  2589. echo "EBP available ${ebp_available-no}"
  2590. echo "10 operands supported ${ten_operands-no}"
  2591. fi
  2592. if enabled arm; then
  2593. echo "ARMv5TE enabled ${armv5te-no}"
  2594. echo "ARMv6 enabled ${armv6-no}"
  2595. echo "ARMv6T2 enabled ${armv6t2-no}"
  2596. echo "ARM VFP enabled ${armvfp-no}"
  2597. echo "IWMMXT enabled ${iwmmxt-no}"
  2598. echo "NEON enabled ${neon-no}"
  2599. fi
  2600. if enabled mips; then
  2601. echo "MMI enabled ${mmi-no}"
  2602. fi
  2603. if enabled ppc; then
  2604. echo "AltiVec enabled ${altivec-no}"
  2605. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2606. echo "dcbzl available ${dcbzl-no}"
  2607. fi
  2608. if enabled sparc; then
  2609. echo "VIS enabled ${vis-no}"
  2610. fi
  2611. echo "debug symbols ${debug-no}"
  2612. echo "strip symbols ${stripping-no}"
  2613. echo "optimizations ${optimizations-no}"
  2614. echo "static ${static-no}"
  2615. echo "shared ${shared-no}"
  2616. echo "postprocessing support ${postproc-no}"
  2617. echo "new filter support ${avfilter-no}"
  2618. echo "filters using lavformat ${avfilter_lavf-no}"
  2619. echo "network support ${network-no}"
  2620. echo "threading support ${thread_type-no}"
  2621. echo "SDL support ${sdl-no}"
  2622. echo "Sun medialib support ${mlib-no}"
  2623. echo "AVISynth enabled ${avisynth-no}"
  2624. echo "libdc1394 support ${libdc1394-no}"
  2625. echo "libdirac enabled ${libdirac-no}"
  2626. echo "libfaac enabled ${libfaac-no}"
  2627. echo "libgsm enabled ${libgsm-no}"
  2628. echo "libmp3lame enabled ${libmp3lame-no}"
  2629. echo "libnut enabled ${libnut-no}"
  2630. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  2631. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  2632. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2633. echo "librtmp enabled ${librtmp-no}"
  2634. echo "libschroedinger enabled ${libschroedinger-no}"
  2635. echo "libspeex enabled ${libspeex-no}"
  2636. echo "libtheora enabled ${libtheora-no}"
  2637. echo "libvorbis enabled ${libvorbis-no}"
  2638. echo "libvpx enabled ${libvpx-no}"
  2639. echo "libx264 enabled ${libx264-no}"
  2640. echo "libxvid enabled ${libxvid-no}"
  2641. echo "zlib enabled ${zlib-no}"
  2642. echo "bzlib enabled ${bzlib-no}"
  2643. echo
  2644. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  2645. echo "Enabled ${type}s:"
  2646. eval list=\$$(toupper $type)_LIST
  2647. print_enabled '_*' $list | sort | pr -3 -t
  2648. echo
  2649. done
  2650. license="LGPL version 2.1 or later"
  2651. if enabled nonfree; then
  2652. license="nonfree and unredistributable"
  2653. elif enabled gplv3; then
  2654. license="GPL version 3 or later"
  2655. elif enabled lgplv3; then
  2656. license="LGPL version 3 or later"
  2657. elif enabled gpl; then
  2658. license="GPL version 2 or later"
  2659. fi
  2660. echo "License: $license"
  2661. echo "Creating config.mak and config.h..."
  2662. # build tree in object directory if source path is different from current one
  2663. if enabled source_path_used; then
  2664. DIRS="
  2665. doc
  2666. libavcodec
  2667. libavcodec/$arch
  2668. libavdevice
  2669. libavfilter
  2670. libavformat
  2671. libavutil
  2672. libavutil/$arch
  2673. libpostproc
  2674. libswscale
  2675. libswscale/$arch
  2676. tests
  2677. tools
  2678. "
  2679. FILES="
  2680. Makefile
  2681. common.mak
  2682. subdir.mak
  2683. doc/texi2pod.pl
  2684. libavcodec/Makefile
  2685. libavcodec/${arch}/Makefile
  2686. libavdevice/Makefile
  2687. libavfilter/Makefile
  2688. libavformat/Makefile
  2689. libavutil/Makefile
  2690. libpostproc/Makefile
  2691. libswscale/Makefile
  2692. "
  2693. map 'mkdir -p $v' $DIRS;
  2694. map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES
  2695. fi
  2696. enabled stripping || strip="echo skipping strip"
  2697. cat > config.mak <<EOF
  2698. # Automatically generated by configure - do not modify!
  2699. ifndef FFMPEG_CONFIG_MAK
  2700. FFMPEG_CONFIG_MAK=1
  2701. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  2702. prefix=$prefix
  2703. LIBDIR=\$(DESTDIR)$libdir
  2704. SHLIBDIR=\$(DESTDIR)$shlibdir
  2705. INCDIR=\$(DESTDIR)$incdir
  2706. BINDIR=\$(DESTDIR)$bindir
  2707. DATADIR=\$(DESTDIR)$datadir
  2708. MANDIR=\$(DESTDIR)$mandir
  2709. SRC_PATH="$source_path"
  2710. SRC_PATH_BARE=$source_path
  2711. BUILD_ROOT="$PWD"
  2712. ARCH=$arch
  2713. CC=$cc
  2714. AS=$as
  2715. LD=$ld
  2716. DEPCC=$dep_cc
  2717. YASM=$yasmexe
  2718. YASMDEP=$yasmexe
  2719. AR=$ar
  2720. RANLIB=$ranlib
  2721. CP=cp -p
  2722. LN_S=$ln_s
  2723. STRIP=$strip
  2724. CPPFLAGS=$CPPFLAGS
  2725. CFLAGS=$CFLAGS
  2726. ASFLAGS=$ASFLAGS
  2727. CC_O=$CC_O
  2728. LDFLAGS=$LDFLAGS
  2729. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  2730. SHFLAGS=$SHFLAGS
  2731. YASMFLAGS=$YASMFLAGS
  2732. BUILDSUF=$build_suffix
  2733. FULLNAME=$FULLNAME
  2734. LIBPREF=$LIBPREF
  2735. LIBSUF=$LIBSUF
  2736. LIBNAME=$LIBNAME
  2737. SLIBPREF=$SLIBPREF
  2738. SLIBSUF=$SLIBSUF
  2739. EXESUF=$EXESUF
  2740. EXTRA_VERSION=$extra_version
  2741. DEPFLAGS=$DEPFLAGS
  2742. CCDEP=$CCDEP
  2743. ASDEP=$ASDEP
  2744. CC_DEPFLAGS=$CC_DEPFLAGS
  2745. AS_DEPFLAGS=$AS_DEPFLAGS
  2746. HOSTCC=$host_cc
  2747. HOSTCFLAGS=$host_cflags
  2748. HOSTEXESUF=$HOSTEXESUF
  2749. HOSTLDFLAGS=$host_ldflags
  2750. HOSTLIBS=$host_libs
  2751. TARGET_EXEC=$target_exec
  2752. TARGET_PATH=$target_path
  2753. SDL_LIBS=$sdl_libs
  2754. SDL_CFLAGS=$sdl_cflags
  2755. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  2756. EXTRALIBS=$extralibs
  2757. INSTALL=install
  2758. LIBTARGET=${LIBTARGET}
  2759. SLIBNAME=${SLIBNAME}
  2760. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  2761. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  2762. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  2763. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  2764. SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
  2765. SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
  2766. SAMPLES=$samples
  2767. EOF
  2768. get_version(){
  2769. name=$1
  2770. file=$source_path/$2
  2771. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2772. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2773. lcname=$(tolower $name)
  2774. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2775. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2776. }
  2777. get_version LIBSWSCALE libswscale/swscale.h
  2778. get_version LIBPOSTPROC libpostproc/postprocess.h
  2779. get_version LIBAVCODEC libavcodec/avcodec.h
  2780. get_version LIBAVDEVICE libavdevice/avdevice.h
  2781. get_version LIBAVFORMAT libavformat/avformat.h
  2782. get_version LIBAVUTIL libavutil/avutil.h
  2783. get_version LIBAVFILTER libavfilter/avfilter.h
  2784. cat > $TMPH <<EOF
  2785. /* Automatically generated by configure - do not modify! */
  2786. #ifndef FFMPEG_CONFIG_H
  2787. #define FFMPEG_CONFIG_H
  2788. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  2789. #define FFMPEG_LICENSE "$(c_escape $license)"
  2790. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  2791. #define CC_TYPE "$cc_type"
  2792. #define CC_VERSION $cc_version
  2793. #define restrict $_restrict
  2794. #define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\\n\\t"
  2795. #define EXTERN_PREFIX "${extern_prefix}"
  2796. #define EXTERN_ASM ${extern_prefix}
  2797. EOF
  2798. test -n "$malloc_prefix" &&
  2799. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  2800. if enabled small || disabled optimizations; then
  2801. echo "#undef av_always_inline" >> $TMPH
  2802. echo "#define av_always_inline" >> $TMPH
  2803. fi
  2804. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  2805. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  2806. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  2807. $CONFIG_EXTRA \
  2808. $DECODER_LIST \
  2809. $ENCODER_LIST \
  2810. $HWACCEL_LIST \
  2811. $PARSER_LIST \
  2812. $BSF_LIST \
  2813. $DEMUXER_LIST \
  2814. $MUXER_LIST \
  2815. $FILTER_LIST \
  2816. $PROTOCOL_LIST \
  2817. $INDEV_LIST \
  2818. $OUTDEV_LIST \
  2819. cat >>config.mak <<EOF
  2820. ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
  2821. VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS)
  2822. LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
  2823. EOF
  2824. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2825. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  2826. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2827. cp_if_changed $TMPH config.h
  2828. cat > $TMPH <<EOF
  2829. /* Generated by ffconf */
  2830. #ifndef AVUTIL_AVCONFIG_H
  2831. #define AVUTIL_AVCONFIG_H
  2832. EOF
  2833. print_config AV_HAVE_ $TMPH /dev/null $HAVE_LIST_PUB
  2834. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  2835. cp_if_changed $TMPH libavutil/avconfig.h
  2836. test -n "$WARNINGS" && printf "\n$WARNINGS"
  2837. # build pkg-config files
  2838. pkgconfig_generate(){
  2839. name=$1
  2840. shortname=${name#lib}${build_suffix}
  2841. comment=$2
  2842. version=$3
  2843. libs=$4
  2844. requires=$5
  2845. cat <<EOF > $name/$name.pc
  2846. prefix=$prefix
  2847. exec_prefix=\${prefix}
  2848. libdir=$libdir
  2849. includedir=$incdir
  2850. Name: $name
  2851. Description: $comment
  2852. Version: $version
  2853. Requires: $(enabled shared || echo $requires)
  2854. Requires.private: $(enabled shared && echo $requires)
  2855. Conflicts:
  2856. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  2857. Libs.private: $(enabled shared && echo $libs)
  2858. Cflags: -I\${includedir}
  2859. EOF
  2860. cat <<EOF > $name/$name-uninstalled.pc
  2861. prefix=
  2862. exec_prefix=
  2863. libdir=\${pcfiledir}
  2864. includedir=${source_path}
  2865. Name: $name
  2866. Description: $comment
  2867. Version: $version
  2868. Requires: $requires
  2869. Conflicts:
  2870. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2871. Cflags: -I\${includedir}
  2872. EOF
  2873. }
  2874. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2875. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2876. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  2877. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  2878. enabled avfilter &&
  2879. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2880. enabled postproc &&
  2881. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2882. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"