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.

3132 lines
87KB

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