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.

3168 lines
89KB

  1. #!/bin/sh
  2. #
  3. # FFmpeg configure script
  4. #
  5. # Copyright (c) 2000-2002 Fabrice Bellard
  6. # Copyright (c) 2005-2008 Diego Biurrun
  7. # Copyright (c) 2005-2008 Mans Rullgard
  8. #
  9. # Prevent locale nonsense from breaking basic text processing.
  10. LC_ALL=C
  11. export LC_ALL
  12. # make sure we are running under a compatible shell
  13. # try to make this part work with most shells
  14. try_exec(){
  15. echo "Trying shell $1"
  16. type "$1" > /dev/null 2>&1 && exec "$@"
  17. }
  18. unset foo
  19. (: ${foo%%bar}) 2> /dev/null
  20. E1="$?"
  21. (: ${foo?}) 2> /dev/null
  22. E2="$?"
  23. if test "$E1" != 0 || test "$E2" = 0; then
  24. echo "Broken shell detected. Trying alternatives."
  25. export FF_CONF_EXEC
  26. if test "0$FF_CONF_EXEC" -lt 1; then
  27. FF_CONF_EXEC=1
  28. try_exec bash "$0" "$@"
  29. fi
  30. if test "0$FF_CONF_EXEC" -lt 2; then
  31. FF_CONF_EXEC=2
  32. try_exec ksh "$0" "$@"
  33. fi
  34. if test "0$FF_CONF_EXEC" -lt 3; then
  35. FF_CONF_EXEC=3
  36. try_exec /usr/xpg4/bin/sh "$0" "$@"
  37. fi
  38. echo "No compatible shell script interpreter found."
  39. echo "This configure script requires a POSIX-compatible shell"
  40. echo "such as bash or ksh."
  41. echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
  42. echo "Instead, install a working POSIX-compatible shell."
  43. echo "Disabling this configure test will create a broken FFmpeg."
  44. if test "$BASH_VERSION" = '2.04.0(1)-release'; then
  45. echo "This bash version ($BASH_VERSION) is broken on your platform."
  46. echo "Upgrade to a later version if available."
  47. fi
  48. exit 1
  49. fi
  50. show_help(){
  51. cat <<EOF
  52. Usage: configure [options]
  53. Options: [defaults in brackets after descriptions]
  54. Standard options:
  55. --help print this message
  56. --logfile=FILE log tests and output to FILE [config.err]
  57. --disable-logging do not log configure debug information
  58. --prefix=PREFIX install in PREFIX [$prefix]
  59. --bindir=DIR install binaries in DIR [PREFIX/bin]
  60. --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
  61. --libdir=DIR install libs in DIR [PREFIX/lib]
  62. --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
  63. --incdir=DIR install includes in DIR [PREFIX/include]
  64. --mandir=DIR install man page in DIR [PREFIX/share/man]
  65. Configuration options:
  66. --disable-static do not build static libraries [no]
  67. --enable-shared build shared libraries [no]
  68. --enable-gpl allow use of GPL code, the resulting libs
  69. and binaries will be under GPL [no]
  70. --enable-version3 upgrade (L)GPL to version 3 [no]
  71. --enable-nonfree allow use of nonfree code, the resulting libs
  72. and binaries will be unredistributable [no]
  73. --disable-doc do not build documentation
  74. --disable-ffmpeg disable ffmpeg build
  75. --disable-ffplay disable ffplay build
  76. --disable-ffprobe disable ffprobe build
  77. --disable-ffserver disable ffserver build
  78. --disable-avdevice disable libavdevice build
  79. --disable-avcodec disable libavcodec build
  80. --disable-avformat disable libavformat build
  81. --disable-swscale disable libswscale build
  82. --enable-postproc enable GPLed postprocessing support [no]
  83. --enable-avfilter video filter support [no]
  84. --enable-avfilter-lavf video filters dependent on avformat [no]
  85. --enable-beosthreads use BeOS threads [no]
  86. --enable-os2threads use OS/2 threads [no]
  87. --enable-pthreads use pthreads [no]
  88. --enable-w32threads use Win32 threads [no]
  89. --enable-x11grab enable X11 grabbing [no]
  90. --disable-network disable network support [no]
  91. --disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]
  92. --enable-gray enable full grayscale support (slower color)
  93. --disable-swscale-alpha disable alpha channel support in swscale
  94. --disable-fastdiv disable table-based division
  95. --enable-small optimize for size instead of speed
  96. --disable-aandct disable AAN DCT code
  97. --disable-dct disable DCT code
  98. --disable-fft disable FFT code
  99. --disable-golomb disable Golomb code
  100. --disable-lpc disable LPC code
  101. --disable-mdct disable MDCT code
  102. --disable-rdft disable RDFT code
  103. --disable-vaapi disable VAAPI code
  104. --disable-vdpau disable VDPAU code
  105. --disable-dxva2 disable DXVA2 code
  106. --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
  107. --enable-hardcoded-tables use hardcoded tables instead of runtime generation
  108. --enable-memalign-hack emulate memalign, interferes with memory debuggers
  109. --enable-beos-netserver enable BeOS netserver
  110. --disable-everything disable all components listed below
  111. --disable-encoder=NAME disable encoder NAME
  112. --enable-encoder=NAME enable encoder NAME
  113. --disable-encoders disable all encoders
  114. --disable-decoder=NAME disable decoder NAME
  115. --enable-decoder=NAME enable decoder NAME
  116. --disable-decoders disable all decoders
  117. --disable-hwaccel=NAME disable hwaccel NAME
  118. --enable-hwaccel=NAME enable hwaccel NAME
  119. --disable-hwaccels disable all hwaccels
  120. --disable-muxer=NAME disable muxer NAME
  121. --enable-muxer=NAME enable muxer NAME
  122. --disable-muxers disable all muxers
  123. --disable-demuxer=NAME disable demuxer NAME
  124. --enable-demuxer=NAME enable demuxer NAME
  125. --disable-demuxers disable all demuxers
  126. --enable-parser=NAME enable parser NAME
  127. --disable-parser=NAME disable parser NAME
  128. --disable-parsers disable all parsers
  129. --enable-bsf=NAME enable bitstream filter NAME
  130. --disable-bsf=NAME disable bitstream filter NAME
  131. --disable-bsfs disable all bitstream filters
  132. --enable-protocol=NAME enable protocol NAME
  133. --disable-protocol=NAME disable protocol NAME
  134. --disable-protocols disable all protocols
  135. --disable-indev=NAME disable input device NAME
  136. --disable-outdev=NAME disable output device NAME
  137. --disable-indevs disable input devices
  138. --disable-outdevs disable output devices
  139. --disable-devices disable all devices
  140. --enable-filter=NAME enable filter NAME
  141. --disable-filter=NAME disable filter NAME
  142. --disable-filters disable all filters
  143. --list-decoders show all available decoders
  144. --list-encoders show all available encoders
  145. --list-hwaccels show all available hardware accelerators
  146. --list-muxers show all available muxers
  147. --list-demuxers show all available demuxers
  148. --list-parsers show all available parsers
  149. --list-protocols show all available protocols
  150. --list-bsfs show all available bitstream filters
  151. --list-indevs show all available input devices
  152. --list-outdevs show all available output devices
  153. --list-filters show all available filters
  154. External library support:
  155. --enable-avisynth enable reading of AVISynth script files [no]
  156. --enable-bzlib enable bzlib [autodetect]
  157. --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
  158. --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
  159. --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
  160. and libraw1394 [no]
  161. --enable-libdirac enable Dirac support via libdirac [no]
  162. --enable-libfaac enable FAAC support via libfaac [no]
  163. --enable-libfaad enable FAAD support via libfaad [no]
  164. --enable-libfaadbin open libfaad.so.0 at runtime [no]
  165. --enable-libgsm enable GSM support via libgsm [no]
  166. --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
  167. --enable-libnut enable NUT (de)muxing via libnut,
  168. native (de)muxer exists [no]
  169. --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no]
  170. --enable-librtmp enable RTMP[E] support via librtmp [no]
  171. --enable-libschroedinger enable Dirac support via libschroedinger [no]
  172. --enable-libspeex enable Speex decoding via libspeex [no]
  173. --enable-libtheora enable Theora encoding via libtheora [no]
  174. --enable-libvorbis enable Vorbis encoding via libvorbis,
  175. native implementation exists [no]
  176. --enable-libx264 enable H.264 encoding via x264 [no]
  177. --enable-libxvid enable Xvid encoding via xvidcore,
  178. native MPEG-4/Xvid encoder exists [no]
  179. --enable-mlib enable Sun medialib [no]
  180. --enable-zlib enable zlib [autodetect]
  181. Advanced options (experts only):
  182. --source-path=PATH path to source code [$source_path]
  183. --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
  184. --enable-cross-compile assume a cross-compiler is used
  185. --sysroot=PATH root of cross-build tree
  186. --sysinclude=PATH location of cross-build system headers
  187. --target-os=OS compiler targets OS [$target_os]
  188. --target-exec=CMD command to run executables on target
  189. --target-path=DIR path to view of build directory on target
  190. --nm=NM use nm tool
  191. --as=AS use assembler AS [$as_default]
  192. --cc=CC use C compiler CC [$cc_default]
  193. --ld=LD use linker LD
  194. --host-cc=HOSTCC use host C compiler HOSTCC
  195. --host-cflags=HCFLAGS use HCFLAGS when compiling for host
  196. --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
  197. --host-libs=HLIBS use libs HLIBS when linking for host
  198. --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
  199. --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
  200. --extra-libs=ELIBS add ELIBS [$ELIBS]
  201. --extra-version=STRING version string suffix []
  202. --build-suffix=SUFFIX library name suffix []
  203. --arch=ARCH select architecture [$arch]
  204. --cpu=CPU select the minimum required CPU (affects
  205. instruction selection, may crash on older CPUs)
  206. --enable-powerpc-perf enable performance report on PPC
  207. (requires enabling PMC)
  208. --disable-asm disable all assembler optimizations
  209. --disable-altivec disable AltiVec optimizations
  210. --disable-amd3dnow disable 3DNow! optimizations
  211. --disable-amd3dnowext disable 3DNow! extended optimizations
  212. --disable-mmx disable MMX optimizations
  213. --disable-mmx2 disable MMX2 optimizations
  214. --disable-sse disable SSE optimizations
  215. --disable-ssse3 disable SSSE3 optimizations
  216. --disable-armv5te disable armv5te optimizations
  217. --disable-armv6 disable armv6 optimizations
  218. --disable-armv6t2 disable armv6t2 optimizations
  219. --disable-armvfp disable ARM VFP optimizations
  220. --disable-iwmmxt disable iwmmxt optimizations
  221. --disable-mmi disable MMI optimizations
  222. --disable-neon disable neon optimizations
  223. --disable-vis disable VIS optimizations
  224. --disable-yasm disable use of yasm assembler
  225. --enable-pic build position-independent code
  226. --malloc-prefix=PFX prefix malloc and related names with PFX
  227. --enable-sram allow use of on-chip SRAM
  228. Developer options (useful when working on FFmpeg itself):
  229. --disable-debug disable debugging symbols
  230. --enable-debug=LEVEL set the debug level [$debuglevel]
  231. --enable-gprof enable profiling with gprof [$gprof]
  232. --disable-optimizations disable compiler optimizations
  233. --enable-extra-warnings enable more compiler warnings
  234. --disable-stripping disable stripping of executables and shared libraries
  235. --samples=PATH location of test samples for FATE
  236. NOTE: Object files are built at the place where configure is launched.
  237. EOF
  238. exit 0
  239. }
  240. log(){
  241. echo "$@" >> $logfile
  242. }
  243. log_file(){
  244. log BEGIN $1
  245. pr -n -t $1 >> $logfile
  246. log END $1
  247. }
  248. echolog(){
  249. log "$@"
  250. echo "$@"
  251. }
  252. die(){
  253. echolog "$@"
  254. cat <<EOF
  255. If you think configure made a mistake, make sure you are using the latest
  256. version from SVN. If the latest version fails, report the problem to the
  257. ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
  258. EOF
  259. if disabled logging; then
  260. cat <<EOF
  261. Rerun configure with logging enabled (do not use --disable-logging), and
  262. include the log this produces with your report.
  263. EOF
  264. else
  265. cat <<EOF
  266. Include the log file "$logfile" produced by configure as this will help
  267. solving the problem.
  268. EOF
  269. fi
  270. exit 1
  271. }
  272. # Avoid locale weirdness, besides we really just want to translate ASCII.
  273. toupper(){
  274. echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
  275. }
  276. tolower(){
  277. echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
  278. }
  279. c_escape(){
  280. echo "$*" | sed 's/["\\]/\\\0/g'
  281. }
  282. sh_quote(){
  283. v=$(echo "$1" | sed "s/'/'\\\\''/g")
  284. test "$v" = "${v#*[ |&;<>()$\`\\\"\'*?\[\]#~=%]}" || v="'$v'"
  285. echo "$v"
  286. }
  287. filter(){
  288. pat=$1
  289. shift
  290. for v; do
  291. eval "case $v in $pat) echo $v ;; esac"
  292. done
  293. }
  294. map(){
  295. m=$1
  296. shift
  297. for v; do eval $m; done
  298. }
  299. set_all(){
  300. value=$1
  301. shift
  302. for var in $*; do
  303. eval $var=$value
  304. done
  305. }
  306. set_weak(){
  307. value=$1
  308. shift
  309. for var; do
  310. eval : \${$var:=$value}
  311. done
  312. }
  313. pushvar(){
  314. for var in $*; do
  315. eval level=\${${var}_level:=0}
  316. eval ${var}_${level}="\$$var"
  317. eval ${var}_level=$(($level+1))
  318. done
  319. }
  320. popvar(){
  321. for var in $*; do
  322. eval level=\${${var}_level:-0}
  323. test $level = 0 && continue
  324. eval level=$(($level-1))
  325. eval $var="\${${var}_${level}}"
  326. eval ${var}_level=$level
  327. eval unset ${var}_${level}
  328. done
  329. }
  330. enable(){
  331. set_all yes $*
  332. }
  333. disable(){
  334. set_all no $*
  335. }
  336. enable_weak(){
  337. set_weak yes $*
  338. }
  339. disable_weak(){
  340. set_weak no $*
  341. }
  342. enable_safe(){
  343. for var; do
  344. enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  345. done
  346. }
  347. disable_safe(){
  348. for var; do
  349. disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
  350. done
  351. }
  352. do_enable_deep(){
  353. for var; do
  354. enabled $var && continue
  355. eval sel="\$${var}_select"
  356. eval sgs="\$${var}_suggest"
  357. pushvar var sgs
  358. enable_deep $sel
  359. popvar sgs
  360. enable_deep_weak $sgs
  361. popvar var
  362. done
  363. }
  364. enable_deep(){
  365. do_enable_deep $*
  366. enable $*
  367. }
  368. enable_deep_weak(){
  369. do_enable_deep $*
  370. enable_weak $*
  371. }
  372. enabled(){
  373. test "${1#!}" = "$1" && op== || op=!=
  374. eval test "x\$${1#!}" $op "xyes"
  375. }
  376. disabled(){
  377. test "${1#!}" = "$1" && op== || op=!=
  378. eval test "x\$${1#!}" $op "xno"
  379. }
  380. enabled_all(){
  381. for opt; do
  382. enabled $opt || return 1
  383. done
  384. }
  385. disabled_all(){
  386. for opt; do
  387. disabled $opt || return 1
  388. done
  389. }
  390. enabled_any(){
  391. for opt; do
  392. enabled $opt && return 0
  393. done
  394. }
  395. disabled_any(){
  396. for opt; do
  397. disabled $opt && return 0
  398. done
  399. return 1
  400. }
  401. set_default(){
  402. for opt; do
  403. eval : \${$opt:=\$${opt}_default}
  404. done
  405. }
  406. is_in(){
  407. value=$1
  408. shift
  409. for var in $*; do
  410. [ $var = $value ] && return 0
  411. done
  412. return 1
  413. }
  414. check_deps(){
  415. for cfg; do
  416. cfg="${cfg#!}"
  417. enabled ${cfg}_checking && die "Circular dependency for $cfg."
  418. disabled ${cfg}_checking && continue
  419. enable ${cfg}_checking
  420. eval dep_all="\$${cfg}_deps"
  421. eval dep_any="\$${cfg}_deps_any"
  422. eval dep_sel="\$${cfg}_select"
  423. eval dep_sgs="\$${cfg}_suggest"
  424. eval dep_ifa="\$${cfg}_if"
  425. eval dep_ifn="\$${cfg}_if_any"
  426. pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  427. check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
  428. popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
  429. [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
  430. [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
  431. enabled_all $dep_all || disable $cfg
  432. enabled_any $dep_any || disable $cfg
  433. disabled_any $dep_sel && disable $cfg
  434. if enabled $cfg; then
  435. eval dep_extralibs="\$${cfg}_extralibs"
  436. test -n "$dep_extralibs" && add_extralibs $dep_extralibs
  437. enable_deep $dep_sel
  438. enable_deep_weak $dep_sgs
  439. fi
  440. disable ${cfg}_checking
  441. done
  442. }
  443. print_config(){
  444. pfx=$1
  445. header=$2
  446. makefile=$3
  447. shift 3
  448. for cfg; do
  449. ucname="$(toupper $cfg)"
  450. if enabled $cfg; then
  451. echo "#define ${pfx}${ucname} 1" >> $header
  452. echo "${pfx}${ucname}=yes" >> $makefile
  453. else
  454. echo "#define ${pfx}${ucname} 0" >> $header
  455. echo "!${pfx}${ucname}=yes" >> $makefile
  456. fi
  457. done
  458. }
  459. flags_saved(){
  460. (: ${SAVE_CFLAGS?}) 2> /dev/null
  461. }
  462. save_flags(){
  463. flags_saved && return
  464. SAVE_CFLAGS="$CFLAGS"
  465. SAVE_LDFLAGS="$LDFLAGS"
  466. SAVE_extralibs="$extralibs"
  467. }
  468. restore_flags(){
  469. flags_saved || return
  470. CFLAGS="$SAVE_CFLAGS"
  471. LDFLAGS="$SAVE_LDFLAGS"
  472. extralibs="$SAVE_extralibs"
  473. unset SAVE_CFLAGS
  474. unset SAVE_LDFLAGS
  475. unset SAVE_extralibs
  476. }
  477. temp_cflags(){
  478. save_flags
  479. CFLAGS="$CFLAGS $*"
  480. }
  481. temp_ldflags(){
  482. save_flags
  483. LDFLAGS="$LDFLAGS $*"
  484. }
  485. temp_extralibs(){
  486. save_flags
  487. extralibs="$extralibs $*"
  488. }
  489. append(){
  490. var=$1
  491. shift
  492. flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
  493. eval "$var=\"\$$var $*\""
  494. }
  495. add_cppflags(){
  496. append CPPFLAGS $($filter_cppflags "$@")
  497. }
  498. add_cflags(){
  499. append CFLAGS $($filter_cflags "$@")
  500. }
  501. add_asflags(){
  502. append ASFLAGS $($filter_asflags "$@")
  503. }
  504. add_ldflags(){
  505. append LDFLAGS "$@"
  506. }
  507. add_extralibs(){
  508. append extralibs "$@"
  509. }
  510. check_cmd(){
  511. log "$@"
  512. "$@" >> $logfile 2>&1
  513. }
  514. check_cc(){
  515. log check_cc "$@"
  516. cat > $TMPC
  517. log_file $TMPC
  518. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
  519. }
  520. check_cpp(){
  521. log check_cpp "$@"
  522. cat > $TMPC
  523. log_file $TMPC
  524. check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
  525. }
  526. check_as(){
  527. log check_as "$@"
  528. cat > $TMPC
  529. log_file $TMPC
  530. check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
  531. }
  532. check_asm(){
  533. log check_asm "$@"
  534. name="$1"
  535. code="$2"
  536. shift 2
  537. disable $name
  538. check_as "$@" <<EOF && enable $name
  539. void foo(void){ __asm__ volatile($code); }
  540. EOF
  541. }
  542. check_yasm(){
  543. log check_yasm "$@"
  544. echo "$1" > $TMPS
  545. log_file $TMPS
  546. shift 1
  547. check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
  548. }
  549. check_ld(){
  550. log check_ld "$@"
  551. flags=''
  552. libs=''
  553. for f; do
  554. test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
  555. done
  556. check_cc $($filter_cflags $flags) || return
  557. check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
  558. }
  559. check_cppflags(){
  560. log check_cppflags "$@"
  561. set -- $($filter_cppflags "$@")
  562. check_cc "$@" <<EOF && append CPPFLAGS "$@"
  563. int x;
  564. EOF
  565. }
  566. check_cflags(){
  567. log check_cflags "$@"
  568. set -- $($filter_cflags "$@")
  569. check_cc "$@" <<EOF && append CFLAGS "$@"
  570. int x;
  571. EOF
  572. }
  573. test_ldflags(){
  574. log test_ldflags "$@"
  575. check_ld "$@" <<EOF
  576. int main(void){ return 0; }
  577. EOF
  578. }
  579. check_ldflags(){
  580. log check_ldflags "$@"
  581. test_ldflags "$@" && add_ldflags "$@"
  582. }
  583. check_header(){
  584. log check_header "$@"
  585. header=$1
  586. shift
  587. disable_safe $header
  588. check_cpp "$@" <<EOF && enable_safe $header
  589. #include <$header>
  590. int x;
  591. EOF
  592. }
  593. check_func(){
  594. log check_func "$@"
  595. func=$1
  596. shift
  597. disable $func
  598. check_ld "$@" <<EOF && enable $func
  599. extern int $func();
  600. int main(void){ $func(); }
  601. EOF
  602. }
  603. check_mathfunc(){
  604. log check_mathfunc "$@"
  605. func=$1
  606. shift
  607. disable $func
  608. check_ld "$@" <<EOF && enable $func
  609. #include <math.h>
  610. float foo(float f) { return $func(f); }
  611. int main(void){ return 0; }
  612. EOF
  613. }
  614. check_func_headers(){
  615. log check_func_headers "$@"
  616. headers=$1
  617. func=$2
  618. shift 2
  619. disable $func
  620. incs=""
  621. for hdr in $headers; do
  622. incs="$incs
  623. #include <$hdr>"
  624. done
  625. check_ld "$@" <<EOF && enable $func && enable_safe $headers
  626. $incs
  627. int main(int argc, char **argv){
  628. return (long) $func;
  629. }
  630. EOF
  631. }
  632. check_cpp_condition(){
  633. log check_cpp_condition "$@"
  634. header=$1
  635. condition=$2
  636. shift 2
  637. check_cpp $($filter_cppflags "$@") <<EOF
  638. #include <$header>
  639. #if !($condition)
  640. #error "unsatisfied condition: $condition"
  641. #endif
  642. EOF
  643. }
  644. check_lib(){
  645. log check_lib "$@"
  646. header="$1"
  647. func="$2"
  648. shift 2
  649. temp_extralibs "$@"
  650. check_header $header && check_func $func && add_extralibs "$@"
  651. err=$?
  652. restore_flags
  653. return $err
  654. }
  655. check_lib2(){
  656. log check_lib2 "$@"
  657. headers="$1"
  658. func="$2"
  659. shift 2
  660. check_func_headers "$headers" $func "$@" && add_extralibs "$@"
  661. }
  662. check_exec(){
  663. check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
  664. }
  665. check_exec_crash(){
  666. code=$(cat)
  667. # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
  668. # are safe but may not be available everywhere. Thus we use
  669. # raise(SIGTERM) instead. The check is run in a subshell so we
  670. # can redirect the "Terminated" message from the shell. SIGBUS
  671. # is not defined by standard C so it is used conditionally.
  672. (check_exec "$@") >> $logfile 2>&1 <<EOF
  673. #include <signal.h>
  674. static void sighandler(int sig){
  675. raise(SIGTERM);
  676. }
  677. int main(void){
  678. signal(SIGILL, sighandler);
  679. signal(SIGFPE, sighandler);
  680. signal(SIGSEGV, sighandler);
  681. #ifdef SIGBUS
  682. signal(SIGBUS, sighandler);
  683. #endif
  684. { $code }
  685. }
  686. EOF
  687. }
  688. check_type(){
  689. log check_type "$@"
  690. headers=$1
  691. type=$2
  692. shift 2
  693. disable_safe "$type"
  694. incs=""
  695. for hdr in $headers; do
  696. incs="$incs
  697. #include <$hdr>"
  698. done
  699. check_cc "$@" <<EOF && enable_safe "$type"
  700. $incs
  701. $type v;
  702. EOF
  703. }
  704. check_struct(){
  705. log check_type "$@"
  706. headers=$1
  707. struct=$2
  708. member=$3
  709. shift 3
  710. disable_safe "${struct}_${member}"
  711. incs=""
  712. for hdr in $headers; do
  713. incs="$incs
  714. #include <$hdr>"
  715. done
  716. check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
  717. $incs
  718. const void *p = &(($struct *)0)->$member;
  719. EOF
  720. }
  721. require(){
  722. name="$1"
  723. header="$2"
  724. func="$3"
  725. shift 3
  726. check_lib $header $func "$@" || die "ERROR: $name not found"
  727. }
  728. require2(){
  729. name="$1"
  730. headers="$2"
  731. func="$3"
  732. shift 3
  733. check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
  734. }
  735. check_foo_config(){
  736. cfg=$1
  737. pkg=$2
  738. header=$3
  739. func=$4
  740. shift 4
  741. disable $cfg
  742. check_cmd ${pkg}-config --version
  743. err=$?
  744. if test "$err" = 0; then
  745. temp_cflags $(${pkg}-config --cflags)
  746. temp_extralibs $(${pkg}-config --libs)
  747. check_lib "$@" $header $func && enable $cfg
  748. fi
  749. return $err
  750. }
  751. check_host_cc(){
  752. log check_host_cc "$@"
  753. cat > $TMPC
  754. log_file $TMPC
  755. check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
  756. }
  757. check_host_cflags(){
  758. log check_host_cflags "$@"
  759. check_host_cc "$@" <<EOF && append host_cflags "$@"
  760. int x;
  761. EOF
  762. }
  763. apply(){
  764. file=$1
  765. shift
  766. "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
  767. }
  768. cp_if_changed(){
  769. cmp -s "$1" "$2" &&
  770. echo "$2 is unchanged" ||
  771. cp -f "$1" "$2"
  772. }
  773. # CONFIG_LIST contains configurable options, while HAVE_LIST is for
  774. # system-dependent things.
  775. COMPONENT_LIST="
  776. bsfs
  777. decoders
  778. demuxers
  779. encoders
  780. filters
  781. hwaccels
  782. indevs
  783. muxers
  784. outdevs
  785. parsers
  786. protocols
  787. "
  788. CONFIG_LIST="
  789. $COMPONENT_LIST
  790. aandct
  791. avcodec
  792. avdevice
  793. avfilter
  794. avfilter_lavf
  795. avformat
  796. avisynth
  797. beos_netserver
  798. bzlib
  799. dct
  800. doc
  801. dwt
  802. dxva2
  803. fastdiv
  804. ffmpeg
  805. ffplay
  806. ffprobe
  807. ffserver
  808. fft
  809. golomb
  810. gpl
  811. gprof
  812. gray
  813. h264dsp
  814. hardcoded_tables
  815. libdc1394
  816. libdirac
  817. libfaac
  818. libfaad
  819. libfaadbin
  820. libgsm
  821. libmp3lame
  822. libnut
  823. libopencore_amrnb
  824. libopencore_amrwb
  825. libopenjpeg
  826. librtmp
  827. libschroedinger
  828. libspeex
  829. libtheora
  830. libvorbis
  831. libx264
  832. libxvid
  833. lpc
  834. lsp
  835. mdct
  836. memalign_hack
  837. mlib
  838. mpegaudio_hp
  839. network
  840. nonfree
  841. pic
  842. postproc
  843. powerpc_perf
  844. rdft
  845. runtime_cpudetect
  846. shared
  847. small
  848. sram
  849. static
  850. swscale
  851. swscale_alpha
  852. vaapi
  853. vdpau
  854. version3
  855. x11grab
  856. zlib
  857. "
  858. THREADS_LIST='
  859. beosthreads
  860. os2threads
  861. pthreads
  862. w32threads
  863. '
  864. ARCH_LIST='
  865. alpha
  866. arm
  867. avr32
  868. avr32_ap
  869. avr32_uc
  870. bfin
  871. ia64
  872. m68k
  873. mips
  874. mips64
  875. parisc
  876. ppc
  877. ppc64
  878. s390
  879. sh4
  880. sparc
  881. sparc64
  882. tomi
  883. x86
  884. x86_32
  885. x86_64
  886. '
  887. ARCH_EXT_LIST='
  888. altivec
  889. amd3dnow
  890. amd3dnowext
  891. armv5te
  892. armv6
  893. armv6t2
  894. armvfp
  895. iwmmxt
  896. mmi
  897. mmx
  898. mmx2
  899. neon
  900. ppc4xx
  901. sse
  902. ssse3
  903. vis
  904. '
  905. HAVE_LIST_PUB='
  906. bigendian
  907. '
  908. HAVE_LIST="
  909. $ARCH_EXT_LIST
  910. $HAVE_LIST_PUB
  911. $THREADS_LIST
  912. alsa_asoundlib_h
  913. altivec_h
  914. arpa_inet_h
  915. attribute_may_alias
  916. attribute_packed
  917. bswap
  918. closesocket
  919. cmov
  920. conio_h
  921. dcbzl
  922. dev_bktr_ioctl_bt848_h
  923. dev_bktr_ioctl_meteor_h
  924. dev_ic_bt8xx_h
  925. dev_video_meteor_ioctl_meteor_h
  926. dev_video_bktr_ioctl_bt848_h
  927. dlfcn_h
  928. dlopen
  929. dos_paths
  930. ebp_available
  931. ebx_available
  932. exp2
  933. exp2f
  934. fast_64bit
  935. fast_clz
  936. fast_cmov
  937. fast_unaligned
  938. fork
  939. getaddrinfo
  940. gethrtime
  941. GetProcessMemoryInfo
  942. GetProcessTimes
  943. getrusage
  944. struct_rusage_ru_maxrss
  945. inet_aton
  946. inline_asm
  947. isatty
  948. ldbrx
  949. libdc1394_1
  950. libdc1394_2
  951. llrint
  952. local_aligned_16
  953. local_aligned_8
  954. log2
  955. log2f
  956. loongson
  957. lrint
  958. lrintf
  959. lzo1x_999_compress
  960. machine_ioctl_bt848_h
  961. machine_ioctl_meteor_h
  962. malloc_h
  963. memalign
  964. mkstemp
  965. pld
  966. posix_memalign
  967. round
  968. roundf
  969. sdl
  970. sdl_video_size
  971. setmode
  972. socklen_t
  973. soundcard_h
  974. poll_h
  975. setrlimit
  976. strerror_r
  977. struct_addrinfo
  978. struct_ipv6_mreq
  979. struct_sockaddr_in6
  980. struct_sockaddr_sa_len
  981. struct_sockaddr_storage
  982. sys_mman_h
  983. sys_resource_h
  984. sys_select_h
  985. sys_soundcard_h
  986. sys_videoio_h
  987. ten_operands
  988. termios_h
  989. threads
  990. truncf
  991. vfp_args
  992. VirtualAlloc
  993. winsock2_h
  994. xform_asm
  995. yasm
  996. "
  997. # options emitted with CONFIG_ prefix but not available on command line
  998. CONFIG_EXTRA="
  999. avutil
  1000. gplv3
  1001. lgplv3
  1002. "
  1003. CMDLINE_SELECT="
  1004. $ARCH_EXT_LIST
  1005. $CONFIG_LIST
  1006. $THREADS_LIST
  1007. asm
  1008. cross_compile
  1009. debug
  1010. extra_warnings
  1011. logging
  1012. optimizations
  1013. stripping
  1014. yasm
  1015. "
  1016. PATHS_LIST='
  1017. bindir
  1018. datadir
  1019. incdir
  1020. libdir
  1021. mandir
  1022. prefix
  1023. shlibdir
  1024. '
  1025. CMDLINE_SET="
  1026. $PATHS_LIST
  1027. arch
  1028. as
  1029. build_suffix
  1030. cc
  1031. cpu
  1032. cross_prefix
  1033. dep_cc
  1034. extra_version
  1035. host_cc
  1036. host_cflags
  1037. host_ldflags
  1038. host_libs
  1039. host_os
  1040. ld
  1041. logfile
  1042. malloc_prefix
  1043. nm
  1044. samples
  1045. source_path
  1046. strip
  1047. sysinclude
  1048. sysroot
  1049. target_exec
  1050. target_os
  1051. target_path
  1052. "
  1053. CMDLINE_APPEND="
  1054. extra_cflags
  1055. "
  1056. # code dependency declarations
  1057. # architecture extensions
  1058. armv5te_deps="arm"
  1059. armv6_deps="arm"
  1060. armv6t2_deps="arm"
  1061. armvfp_deps="arm"
  1062. iwmmxt_deps="arm"
  1063. neon_deps="arm"
  1064. mmi_deps="mips"
  1065. altivec_deps="ppc"
  1066. ppc4xx_deps="ppc"
  1067. vis_deps="sparc"
  1068. x86_64_suggest="cmov fast_cmov"
  1069. amd3dnow_deps="mmx"
  1070. amd3dnowext_deps="amd3dnow"
  1071. mmx_deps="x86"
  1072. mmx2_deps="mmx"
  1073. sse_deps="mmx"
  1074. ssse3_deps="sse"
  1075. fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
  1076. fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
  1077. fast_unaligned_if_any="armv6 ppc x86"
  1078. need_memalign="altivec neon sse"
  1079. inline_asm_deps="!tms470"
  1080. # subsystems
  1081. mdct_select="fft"
  1082. rdft_select="fft"
  1083. # decoders / encoders / hardware accelerators
  1084. aac_decoder_select="mdct rdft aac_parser"
  1085. aac_encoder_select="mdct"
  1086. ac3_decoder_select="mdct ac3_parser"
  1087. alac_encoder_select="lpc"
  1088. amrnb_decoder_select="lsp"
  1089. atrac1_decoder_select="mdct"
  1090. atrac3_decoder_select="mdct"
  1091. binkaudio_dct_decoder_select="mdct rdft dct"
  1092. binkaudio_rdft_decoder_select="mdct rdft"
  1093. cavs_decoder_select="golomb"
  1094. cook_decoder_select="mdct"
  1095. cscd_decoder_suggest="zlib"
  1096. dca_decoder_select="mdct"
  1097. dnxhd_encoder_select="aandct"
  1098. dxa_decoder_select="zlib"
  1099. eac3_decoder_select="ac3_decoder"
  1100. eamad_decoder_select="aandct"
  1101. eatgq_decoder_select="aandct"
  1102. eatqi_decoder_select="aandct"
  1103. ffv1_decoder_select="golomb"
  1104. flac_decoder_select="golomb"
  1105. flac_encoder_select="golomb lpc"
  1106. flashsv_decoder_select="zlib"
  1107. flashsv_encoder_select="zlib"
  1108. flv_decoder_select="h263_decoder"
  1109. flv_encoder_select="h263_encoder"
  1110. h261_encoder_select="aandct"
  1111. h263_decoder_select="h263_parser"
  1112. h263_encoder_select="aandct"
  1113. h263_vaapi_hwaccel_deps="va_va_h"
  1114. h263_vaapi_hwaccel_select="vaapi h263_decoder"
  1115. h263i_decoder_select="h263_decoder"
  1116. h263p_encoder_select="h263_encoder"
  1117. h264_decoder_select="golomb h264dsp"
  1118. h264_dxva2_hwaccel_deps="dxva2api_h"
  1119. h264_dxva2_hwaccel_select="dxva2 h264_decoder"
  1120. h264_vaapi_hwaccel_deps="va_va_h"
  1121. h264_vaapi_hwaccel_select="vaapi"
  1122. h264_vdpau_decoder_select="vdpau h264_decoder"
  1123. imc_decoder_select="fft mdct"
  1124. jpegls_decoder_select="golomb"
  1125. jpegls_encoder_select="golomb"
  1126. ljpeg_encoder_select="aandct"
  1127. loco_decoder_select="golomb"
  1128. mjpeg_encoder_select="aandct"
  1129. mlp_decoder_select="mlp_parser"
  1130. mpeg1video_encoder_select="aandct"
  1131. mpeg2video_encoder_select="aandct"
  1132. mpeg4_decoder_select="h263_decoder mpeg4video_parser"
  1133. mpeg4_encoder_select="h263_encoder"
  1134. mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
  1135. mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
  1136. mpeg2_vaapi_hwaccel_deps="va_va_h"
  1137. mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
  1138. mpeg4_vaapi_hwaccel_deps="va_va_h"
  1139. mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
  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 h264dsp"
  1160. rv40_decoder_select="golomb h264dsp"
  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 h264dsp"
  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_select="vdpau vc1_decoder"
  1183. vorbis_decoder_select="mdct"
  1184. vorbis_encoder_select="mdct"
  1185. vp6a_decoder_select="vp6_decoder"
  1186. vp6f_decoder_select="vp6_decoder"
  1187. wmapro_decoder_select="mdct"
  1188. wmav1_decoder_select="mdct"
  1189. wmav1_encoder_select="mdct"
  1190. wmav2_decoder_select="mdct"
  1191. wmav2_encoder_select="mdct"
  1192. wmavoice_decoder_select="lsp"
  1193. wmv1_decoder_select="h263_decoder"
  1194. wmv1_encoder_select="h263_encoder"
  1195. wmv2_decoder_select="h263_decoder"
  1196. wmv2_encoder_select="h263_encoder"
  1197. wmv3_decoder_select="vc1_decoder"
  1198. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1199. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1200. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1201. zlib_decoder_select="zlib"
  1202. zlib_encoder_select="zlib"
  1203. zmbv_decoder_select="zlib"
  1204. zmbv_encoder_select="zlib"
  1205. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1206. # parsers
  1207. h264_parser_select="golomb h264dsp"
  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 ${v%s})_LIST}' $COMPONENT_LIST
  1445. ;;
  1446. --enable-*=*|--disable-*=*)
  1447. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1448. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1449. eval list=\$$(toupper $thing)_LIST
  1450. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1451. $action $(filter "$name" $list)
  1452. ;;
  1453. --enable-?*|--disable-?*)
  1454. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1455. if is_in $option $COMPONENT_LIST; then
  1456. test $action = disable && action=unset
  1457. eval $action \$$(toupper ${option%s})_LIST
  1458. elif is_in $option $CMDLINE_SELECT; then
  1459. $action $option
  1460. else
  1461. die_unknown $opt
  1462. fi
  1463. ;;
  1464. --list-*)
  1465. NAME="${opt#--list-}"
  1466. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1467. NAME=${NAME%s}
  1468. eval show_list $NAME \$$(toupper $NAME)_LIST
  1469. ;;
  1470. --help|-h) show_help
  1471. ;;
  1472. *)
  1473. optname="${opt%%=*}"
  1474. optname="${optname#--}"
  1475. optname=$(echo "$optname" | sed 's/-/_/g')
  1476. if is_in $optname $CMDLINE_SET; then
  1477. eval $optname='$optval'
  1478. elif is_in $optname $CMDLINE_APPEND; then
  1479. append $optname "$optval"
  1480. else
  1481. die_unknown $opt
  1482. fi
  1483. ;;
  1484. esac
  1485. done
  1486. disabled logging && logfile=/dev/null
  1487. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  1488. set >> $logfile
  1489. test -n "$cross_prefix" && enable cross_compile
  1490. if enabled cross_compile; then
  1491. test -n "$arch" && test -n "$target_os" ||
  1492. die "Must specify target arch and OS when cross-compiling"
  1493. fi
  1494. set_default arch target_os
  1495. ar="${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. # OS specific
  1919. case $target_os in
  1920. beos|haiku|zeta)
  1921. prefix_default="$HOME/config"
  1922. # 3 gcc releases known for BeOS, each with ugly bugs
  1923. gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
  1924. case "$gcc_version" in
  1925. 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
  1926. disable mmx
  1927. ;;
  1928. *20010315*) echo "BeBits gcc"
  1929. add_cflags -fno-expensive-optimizations
  1930. ;;
  1931. esac
  1932. SHFLAGS=-nostart
  1933. # enable BeOS things
  1934. enable audio_beos
  1935. # no need for libm, but the inet stuff
  1936. # Check for BONE
  1937. # XXX: actually should check for NOT net_server
  1938. if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
  1939. network_extralibs="-lbind -lsocket"
  1940. else
  1941. enable beos_netserver
  1942. network_extralibs="-lnet"
  1943. fi ;;
  1944. sunos)
  1945. FFSERVERLDFLAGS=""
  1946. SHFLAGS='-shared -Wl,-h,$$(@F)'
  1947. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  1948. network_extralibs="-lsocket -lnsl"
  1949. add_cppflags -D__EXTENSIONS__
  1950. nm_opts='-P -g'
  1951. ;;
  1952. netbsd)
  1953. oss_indev_extralibs="-lossaudio"
  1954. oss_outdev_extralibs="-lossaudio"
  1955. add_cppflags -D_XOPEN_SOURCE=600
  1956. ;;
  1957. openbsd)
  1958. enable malloc_aligned
  1959. # On OpenBSD 4.5. the compiler does not use PIC unless
  1960. # explicitly using -fPIC. FFmpeg builds fine without PIC,
  1961. # however the generated executable will not do anything
  1962. # (simply quits with exit-code 1, no crash, no output).
  1963. # Thus explicitly enable PIC here.
  1964. enable pic
  1965. SHFLAGS='-shared'
  1966. oss_indev_extralibs="-lossaudio"
  1967. oss_outdev_extralibs="-lossaudio"
  1968. ;;
  1969. freebsd|dragonfly)
  1970. enable malloc_aligned
  1971. ;;
  1972. bsd/os)
  1973. osextralibs="-lpoll -lgnugetopt"
  1974. strip="strip -d"
  1975. ;;
  1976. darwin)
  1977. enable malloc_aligned
  1978. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
  1979. strip="strip -x"
  1980. FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
  1981. SLIBSUF=".dylib"
  1982. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  1983. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  1984. FFSERVERLDFLAGS=-Wl,-bind_at_load
  1985. objformat="macho"
  1986. enabled x86_64 && objformat="macho64"
  1987. enabled_any pic shared ||
  1988. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  1989. ;;
  1990. mingw32*)
  1991. if test $target_os = "mingw32ce"; then
  1992. disable network
  1993. else
  1994. target_os=mingw32
  1995. fi
  1996. LIBTARGET=i386
  1997. if enabled x86_64; then
  1998. enable malloc_aligned
  1999. LIBTARGET=x64
  2000. elif enabled arm; then
  2001. LIBTARGET=arm
  2002. fi
  2003. shlibdir_default="$bindir_default"
  2004. disable ffserver
  2005. SLIBPREF=""
  2006. SLIBSUF=".dll"
  2007. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2008. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2009. SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  2010. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  2011. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
  2012. install -d "$(LIBDIR)"; \
  2013. install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
  2014. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  2015. 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'
  2016. objformat="win32"
  2017. enable dos_paths
  2018. check_cflags -fno-common
  2019. if ! enabled x86_64; then
  2020. check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2021. die "ERROR: MinGW runtime version must be >= 3.15."
  2022. enabled_any avisynth vfwcap_indev &&
  2023. { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
  2024. die "ERROR: avisynth and vfwcap_indev require w32api version 3.13 or later."; }
  2025. fi
  2026. ;;
  2027. cygwin*)
  2028. target_os=cygwin
  2029. shlibdir_default="$bindir_default"
  2030. SLIBPREF="cyg"
  2031. SLIBSUF=".dll"
  2032. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2033. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2034. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2035. objformat="win32"
  2036. enable dos_paths
  2037. check_cflags -fno-common
  2038. ;;
  2039. *-dos|freedos|opendos)
  2040. disable ffplay ffserver
  2041. disable $INDEV_LIST $OUTDEV_LIST
  2042. network_extralibs="-lsocket"
  2043. objformat="coff"
  2044. enable dos_paths
  2045. ;;
  2046. linux)
  2047. enable dv1394
  2048. ;;
  2049. irix*)
  2050. target_os=irix
  2051. ranlib="echo ignoring ranlib"
  2052. ;;
  2053. os/2*)
  2054. strip="lxlite"
  2055. ln_s="cp -f"
  2056. FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
  2057. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2058. FFSERVERLDFLAGS=""
  2059. LIBSUF="_s.a"
  2060. SLIBPREF=""
  2061. SLIBSUF=".dll"
  2062. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2063. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2064. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2065. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2066. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2067. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2068. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2069. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2070. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2071. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2072. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  2073. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  2074. enable dos_paths
  2075. ;;
  2076. gnu/kfreebsd)
  2077. ;;
  2078. gnu)
  2079. ;;
  2080. none)
  2081. ;;
  2082. *)
  2083. die "Unknown OS '$target_os'."
  2084. ;;
  2085. esac
  2086. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  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 strerror_r
  2276. check_func_headers io.h setmode
  2277. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2278. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2279. check_func_headers windows.h GetProcessTimes
  2280. check_func_headers windows.h VirtualAlloc
  2281. check_header conio.h
  2282. check_header dlfcn.h
  2283. check_header dxva2api.h
  2284. check_header malloc.h
  2285. check_header poll.h
  2286. check_header sys/mman.h
  2287. check_header sys/resource.h
  2288. check_header sys/select.h
  2289. check_header termios.h
  2290. check_header vdpau/vdpau.h
  2291. check_header vdpau/vdpau_x11.h
  2292. check_header X11/extensions/XvMClib.h
  2293. check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
  2294. if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
  2295. enabled_any $need_memalign ; then
  2296. die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  2297. fi
  2298. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2299. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2300. # check for some common methods of building with pthread support
  2301. # do this before the optional library checks as some of them require pthreads
  2302. if enabled pthreads; then
  2303. if check_func pthread_create; then
  2304. :
  2305. elif check_func pthread_create -pthread; then
  2306. add_cflags -pthread
  2307. add_extralibs -pthread
  2308. elif check_func pthread_create -pthreads; then
  2309. add_cflags -pthreads
  2310. add_extralibs -pthreads
  2311. elif check_func pthread_create -lpthreadGC2; then
  2312. add_extralibs -lpthreadGC2
  2313. elif ! check_lib pthread.h pthread_create -lpthread; then
  2314. die "ERROR: can't find pthreads library"
  2315. fi
  2316. fi
  2317. for thread in $THREADS_LIST; do
  2318. if enabled $thread; then
  2319. test -n "$thread_type" &&
  2320. die "ERROR: Only one thread type must be selected." ||
  2321. thread_type="$thread"
  2322. fi
  2323. done
  2324. check_lib math.h sin -lm
  2325. check_lib va/va.h vaInitialize -lva
  2326. check_mathfunc exp2
  2327. check_mathfunc exp2f
  2328. check_mathfunc llrint
  2329. check_mathfunc log2
  2330. check_mathfunc log2f
  2331. check_mathfunc lrint
  2332. check_mathfunc lrintf
  2333. check_mathfunc round
  2334. check_mathfunc roundf
  2335. check_mathfunc truncf
  2336. # these are off by default, so fail if requested and not available
  2337. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2338. enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
  2339. require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
  2340. require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
  2341. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2342. enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
  2343. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2344. enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
  2345. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2346. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
  2347. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
  2348. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2349. enabled librtmp && require librtmp librtmp/rtmp.h RTMP_Init -lrtmp
  2350. enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
  2351. require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
  2352. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2353. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2354. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2355. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 -lm &&
  2356. { check_cpp_condition x264.h "X264_BUILD >= 83" ||
  2357. die "ERROR: libx264 version must be >= 0.83."; }
  2358. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2359. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2360. # libdc1394 check
  2361. if enabled libdc1394; then
  2362. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2363. enable libdc1394_2; } ||
  2364. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2365. enable libdc1394_1; } ||
  2366. die "ERROR: No version of libdc1394 found "
  2367. fi
  2368. SDL_CONFIG="${cross_prefix}sdl-config"
  2369. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  2370. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  2371. sdl_libs=$("${SDL_CONFIG}" --libs)
  2372. check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
  2373. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2374. enable sdl &&
  2375. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2376. fi
  2377. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2378. if enabled network; then
  2379. check_type "sys/types.h sys/socket.h" socklen_t
  2380. check_type netdb.h "struct addrinfo"
  2381. check_type netinet/in.h "struct ipv6_mreq"
  2382. check_type netinet/in.h "struct sockaddr_in6"
  2383. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2384. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2385. # Prefer arpa/inet.h over winsock2
  2386. if check_header arpa/inet.h ; then
  2387. check_func closesocket
  2388. elif check_header winsock2.h ; then
  2389. check_func_headers winsock2.h closesocket -lws2 && \
  2390. network_extralibs="-lws2" || \
  2391. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2392. network_extralibs="-lws2_32"; }
  2393. check_type ws2tcpip.h socklen_t
  2394. check_type ws2tcpip.h "struct addrinfo"
  2395. check_type ws2tcpip.h "struct ipv6_mreq"
  2396. check_type ws2tcpip.h "struct sockaddr_in6"
  2397. check_type ws2tcpip.h "struct sockaddr_storage"
  2398. check_struct winsock2.h "struct sockaddr" sa_len
  2399. else
  2400. disable network
  2401. fi
  2402. fi
  2403. check_header linux/videodev.h
  2404. check_header linux/videodev2.h
  2405. check_header sys/videoio.h
  2406. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2407. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2408. { check_header dev/bktr/ioctl_meteor.h &&
  2409. check_header dev/bktr/ioctl_bt848.h; } ||
  2410. { check_header machine/ioctl_meteor.h &&
  2411. check_header machine/ioctl_bt848.h; } ||
  2412. { check_header dev/video/meteor/ioctl_meteor.h &&
  2413. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2414. check_header dev/ic/bt8xx.h
  2415. check_header sys/soundcard.h
  2416. check_header soundcard.h
  2417. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2418. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
  2419. enabled x11grab &&
  2420. check_header X11/Xlib.h &&
  2421. check_header X11/extensions/XShm.h &&
  2422. check_header X11/extensions/Xfixes.h &&
  2423. check_func XOpenDisplay -lX11 &&
  2424. check_func XShmCreateImage -lX11 -lXext &&
  2425. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2426. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2427. check_cpp_condition \
  2428. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2429. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2430. disable vdpau; }
  2431. fi
  2432. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2433. # add some useful compiler flags if supported
  2434. check_cflags -Wdeclaration-after-statement
  2435. check_cflags -Wall
  2436. check_cflags -Wno-switch
  2437. check_cflags -Wdisabled-optimization
  2438. check_cflags -Wpointer-arith
  2439. check_cflags -Wredundant-decls
  2440. check_cflags -Wno-pointer-sign
  2441. check_cflags -Wcast-qual
  2442. check_cflags -Wwrite-strings
  2443. check_cflags -Wtype-limits
  2444. check_cflags -Wundef
  2445. check_cflags -Wmissing-prototypes
  2446. enabled extra_warnings && check_cflags -Winline
  2447. # add some linker flags
  2448. check_ldflags -Wl,--warn-common
  2449. check_ldflags -Wl,--as-needed
  2450. 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'
  2451. check_ldflags -Wl,-Bsymbolic
  2452. echo "X{};" > $TMPV
  2453. test_ldflags -Wl,--version-script,$TMPV &&
  2454. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2455. if enabled small; then
  2456. add_cflags $size_cflags
  2457. optimizations="small"
  2458. elif enabled optimizations; then
  2459. add_cflags $speed_cflags
  2460. fi
  2461. check_cflags -fno-math-errno
  2462. check_cflags -fno-signed-zeros
  2463. if enabled icc; then
  2464. # Just warnings, no remarks
  2465. check_cflags -w1
  2466. # -wd: Disable following warnings
  2467. # 144, 167, 556: -Wno-pointer-sign
  2468. # 10006: ignoring unknown option -fno-signed-zeros
  2469. # 10156: ignoring option '-W'; no argument required
  2470. check_cflags -wd144,167,556,10006,10156
  2471. # 11030: Warning unknown option --as-needed
  2472. # 10156: ignoring option '-export'; no argument required
  2473. check_ldflags -wd10156,11030
  2474. # Allow to compile with optimizations
  2475. check_ldflags -march=$cpu
  2476. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2477. enable ebp_available
  2478. elif enabled ccc; then
  2479. # disable some annoying warnings
  2480. add_cflags -msg_disable cvtu32to64
  2481. add_cflags -msg_disable embedcomment
  2482. add_cflags -msg_disable needconstext
  2483. add_cflags -msg_disable nomainieee
  2484. add_cflags -msg_disable ptrmismatch1
  2485. add_cflags -msg_disable unreachcode
  2486. elif enabled gcc; then
  2487. check_cflags -fno-tree-vectorize
  2488. check_cflags -Werror=implicit
  2489. check_cflags -Werror=missing-prototypes
  2490. elif enabled clang; then
  2491. check_cflags -Qunused-arguments
  2492. elif enabled armcc; then
  2493. # 2523: use of inline assembler is deprecated
  2494. add_cflags -Wrvct,--diag_suppress=2523
  2495. add_cflags -Wrvct,--diag_suppress=1207
  2496. elif enabled tms470; then
  2497. add_cflags -pds=824 -pds=837
  2498. fi
  2499. if enabled gprof; then
  2500. add_cflags -p
  2501. add_ldflags -p
  2502. fi
  2503. # Find out if the .align argument is a power of two or not.
  2504. check_asm asmalign_pot '".align 3"'
  2505. enabled_any $DECODER_LIST && enable decoders
  2506. enabled_any $ENCODER_LIST && enable encoders
  2507. enabled_any $HWACCEL_LIST && enable hwaccels
  2508. enabled_any $BSF_LIST && enable bsfs
  2509. enabled_any $DEMUXER_LIST && enable demuxers
  2510. enabled_any $MUXER_LIST && enable muxers
  2511. enabled_any $FILTER_LIST && enable filters
  2512. enabled_any $INDEV_LIST && enable indevs
  2513. enabled_any $OUTDEV_LIST && enable outdevs
  2514. enabled_any $PROTOCOL_LIST && enable protocols
  2515. enabled_any $THREADS_LIST && enable threads
  2516. check_deps $CONFIG_LIST \
  2517. $CONFIG_EXTRA \
  2518. $HAVE_LIST \
  2519. $DECODER_LIST \
  2520. $ENCODER_LIST \
  2521. $HWACCEL_LIST \
  2522. $PARSER_LIST \
  2523. $BSF_LIST \
  2524. $DEMUXER_LIST \
  2525. $MUXER_LIST \
  2526. $FILTER_LIST \
  2527. $INDEV_LIST \
  2528. $OUTDEV_LIST \
  2529. $PROTOCOL_LIST \
  2530. enabled asm || disable $ARCH_LIST $ARCH_EXT_LIST
  2531. echo "install prefix $prefix"
  2532. echo "source path $source_path"
  2533. echo "C compiler $cc"
  2534. echo ".align is power-of-two $asmalign_pot"
  2535. echo "ARCH $arch ($cpu)"
  2536. if test "$build_suffix" != ""; then
  2537. echo "build suffix $build_suffix"
  2538. fi
  2539. if test "$extra_version" != ""; then
  2540. echo "version string suffix $extra_version"
  2541. fi
  2542. echo "big-endian ${bigendian-no}"
  2543. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2544. if enabled x86; then
  2545. echo "yasm ${yasm-no}"
  2546. echo "MMX enabled ${mmx-no}"
  2547. echo "MMX2 enabled ${mmx2-no}"
  2548. echo "3DNow! enabled ${amd3dnow-no}"
  2549. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2550. echo "SSE enabled ${sse-no}"
  2551. echo "SSSE3 enabled ${ssse3-no}"
  2552. echo "CMOV enabled ${cmov-no}"
  2553. echo "CMOV is fast ${fast_cmov-no}"
  2554. echo "EBX available ${ebx_available-no}"
  2555. echo "EBP available ${ebp_available-no}"
  2556. echo "10 operands supported ${ten_operands-no}"
  2557. fi
  2558. if enabled arm; then
  2559. echo "ARMv5TE enabled ${armv5te-no}"
  2560. echo "ARMv6 enabled ${armv6-no}"
  2561. echo "ARMv6T2 enabled ${armv6t2-no}"
  2562. echo "ARM VFP enabled ${armvfp-no}"
  2563. echo "IWMMXT enabled ${iwmmxt-no}"
  2564. echo "NEON enabled ${neon-no}"
  2565. fi
  2566. if enabled mips; then
  2567. echo "MMI enabled ${mmi-no}"
  2568. fi
  2569. if enabled ppc; then
  2570. echo "AltiVec enabled ${altivec-no}"
  2571. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2572. echo "dcbzl available ${dcbzl-no}"
  2573. echo "performance report ${powerpc_perf-no}"
  2574. fi
  2575. if enabled sparc; then
  2576. echo "VIS enabled ${vis-no}"
  2577. fi
  2578. echo "gprof enabled ${gprof-no}"
  2579. echo "debug symbols ${debug-no}"
  2580. echo "strip symbols ${stripping-no}"
  2581. echo "optimizations ${optimizations-no}"
  2582. echo "static ${static-no}"
  2583. echo "shared ${shared-no}"
  2584. echo "postprocessing support ${postproc-no}"
  2585. echo "new filter support ${avfilter-no}"
  2586. echo "filters using lavformat ${avfilter_lavf-no}"
  2587. echo "network support ${network-no}"
  2588. echo "threading support ${thread_type-no}"
  2589. echo "SDL support ${sdl-no}"
  2590. echo "Sun medialib support ${mlib-no}"
  2591. echo "AVISynth enabled ${avisynth-no}"
  2592. echo "libdc1394 support ${libdc1394-no}"
  2593. echo "libdirac enabled ${libdirac-no}"
  2594. echo "libfaac enabled ${libfaac-no}"
  2595. echo "libfaad enabled ${libfaad-no}"
  2596. echo "libfaad dlopened ${libfaadbin-no}"
  2597. echo "libgsm enabled ${libgsm-no}"
  2598. echo "libmp3lame enabled ${libmp3lame-no}"
  2599. echo "libnut enabled ${libnut-no}"
  2600. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  2601. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  2602. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2603. echo "librtmp enabled ${librtmp-no}"
  2604. echo "libschroedinger enabled ${libschroedinger-no}"
  2605. echo "libspeex enabled ${libspeex-no}"
  2606. echo "libtheora enabled ${libtheora-no}"
  2607. echo "libvorbis enabled ${libvorbis-no}"
  2608. echo "libx264 enabled ${libx264-no}"
  2609. echo "libxvid enabled ${libxvid-no}"
  2610. echo "zlib enabled ${zlib-no}"
  2611. echo "bzlib enabled ${bzlib-no}"
  2612. echo
  2613. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  2614. echo "Enabled ${type}s:"
  2615. eval list=\$$(toupper $type)_LIST
  2616. for part in $list; do
  2617. enabled $part && echo ${part%_*}
  2618. done | sort | pr -3 -t
  2619. echo
  2620. done
  2621. license="LGPL version 2.1 or later"
  2622. if enabled nonfree; then
  2623. license="nonfree and unredistributable"
  2624. elif enabled gplv3; then
  2625. license="GPL version 3 or later"
  2626. elif enabled lgplv3; then
  2627. license="LGPL version 3 or later"
  2628. elif enabled gpl; then
  2629. license="GPL version 2 or later"
  2630. fi
  2631. echo "License: $license"
  2632. echo "Creating config.mak and config.h..."
  2633. # build tree in object directory if source path is different from current one
  2634. if enabled source_path_used; then
  2635. DIRS="
  2636. doc
  2637. libavcodec
  2638. libavcodec/$arch
  2639. libavdevice
  2640. libavfilter
  2641. libavformat
  2642. libavutil
  2643. libavutil/$arch
  2644. libpostproc
  2645. libswscale
  2646. libswscale/$arch
  2647. tests
  2648. tools
  2649. "
  2650. FILES="
  2651. Makefile
  2652. common.mak
  2653. subdir.mak
  2654. doc/texi2pod.pl
  2655. libavcodec/Makefile
  2656. libavcodec/${arch}/Makefile
  2657. libavdevice/Makefile
  2658. libavfilter/Makefile
  2659. libavformat/Makefile
  2660. libavutil/Makefile
  2661. libpostproc/Makefile
  2662. libswscale/Makefile
  2663. "
  2664. map 'mkdir -p $v' $DIRS;
  2665. map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES
  2666. fi
  2667. enabled stripping || strip="echo skipping strip"
  2668. cat > config.mak <<EOF
  2669. # Automatically generated by configure - do not modify!
  2670. ifndef FFMPEG_CONFIG_MAK
  2671. FFMPEG_CONFIG_MAK=1
  2672. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  2673. prefix=$prefix
  2674. LIBDIR=\$(DESTDIR)$libdir
  2675. SHLIBDIR=\$(DESTDIR)$shlibdir
  2676. INCDIR=\$(DESTDIR)$incdir
  2677. BINDIR=\$(DESTDIR)$bindir
  2678. DATADIR=\$(DESTDIR)$datadir
  2679. MANDIR=\$(DESTDIR)$mandir
  2680. SRC_PATH="$source_path"
  2681. SRC_PATH_BARE=$source_path
  2682. BUILD_ROOT="$PWD"
  2683. ARCH=$arch
  2684. CC=$cc
  2685. AS=$as
  2686. LD=$ld
  2687. DEPCC=$dep_cc
  2688. YASM=$yasmexe
  2689. YASMDEP=$yasmexe
  2690. AR=$ar
  2691. RANLIB=$ranlib
  2692. CP=cp -p
  2693. LN_S=$ln_s
  2694. STRIP=$strip
  2695. CPPFLAGS=$CPPFLAGS
  2696. CFLAGS=$CFLAGS
  2697. ASFLAGS=$ASFLAGS
  2698. CC_O=$CC_O
  2699. LDFLAGS=$LDFLAGS
  2700. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  2701. SHFLAGS=$SHFLAGS
  2702. YASMFLAGS=$YASMFLAGS
  2703. BUILDSUF=$build_suffix
  2704. FULLNAME=$FULLNAME
  2705. LIBPREF=$LIBPREF
  2706. LIBSUF=$LIBSUF
  2707. LIBNAME=$LIBNAME
  2708. SLIBPREF=$SLIBPREF
  2709. SLIBSUF=$SLIBSUF
  2710. EXESUF=$EXESUF
  2711. EXTRA_VERSION=$extra_version
  2712. DEPFLAGS=$DEPFLAGS
  2713. CCDEP=$CCDEP
  2714. ASDEP=$ASDEP
  2715. CC_DEPFLAGS=$CC_DEPFLAGS
  2716. AS_DEPFLAGS=$AS_DEPFLAGS
  2717. HOSTCC=$host_cc
  2718. HOSTCFLAGS=$host_cflags
  2719. HOSTEXESUF=$HOSTEXESUF
  2720. HOSTLDFLAGS=$host_ldflags
  2721. HOSTLIBS=$host_libs
  2722. TARGET_EXEC=$target_exec
  2723. TARGET_PATH=$target_path
  2724. SDL_LIBS=$sdl_libs
  2725. SDL_CFLAGS=$sdl_cflags
  2726. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  2727. EXTRALIBS=$extralibs
  2728. INSTALL=install
  2729. LIBTARGET=${LIBTARGET}
  2730. SLIBNAME=${SLIBNAME}
  2731. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  2732. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  2733. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  2734. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  2735. SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
  2736. SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
  2737. SAMPLES=$samples
  2738. EOF
  2739. get_version(){
  2740. name=$1
  2741. file=$source_path/$2
  2742. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2743. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2744. lcname=$(tolower $name)
  2745. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2746. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2747. }
  2748. get_version LIBSWSCALE libswscale/swscale.h
  2749. get_version LIBPOSTPROC libpostproc/postprocess.h
  2750. get_version LIBAVCODEC libavcodec/avcodec.h
  2751. get_version LIBAVDEVICE libavdevice/avdevice.h
  2752. get_version LIBAVFORMAT libavformat/avformat.h
  2753. get_version LIBAVUTIL libavutil/avutil.h
  2754. get_version LIBAVFILTER libavfilter/avfilter.h
  2755. enabled asmalign_pot || align_shift="1 <<"
  2756. cat > $TMPH <<EOF
  2757. /* Automatically generated by configure - do not modify! */
  2758. #ifndef FFMPEG_CONFIG_H
  2759. #define FFMPEG_CONFIG_H
  2760. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  2761. #define FFMPEG_LICENSE "$(c_escape $license)"
  2762. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  2763. #define CC_TYPE "$cc_type"
  2764. #define CC_VERSION $cc_version
  2765. #define restrict $_restrict
  2766. #define ASMALIGN(ZEROBITS) ".align $align_shift " #ZEROBITS "\\n\\t"
  2767. #define EXTERN_PREFIX "${extern_prefix}"
  2768. #define EXTERN_ASM ${extern_prefix}
  2769. EOF
  2770. test -n "$malloc_prefix" &&
  2771. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  2772. if enabled small || disabled optimizations; then
  2773. echo "#undef av_always_inline" >> $TMPH
  2774. echo "#define av_always_inline" >> $TMPH
  2775. fi
  2776. print_config ARCH_ $TMPH config.mak $ARCH_LIST
  2777. print_config HAVE_ $TMPH config.mak $HAVE_LIST
  2778. print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
  2779. $CONFIG_EXTRA \
  2780. $DECODER_LIST \
  2781. $ENCODER_LIST \
  2782. $HWACCEL_LIST \
  2783. $PARSER_LIST \
  2784. $BSF_LIST \
  2785. $DEMUXER_LIST \
  2786. $MUXER_LIST \
  2787. $FILTER_LIST \
  2788. $PROTOCOL_LIST \
  2789. $INDEV_LIST \
  2790. $OUTDEV_LIST \
  2791. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  2792. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  2793. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  2794. cp_if_changed $TMPH config.h
  2795. cat > $TMPH <<EOF
  2796. /* Generated by ffconf */
  2797. #ifndef AVUTIL_AVCONFIG_H
  2798. #define AVUTIL_AVCONFIG_H
  2799. EOF
  2800. print_config AV_HAVE_ $TMPH /dev/null $HAVE_LIST_PUB
  2801. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  2802. cp_if_changed $TMPH libavutil/avconfig.h
  2803. # build pkg-config files
  2804. pkgconfig_generate(){
  2805. name=$1
  2806. shortname=${name#lib}${build_suffix}
  2807. comment=$2
  2808. version=$3
  2809. libs=$4
  2810. requires=$5
  2811. cat <<EOF > $name/$name.pc
  2812. prefix=$prefix
  2813. exec_prefix=\${prefix}
  2814. libdir=$libdir
  2815. includedir=$incdir
  2816. Name: $name
  2817. Description: $comment
  2818. Version: $version
  2819. Requires: $(enabled shared || echo $requires)
  2820. Requires.private: $(enabled shared && echo $requires)
  2821. Conflicts:
  2822. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  2823. Libs.private: $(enabled shared && echo $libs)
  2824. Cflags: -I\${includedir}
  2825. EOF
  2826. cat <<EOF > $name/$name-uninstalled.pc
  2827. prefix=
  2828. exec_prefix=
  2829. libdir=\${pcfiledir}
  2830. includedir=${source_path}
  2831. Name: $name
  2832. Description: $comment
  2833. Version: $version
  2834. Requires: $requires
  2835. Conflicts:
  2836. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  2837. Cflags: -I\${includedir}
  2838. EOF
  2839. }
  2840. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
  2841. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2842. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  2843. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  2844. enabled avfilter &&
  2845. pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
  2846. enabled postproc &&
  2847. pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
  2848. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"