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.

3164 lines
89KB

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