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.

3424 lines
100KB

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