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.

3158 lines
89KB

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