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.

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