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.

3103 lines
87KB

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