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.

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