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.

3149 lines
88KB

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