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.

3162 lines
89KB

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