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.

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