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.

3423 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. sinewin
  857. small
  858. sram
  859. static
  860. swscale
  861. swscale_alpha
  862. vaapi
  863. vdpau
  864. version3
  865. x11grab
  866. zlib
  867. "
  868. THREADS_LIST='
  869. pthreads
  870. w32threads
  871. '
  872. ARCH_LIST='
  873. alpha
  874. arm
  875. avr32
  876. avr32_ap
  877. avr32_uc
  878. bfin
  879. ia64
  880. m68k
  881. mips
  882. mips64
  883. parisc
  884. ppc
  885. ppc64
  886. s390
  887. sh4
  888. sparc
  889. sparc64
  890. tomi
  891. x86
  892. x86_32
  893. x86_64
  894. '
  895. ARCH_EXT_LIST='
  896. altivec
  897. amd3dnow
  898. amd3dnowext
  899. armv5te
  900. armv6
  901. armv6t2
  902. armvfp
  903. avx
  904. iwmmxt
  905. mmi
  906. mmx
  907. mmx2
  908. neon
  909. ppc4xx
  910. sse
  911. ssse3
  912. vis
  913. '
  914. HAVE_LIST_PUB='
  915. bigendian
  916. fast_unaligned
  917. '
  918. HAVE_LIST="
  919. $ARCH_EXT_LIST
  920. $HAVE_LIST_PUB
  921. $THREADS_LIST
  922. aligned_stack
  923. alsa_asoundlib_h
  924. altivec_h
  925. arpa_inet_h
  926. attribute_may_alias
  927. attribute_packed
  928. bswap
  929. closesocket
  930. cmov
  931. conio_h
  932. dcbzl
  933. dev_bktr_ioctl_bt848_h
  934. dev_bktr_ioctl_meteor_h
  935. dev_ic_bt8xx_h
  936. dev_video_meteor_ioctl_meteor_h
  937. dev_video_bktr_ioctl_bt848_h
  938. dlfcn_h
  939. dlopen
  940. dos_paths
  941. ebp_available
  942. ebx_available
  943. exp2
  944. exp2f
  945. fast_64bit
  946. fast_clz
  947. fast_cmov
  948. fcntl
  949. fork
  950. getaddrinfo
  951. gethrtime
  952. GetProcessMemoryInfo
  953. GetProcessTimes
  954. getrusage
  955. gnu_as
  956. struct_rusage_ru_maxrss
  957. ibm_asm
  958. inet_aton
  959. inline_asm
  960. isatty
  961. ldbrx
  962. libdc1394_1
  963. libdc1394_2
  964. llrint
  965. llrintf
  966. local_aligned_16
  967. local_aligned_8
  968. log2
  969. log2f
  970. loongson
  971. lrint
  972. lrintf
  973. lzo1x_999_compress
  974. machine_ioctl_bt848_h
  975. machine_ioctl_meteor_h
  976. malloc_h
  977. MapViewOfFile
  978. memalign
  979. mkstemp
  980. mmap
  981. pld
  982. posix_memalign
  983. round
  984. roundf
  985. sdl
  986. sdl_video_size
  987. setmode
  988. socklen_t
  989. soundcard_h
  990. poll_h
  991. setrlimit
  992. strerror_r
  993. strtok_r
  994. struct_addrinfo
  995. struct_ipv6_mreq
  996. struct_sockaddr_in6
  997. struct_sockaddr_sa_len
  998. struct_sockaddr_storage
  999. symver
  1000. symver_gnu_asm
  1001. symver_asm_label
  1002. sys_mman_h
  1003. sys_resource_h
  1004. sys_select_h
  1005. sys_soundcard_h
  1006. sys_videoio_h
  1007. ten_operands
  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 sinewin"
  1112. aac_encoder_select="mdct sinewin"
  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 sinewin"
  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 sinewin"
  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 sinewin"
  1185. nellymoser_encoder_select="mdct sinewin"
  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. svq1_encoder_select="aandct"
  1202. svq3_decoder_select="golomb h264dsp h264pred"
  1203. svq3_decoder_suggest="zlib"
  1204. theora_decoder_select="vp3_decoder"
  1205. tiff_decoder_suggest="zlib"
  1206. tiff_encoder_suggest="zlib"
  1207. truehd_decoder_select="mlp_decoder"
  1208. tscc_decoder_select="zlib"
  1209. twinvq_decoder_select="mdct lsp sinewin"
  1210. vc1_decoder_select="h263_decoder"
  1211. vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
  1212. vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
  1213. vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
  1214. vc1_vdpau_decoder_select="vdpau vc1_decoder"
  1215. vorbis_decoder_select="mdct"
  1216. vorbis_encoder_select="mdct"
  1217. vp6_decoder_select="huffman"
  1218. vp6a_decoder_select="vp6_decoder"
  1219. vp6f_decoder_select="vp6_decoder"
  1220. vp8_decoder_select="h264pred"
  1221. wmapro_decoder_select="mdct sinewin"
  1222. wmav1_decoder_select="mdct sinewin"
  1223. wmav1_encoder_select="mdct sinewin"
  1224. wmav2_decoder_select="mdct sinewin"
  1225. wmav2_encoder_select="mdct sinewin"
  1226. wmavoice_decoder_select="lsp rdft dct mdct sinewin"
  1227. wmv1_decoder_select="h263_decoder"
  1228. wmv1_encoder_select="h263_encoder"
  1229. wmv2_decoder_select="h263_decoder"
  1230. wmv2_encoder_select="h263_encoder"
  1231. wmv3_decoder_select="vc1_decoder"
  1232. wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
  1233. wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
  1234. wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
  1235. zlib_decoder_select="zlib"
  1236. zlib_encoder_select="zlib"
  1237. zmbv_decoder_select="zlib"
  1238. zmbv_encoder_select="zlib"
  1239. vaapi_deps="va_va_h"
  1240. vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
  1241. # parsers
  1242. h264_parser_select="golomb h264dsp h264pred"
  1243. # external libraries
  1244. libdirac_decoder_deps="libdirac !libschroedinger"
  1245. libdirac_encoder_deps="libdirac"
  1246. libfaac_encoder_deps="libfaac"
  1247. libgsm_decoder_deps="libgsm"
  1248. libgsm_encoder_deps="libgsm"
  1249. libgsm_ms_decoder_deps="libgsm"
  1250. libgsm_ms_encoder_deps="libgsm"
  1251. libmp3lame_encoder_deps="libmp3lame"
  1252. libopencore_amrnb_decoder_deps="libopencore_amrnb"
  1253. libopencore_amrnb_encoder_deps="libopencore_amrnb"
  1254. libopencore_amrwb_decoder_deps="libopencore_amrwb"
  1255. libopenjpeg_decoder_deps="libopenjpeg"
  1256. libschroedinger_decoder_deps="libschroedinger"
  1257. libschroedinger_encoder_deps="libschroedinger"
  1258. libspeex_decoder_deps="libspeex"
  1259. libtheora_encoder_deps="libtheora"
  1260. libvorbis_encoder_deps="libvorbis"
  1261. libvpx_decoder_deps="libvpx"
  1262. libvpx_encoder_deps="libvpx"
  1263. libx264_encoder_deps="libx264"
  1264. libxavs_encoder_deps="libxavs"
  1265. libxvid_encoder_deps="libxvid"
  1266. # demuxers / muxers
  1267. ac3_demuxer_select="ac3_parser"
  1268. asf_stream_muxer_select="asf_muxer"
  1269. avisynth_demuxer_deps="avisynth"
  1270. dirac_demuxer_select="dirac_parser"
  1271. eac3_demuxer_select="ac3_parser"
  1272. flac_demuxer_select="flac_parser"
  1273. ipod_muxer_select="mov_muxer"
  1274. libnut_demuxer_deps="libnut"
  1275. libnut_muxer_deps="libnut"
  1276. matroska_audio_muxer_select="matroska_muxer"
  1277. matroska_demuxer_suggest="zlib bzlib"
  1278. mov_demuxer_suggest="zlib"
  1279. mp3_demuxer_select="mpegaudio_parser"
  1280. mp4_muxer_select="mov_muxer"
  1281. mpegtsraw_demuxer_select="mpegts_demuxer"
  1282. mxf_d10_muxer_select="mxf_muxer"
  1283. ogg_demuxer_select="golomb"
  1284. psp_muxer_select="mov_muxer"
  1285. rtp_demuxer_select="sdp_demuxer"
  1286. rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
  1287. rtsp_demuxer_select="http_protocol rtpdec"
  1288. rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol"
  1289. sap_demuxer_select="sdp_demuxer"
  1290. sap_muxer_select="rtp_muxer rtp_protocol"
  1291. sdp_demuxer_select="rtpdec"
  1292. spdif_muxer_select="aac_parser"
  1293. tg2_muxer_select="mov_muxer"
  1294. tgp_muxer_select="mov_muxer"
  1295. w64_demuxer_deps="wav_demuxer"
  1296. # indevs / outdevs
  1297. alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
  1298. alsa_outdev_deps="alsa_asoundlib_h"
  1299. bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
  1300. dv1394_indev_deps="dv1394 dv_demuxer"
  1301. jack_indev_deps="jack_jack_h"
  1302. libdc1394_indev_deps="libdc1394"
  1303. oss_indev_deps_any="soundcard_h sys_soundcard_h"
  1304. oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  1305. v4l_indev_deps="linux_videodev_h"
  1306. v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
  1307. vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
  1308. vfwcap_indev_extralibs="-lavicap32"
  1309. x11_grab_device_indev_deps="x11grab XShmCreateImage"
  1310. x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
  1311. # protocols
  1312. gopher_protocol_deps="network"
  1313. http_protocol_deps="network"
  1314. http_protocol_select="tcp_protocol"
  1315. mmsh_protocol_select="http_protocol"
  1316. mmst_protocol_deps="network"
  1317. rtmp_protocol_select="tcp_protocol"
  1318. rtp_protocol_select="udp_protocol"
  1319. tcp_protocol_deps="network"
  1320. udp_protocol_deps="network"
  1321. # filters
  1322. blackframe_filter_deps="gpl"
  1323. cropdetect_filter_deps="gpl"
  1324. frei0r_filter_deps="frei0r dlopen strtok_r"
  1325. frei0r_src_filter_deps="frei0r dlopen strtok_r"
  1326. hqdn3d_filter_deps="gpl"
  1327. scale_filter_deps="swscale"
  1328. ocv_filter_deps="libopencv"
  1329. yadif_filter_deps="gpl"
  1330. # libraries
  1331. avdevice_deps="avcodec avformat"
  1332. avformat_deps="avcodec"
  1333. # programs
  1334. ffmpeg_deps="avcodec avformat swscale"
  1335. ffmpeg_select="buffer_filter"
  1336. ffplay_deps="avcodec avformat swscale sdl"
  1337. ffplay_select="rdft"
  1338. ffprobe_deps="avcodec avformat"
  1339. ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer"
  1340. ffserver_extralibs='$ldl'
  1341. doc_deps="texi2html"
  1342. # tests
  1343. test_deps(){
  1344. suf1=$1
  1345. suf2=$2
  1346. shift 2
  1347. for v; do
  1348. dep=${v%=*}
  1349. tests=${v#*=}
  1350. for name in ${tests}; do
  1351. eval ${name}_test_deps="'${dep}$suf1 ${dep}$suf2'"
  1352. done
  1353. done
  1354. }
  1355. set_ne_test_deps(){
  1356. eval ${1}_be_test_deps="bigendian"
  1357. eval ${1}_le_test_deps="!bigendian"
  1358. }
  1359. test_deps _encoder _decoder \
  1360. adpcm_g726=g726 \
  1361. adpcm_ima_qt \
  1362. adpcm_ima_wav \
  1363. adpcm_ms \
  1364. adpcm_swf \
  1365. adpcm_yamaha=adpcm_yam \
  1366. alac \
  1367. asv1 \
  1368. asv2 \
  1369. bmp \
  1370. dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \
  1371. dvvideo="dv dv50" \
  1372. ffv1 \
  1373. flac \
  1374. flashsv \
  1375. flv \
  1376. gif \
  1377. h261 \
  1378. h263="h263 h263p" \
  1379. huffyuv \
  1380. jpegls \
  1381. mjpeg="jpg mjpeg ljpeg" \
  1382. mp2 \
  1383. mpeg1video="mpeg mpeg1b" \
  1384. mpeg2video="mpeg2 mpeg2thread" \
  1385. mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc" \
  1386. msmpeg4v3=msmpeg4 \
  1387. msmpeg4v2 \
  1388. pbm=pbmpipe \
  1389. pcx \
  1390. pgm="pgm pgmpipe" \
  1391. png \
  1392. ppm="ppm ppmpipe" \
  1393. rawvideo="rgb yuv" \
  1394. roq \
  1395. rv10 \
  1396. rv20 \
  1397. sgi \
  1398. snow="snow snowll" \
  1399. svq1 \
  1400. targa=tga \
  1401. tiff \
  1402. wmav1 \
  1403. wmav2 \
  1404. wmv1 \
  1405. wmv2 \
  1406. test_deps _muxer _demuxer \
  1407. aiff \
  1408. pcm_alaw=alaw \
  1409. asf \
  1410. au \
  1411. avi \
  1412. dv=dv_fmt \
  1413. ffm \
  1414. flv=flv_fmt \
  1415. gxf \
  1416. matroska=mkv \
  1417. mmf \
  1418. mov \
  1419. pcm_mulaw=mulaw \
  1420. mxf \
  1421. nut \
  1422. ogg \
  1423. rawvideo=pixfmt \
  1424. rm \
  1425. swf \
  1426. mpegts=ts \
  1427. voc \
  1428. wav \
  1429. yuv4mpegpipe=yuv4mpeg \
  1430. ac3_fixed_test_deps="ac3_fixed_encoder ac3_decoder rm_muxer rm_demuxer"
  1431. mpg_test_deps="mpeg1system_muxer mpegps_demuxer"
  1432. set_ne_test_deps pixdesc
  1433. set_ne_test_deps pixfmts_copy
  1434. set_ne_test_deps pixfmts_crop
  1435. set_ne_test_deps pixfmts_hflip
  1436. set_ne_test_deps pixfmts_null
  1437. set_ne_test_deps pixfmts_pad
  1438. set_ne_test_deps pixfmts_scale
  1439. set_ne_test_deps pixfmts_vflip
  1440. # default parameters
  1441. logfile="config.log"
  1442. # installation paths
  1443. prefix_default="/usr/local"
  1444. bindir_default='${prefix}/bin'
  1445. datadir_default='${prefix}/share/ffmpeg'
  1446. incdir_default='${prefix}/include'
  1447. libdir_default='${prefix}/lib'
  1448. mandir_default='${prefix}/share/man'
  1449. shlibdir_default="$libdir_default"
  1450. # toolchain
  1451. ar_default="ar"
  1452. cc_default="gcc"
  1453. cc_version=\"unknown\"
  1454. host_cc_default="gcc"
  1455. ln_s="ln -sf"
  1456. nm_default="nm"
  1457. objformat="elf"
  1458. pkg_config_default=pkg-config
  1459. ranlib="ranlib"
  1460. strip_default="strip"
  1461. yasmexe="yasm"
  1462. nogas=":"
  1463. nm_opts='-g'
  1464. # machine
  1465. arch_default=$(uname -m)
  1466. cpu="generic"
  1467. # OS
  1468. target_os_default=$(tolower $(uname -s))
  1469. host_os=$target_os_default
  1470. # configurable options
  1471. enable avcodec
  1472. enable avdevice
  1473. enable avfilter
  1474. enable avformat
  1475. enable avutil
  1476. enable asm
  1477. enable debug
  1478. enable doc
  1479. enable fastdiv
  1480. enable ffmpeg
  1481. enable ffplay
  1482. enable ffprobe
  1483. enable ffserver
  1484. enable mpegaudio_hp
  1485. enable network
  1486. enable optimizations
  1487. enable protocols
  1488. enable static
  1489. enable stripping
  1490. enable swscale
  1491. enable swscale_alpha
  1492. # build settings
  1493. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  1494. FFSERVERLDFLAGS=-Wl,-E
  1495. LIBPREF="lib"
  1496. LIBSUF=".a"
  1497. FULLNAME='$(NAME)$(BUILDSUF)'
  1498. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  1499. SLIBPREF="lib"
  1500. SLIBSUF=".so"
  1501. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  1502. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  1503. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  1504. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  1505. CC_O='-o $@'
  1506. host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
  1507. host_libs='-lm'
  1508. target_path='$(CURDIR)'
  1509. # since the object filename is not given with the -MM flag, the compiler
  1510. # is only able to print the basename, and we must add the path ourselves
  1511. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  1512. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
  1513. # find source path
  1514. source_path="$(dirname "$0")"
  1515. enable source_path_used
  1516. if test -f configure; then
  1517. source_path="$(pwd)"
  1518. disable source_path_used
  1519. else
  1520. source_path="$(cd "$source_path"; pwd)"
  1521. echo "$source_path" | grep -q '[[:blank:]]' &&
  1522. die "Out of tree builds are impossible with whitespace in source path."
  1523. test -e "$source_path/config.h" &&
  1524. die "Out of tree builds are impossible with config.h in source dir."
  1525. fi
  1526. for v in "$@"; do
  1527. r=${v#*=}
  1528. l=${v%"$r"}
  1529. r=$(sh_quote "$r")
  1530. LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
  1531. done
  1532. find_things(){
  1533. thing=$1
  1534. pattern=$2
  1535. file=$source_path/$3
  1536. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  1537. }
  1538. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  1539. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  1540. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  1541. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  1542. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  1543. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  1544. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  1545. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  1546. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  1547. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  1548. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  1549. find_tests(){
  1550. map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]')
  1551. }
  1552. ACODEC_TESTS=$(find_tests acodec)
  1553. VCODEC_TESTS=$(find_tests vsynth1)
  1554. LAVF_TESTS=$(find_tests lavf)
  1555. LAVFI_TESTS=$(find_tests lavfi)
  1556. SEEK_TESTS=$(find_tests seek seek_)
  1557. pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST))
  1558. for n in $COMPONENT_LIST; do
  1559. v=$(toupper ${n%s})_LIST
  1560. eval enable \$$v
  1561. eval ${n}_if_any="\$$v"
  1562. done
  1563. enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS
  1564. die_unknown(){
  1565. echo "Unknown option \"$1\"."
  1566. echo "See $0 --help for available options."
  1567. exit 1
  1568. }
  1569. show_list() {
  1570. suffix=_$1
  1571. shift
  1572. echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
  1573. exit 0
  1574. }
  1575. for opt do
  1576. optval="${opt#*=}"
  1577. case "$opt" in
  1578. --extra-ldflags=*) add_ldflags $optval
  1579. ;;
  1580. --extra-libs=*) add_extralibs $optval
  1581. ;;
  1582. --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
  1583. ;;
  1584. --enable-debug=*) debuglevel="$optval"
  1585. ;;
  1586. --disable-everything)
  1587. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  1588. ;;
  1589. --enable-*=*|--disable-*=*)
  1590. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  1591. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  1592. eval list=\$$(toupper $thing)_LIST
  1593. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  1594. $action $(filter "$name" $list)
  1595. ;;
  1596. --enable-?*|--disable-?*)
  1597. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  1598. if is_in $option $COMPONENT_LIST; then
  1599. test $action = disable && action=unset
  1600. eval $action \$$(toupper ${option%s})_LIST
  1601. elif is_in $option $CMDLINE_SELECT; then
  1602. $action $option
  1603. else
  1604. die_unknown $opt
  1605. fi
  1606. ;;
  1607. --list-*)
  1608. NAME="${opt#--list-}"
  1609. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  1610. NAME=${NAME%s}
  1611. eval show_list $NAME \$$(toupper $NAME)_LIST
  1612. ;;
  1613. --help|-h) show_help
  1614. ;;
  1615. *)
  1616. optname="${opt%%=*}"
  1617. optname="${optname#--}"
  1618. optname=$(echo "$optname" | sed 's/-/_/g')
  1619. if is_in $optname $CMDLINE_SET; then
  1620. eval $optname='$optval'
  1621. elif is_in $optname $CMDLINE_APPEND; then
  1622. append $optname "$optval"
  1623. else
  1624. die_unknown $opt
  1625. fi
  1626. ;;
  1627. esac
  1628. done
  1629. disabled logging && logfile=/dev/null
  1630. echo "# $0 $LIBAV_CONFIGURATION" > $logfile
  1631. set >> $logfile
  1632. test -n "$cross_prefix" && enable cross_compile
  1633. if enabled cross_compile; then
  1634. test -n "$arch" && test -n "$target_os" ||
  1635. die "Must specify target arch and OS when cross-compiling"
  1636. fi
  1637. set_default arch target_os
  1638. ar_default="${cross_prefix}${ar_default}"
  1639. cc_default="${cross_prefix}${cc_default}"
  1640. nm_default="${cross_prefix}${nm_default}"
  1641. pkg_config_default="${cross_prefix}${pkg_config_default}"
  1642. ranlib="${cross_prefix}${ranlib}"
  1643. strip_default="${cross_prefix}${strip_default}"
  1644. sysinclude_default="${sysroot}/usr/include"
  1645. set_default cc nm pkg_config strip sysinclude
  1646. enabled cross_compile || host_cc_default=$cc
  1647. set_default host_cc
  1648. exesuf() {
  1649. case $1 in
  1650. mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
  1651. esac
  1652. }
  1653. EXESUF=$(exesuf $target_os)
  1654. HOSTEXESUF=$(exesuf $host_os)
  1655. # set temporary file name
  1656. : ${TMPDIR:=$TEMPDIR}
  1657. : ${TMPDIR:=$TMP}
  1658. : ${TMPDIR:=/tmp}
  1659. if ! check_cmd mktemp -u XXXXXX; then
  1660. # simple replacement for missing mktemp
  1661. # NOT SAFE FOR GENERAL USE
  1662. mktemp(){
  1663. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  1664. }
  1665. fi
  1666. tmpfile(){
  1667. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  1668. (set -C; exec > $tmp) 2>/dev/null ||
  1669. die "Unable to create temporary file in $TMPDIR."
  1670. append TMPFILES $tmp
  1671. eval $1=$tmp
  1672. }
  1673. trap 'rm -f -- $TMPFILES' EXIT
  1674. tmpfile TMPC .c
  1675. tmpfile TMPE $EXESUF
  1676. tmpfile TMPH .h
  1677. tmpfile TMPO .o
  1678. tmpfile TMPS .S
  1679. tmpfile TMPV .ver
  1680. tmpfile TMPSH .sh
  1681. tmpfile TMPASM .asm
  1682. unset -f mktemp
  1683. chmod +x $TMPE
  1684. # make sure we can execute files in $TMPDIR
  1685. cat > $TMPSH 2>> $logfile <<EOF
  1686. #! /bin/sh
  1687. EOF
  1688. chmod +x $TMPSH >> $logfile 2>&1
  1689. if ! $TMPSH >> $logfile 2>&1; then
  1690. cat <<EOF
  1691. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  1692. variable to another directory and make sure that it is not mounted noexec.
  1693. EOF
  1694. die "Sanity test failed."
  1695. fi
  1696. filter_cflags=echo
  1697. filter_cppflags=echo
  1698. filter_asflags=echo
  1699. if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  1700. cc_type=llvm_gcc
  1701. cc_version=__VERSION__
  1702. gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)')
  1703. cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver"
  1704. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1705. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1706. speed_cflags='-O3'
  1707. size_cflags='-Os'
  1708. elif $cc -v 2>&1 | grep -qi ^gcc; then
  1709. cc_type=gcc
  1710. cc_version=__VERSION__
  1711. gcc_version=$($cc --version | head -n1)
  1712. gcc_basever=$($cc -dumpversion)
  1713. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  1714. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  1715. cc_ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  1716. if ! $cc -dumpversion | grep -q '^2\.'; then
  1717. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1718. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1719. fi
  1720. speed_cflags='-O3'
  1721. size_cflags='-Os'
  1722. elif $cc --version 2>/dev/null | grep -q Intel; then
  1723. cc_type=icc
  1724. cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
  1725. cc_ident=$($cc --version | head -n1)
  1726. icc_version=$($cc -dumpversion)
  1727. CC_DEPFLAGS='-MMD'
  1728. AS_DEPFLAGS='-MMD'
  1729. speed_cflags='-O3'
  1730. size_cflags='-Os'
  1731. noopt_cflags='-O1'
  1732. elif $cc -v 2>&1 | grep -q xlc; then
  1733. cc_type=xlc
  1734. cc_version="AV_STRINGIFY(__IBMC__)"
  1735. cc_ident=$($cc -qversion 2>/dev/null | head -n1)
  1736. speed_cflags='-O5'
  1737. size_cflags='-O5 -qcompact'
  1738. elif $cc -V 2>/dev/null | grep -q Compaq; then
  1739. cc_type=ccc
  1740. cc_version="AV_STRINGIFY(__DECC_VER)"
  1741. cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3)
  1742. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
  1743. debuglevel=3
  1744. add_ldflags -Wl,-z,now # calls to libots crash without this
  1745. speed_cflags='-fast'
  1746. size_cflags='-O1'
  1747. elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  1748. test -d "$sysroot" || die "No valid sysroot specified."
  1749. cc_type=armcc
  1750. cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
  1751. cc_ident=$($cc --vsn | head -n1)
  1752. armcc_conf="$PWD/armcc.conf"
  1753. $cc --arm_linux_configure \
  1754. --arm_linux_config_file="$armcc_conf" \
  1755. --configure_sysroot="$sysroot" \
  1756. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  1757. die "Error creating armcc configuration file."
  1758. $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  1759. cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
  1760. as_default="${cross_prefix}gcc"
  1761. CC_DEPFLAGS='-MMD'
  1762. AS_DEPFLAGS='-MMD'
  1763. speed_cflags='-O3'
  1764. size_cflags='-Os'
  1765. filter_asflags="filter_out -W${armcc_opt}*"
  1766. elif $cc -version 2>/dev/null | grep -q TMS470; then
  1767. cc_type=tms470
  1768. cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
  1769. cc_ident=$($cc -version | head -n1 | tr -s ' ')
  1770. cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
  1771. CC_O='-fr=$(@D)'
  1772. as_default="${cross_prefix}gcc"
  1773. ld_default="${cross_prefix}gcc"
  1774. TMPO=$(basename $TMPC .c).o
  1775. append TMPFILES $TMPO
  1776. add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
  1777. CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
  1778. AS_DEPFLAGS='-MMD'
  1779. speed_cflags='-O3 -mf=5'
  1780. size_cflags='-O3 -mf=2'
  1781. filter_cflags=tms470_flags
  1782. tms470_flags(){
  1783. for flag; do
  1784. case $flag in
  1785. -march=*|-mcpu=*)
  1786. case "${flag#*=}" in
  1787. armv7-a|cortex-a*) echo -mv=7a8 ;;
  1788. armv7-r|cortex-r*) echo -mv=7r4 ;;
  1789. armv7-m|cortex-m*) echo -mv=7m3 ;;
  1790. armv6*|arm11*) echo -mv=6 ;;
  1791. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  1792. echo -mv=5e ;;
  1793. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  1794. esac
  1795. ;;
  1796. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  1797. -mfpu=vfp) echo --float_support=vfpv2 ;;
  1798. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  1799. -msoft-float) echo --float_support=vfplib ;;
  1800. -O[0-3]|-mf=*) echo $flag ;;
  1801. -g) echo -g -mn ;;
  1802. -pds=*) echo $flag ;;
  1803. esac
  1804. done
  1805. }
  1806. elif $cc -v 2>&1 | grep -q clang; then
  1807. cc_type=clang
  1808. $cc -dM -E $TMPC | grep -q __clang_version__ &&
  1809. cc_version=__clang_version__ || cc_version=__VERSION__
  1810. cc_ident=$($cc --version | head -n1)
  1811. CC_DEPFLAGS='-MMD'
  1812. AS_DEPFLAGS='-MMD'
  1813. speed_cflags='-O3'
  1814. size_cflags='-Os'
  1815. elif $cc -V 2>&1 | grep -q Sun; then
  1816. cc_type=suncc
  1817. cc_version="AV_STRINGIFY(__SUNPRO_C)"
  1818. cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  1819. DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  1820. DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
  1821. speed_cflags='-O5'
  1822. size_cflags='-O5 -xspace'
  1823. filter_cflags=suncc_flags
  1824. suncc_flags(){
  1825. for flag; do
  1826. case $flag in
  1827. -march=*|-mcpu=*)
  1828. case "${flag#*=}" in
  1829. native) echo -xtarget=native ;;
  1830. v9|niagara) echo -xarch=sparc ;;
  1831. ultrasparc) echo -xarch=sparcvis ;;
  1832. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  1833. i586|pentium) echo -xchip=pentium ;;
  1834. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  1835. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  1836. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  1837. pentium4*) echo -xtarget=pentium4 ;;
  1838. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  1839. *-sse3) echo -xarch=sse3 ;;
  1840. core2) echo -xarch=ssse3 -xchip=core2 ;;
  1841. amdfam10|barcelona) echo -xarch=sse4_1 ;;
  1842. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  1843. k8|opteron|athlon64|athlon-fx)
  1844. echo -xarch=sse2a ;;
  1845. athlon*) echo -xarch=pentium_proa ;;
  1846. esac
  1847. ;;
  1848. -std=c99) echo -xc99 ;;
  1849. -fomit-frame-pointer) echo -xregs=frameptr ;;
  1850. -fPIC) echo -KPIC -xcode=pic32 ;;
  1851. -W*,*) echo $flag ;;
  1852. -f*-*|-W*) ;;
  1853. *) echo $flag ;;
  1854. esac
  1855. done
  1856. }
  1857. elif $cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  1858. cc_type=pathscale
  1859. cc_version=__PATHSCALE__
  1860. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  1861. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1862. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1863. speed_cflags='-O2'
  1864. size_cflags='-Os'
  1865. elif $cc -v 2>&1 | grep -q Open64; then
  1866. cc_type=open64
  1867. cc_version=__OPEN64__
  1868. cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :)
  1869. CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1870. AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
  1871. speed_cflags='-O2'
  1872. size_cflags='-Os'
  1873. fi
  1874. test -n "$cc_type" && enable $cc_type ||
  1875. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  1876. : ${as_default:=$cc}
  1877. : ${dep_cc_default:=$cc}
  1878. : ${ld_default:=$cc}
  1879. set_default ar as dep_cc ld
  1880. test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
  1881. test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
  1882. add_cflags $extra_cflags
  1883. add_asflags $extra_cflags
  1884. if test -n "$sysroot"; then
  1885. case "$cc_type" in
  1886. gcc|llvm_gcc|clang)
  1887. add_cppflags --sysroot="$sysroot"
  1888. add_ldflags --sysroot="$sysroot"
  1889. ;;
  1890. tms470)
  1891. add_cppflags -I"$sysinclude"
  1892. add_ldflags --sysroot="$sysroot"
  1893. ;;
  1894. esac
  1895. fi
  1896. if test "$cpu" = host; then
  1897. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  1898. case "$cc_type" in
  1899. gcc|llvm_gcc)
  1900. check_native(){
  1901. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  1902. sed -n "/$1=/{
  1903. s/.*$1=\\([^ ]*\\).*/\\1/
  1904. p
  1905. q
  1906. }" $TMPE
  1907. }
  1908. cpu=$(check_native -march || check_native -mcpu)
  1909. ;;
  1910. esac
  1911. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  1912. fi
  1913. # Deal with common $arch aliases
  1914. case "$arch" in
  1915. arm*)
  1916. arch="arm"
  1917. ;;
  1918. mips|mipsel|IP*)
  1919. arch="mips"
  1920. ;;
  1921. mips64*)
  1922. arch="mips"
  1923. subarch="mips64"
  1924. ;;
  1925. parisc|hppa)
  1926. arch="parisc"
  1927. ;;
  1928. parisc64|hppa64)
  1929. arch="parisc"
  1930. subarch="parisc64"
  1931. ;;
  1932. "Power Macintosh"|ppc|powerpc)
  1933. arch="ppc"
  1934. ;;
  1935. ppc64|powerpc64)
  1936. arch="ppc"
  1937. subarch="ppc64"
  1938. ;;
  1939. s390|s390x)
  1940. arch="s390"
  1941. ;;
  1942. sh4|sh)
  1943. arch="sh4"
  1944. ;;
  1945. sun4u|sparc64)
  1946. arch="sparc"
  1947. subarch="sparc64"
  1948. ;;
  1949. i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
  1950. arch="x86"
  1951. ;;
  1952. esac
  1953. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  1954. enable $arch
  1955. # Add processor-specific flags
  1956. if test "$cpu" = generic; then
  1957. : do nothing
  1958. elif enabled ppc; then
  1959. case $(tolower $cpu) in
  1960. 601|ppc601|powerpc601)
  1961. cpuflags="-mcpu=601"
  1962. disable altivec
  1963. ;;
  1964. 603*|ppc603*|powerpc603*)
  1965. cpuflags="-mcpu=603"
  1966. disable altivec
  1967. ;;
  1968. 604*|ppc604*|powerpc604*)
  1969. cpuflags="-mcpu=604"
  1970. disable altivec
  1971. ;;
  1972. g3|75*|ppc75*|powerpc75*)
  1973. cpuflags="-mcpu=750 -mpowerpc-gfxopt"
  1974. disable altivec
  1975. ;;
  1976. g4|745*|ppc745*|powerpc745*)
  1977. cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
  1978. ;;
  1979. 74*|ppc74*|powerpc74*)
  1980. cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
  1981. ;;
  1982. g5|970|ppc970|powerpc970|power4*)
  1983. cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
  1984. ;;
  1985. cell)
  1986. cpuflags="-mcpu=cell"
  1987. enable ldbrx
  1988. ;;
  1989. e500v2)
  1990. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  1991. disable altivec
  1992. ;;
  1993. e500)
  1994. cpuflags="-mcpu=8540 -mhard-float"
  1995. disable altivec
  1996. ;;
  1997. esac
  1998. elif enabled x86; then
  1999. case $cpu in
  2000. i[345]86|pentium)
  2001. cpuflags="-march=$cpu"
  2002. disable mmx
  2003. ;;
  2004. # targets that do NOT support conditional mov (cmov)
  2005. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2006. cpuflags="-march=$cpu"
  2007. disable cmov
  2008. ;;
  2009. # targets that do support conditional mov (cmov)
  2010. i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10|barcelona|atom)
  2011. cpuflags="-march=$cpu"
  2012. enable cmov
  2013. enable fast_cmov
  2014. ;;
  2015. # targets that do support conditional mov but on which it's slow
  2016. pentium4|pentium4m|prescott|nocona)
  2017. cpuflags="-march=$cpu"
  2018. enable cmov
  2019. disable fast_cmov
  2020. ;;
  2021. esac
  2022. elif enabled sparc; then
  2023. case $cpu in
  2024. niagara)
  2025. cpuflags="-mcpu=$cpu"
  2026. disable vis
  2027. ;;
  2028. sparc64)
  2029. cpuflags="-mcpu=v9"
  2030. ;;
  2031. esac
  2032. elif enabled arm; then
  2033. case $cpu in
  2034. armv*)
  2035. cpuflags="-march=$cpu"
  2036. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2037. ;;
  2038. *)
  2039. cpuflags="-mcpu=$cpu"
  2040. case $cpu in
  2041. cortex-a*) subarch=armv7a ;;
  2042. cortex-r*) subarch=armv7r ;;
  2043. cortex-m*) subarch=armv7m ;;
  2044. arm11*) subarch=armv6 ;;
  2045. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2046. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2047. esac
  2048. ;;
  2049. esac
  2050. elif enabled alpha; then
  2051. enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
  2052. elif enabled bfin; then
  2053. cpuflags="-mcpu=$cpu"
  2054. elif enabled mips; then
  2055. cpuflags="-march=$cpu"
  2056. elif enabled avr32; then
  2057. case $cpu in
  2058. ap7[02]0[0-2])
  2059. subarch="avr32_ap"
  2060. cpuflags="-mpart=$cpu"
  2061. ;;
  2062. ap)
  2063. subarch="avr32_ap"
  2064. cpuflags="-march=$cpu"
  2065. ;;
  2066. uc3[ab]*)
  2067. subarch="avr32_uc"
  2068. cpuflags="-mcpu=$cpu"
  2069. ;;
  2070. uc)
  2071. subarch="avr32_uc"
  2072. cpuflags="-march=$cpu"
  2073. ;;
  2074. esac
  2075. fi
  2076. add_cflags $cpuflags
  2077. add_asflags $cpuflags
  2078. # compiler sanity check
  2079. check_exec <<EOF
  2080. int main(void){ return 0; }
  2081. EOF
  2082. if test "$?" != 0; then
  2083. echo "$cc is unable to create an executable file."
  2084. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2085. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2086. echo "Only do this if you know what cross compiling means."
  2087. fi
  2088. die "C compiler test failed."
  2089. fi
  2090. add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
  2091. check_cflags -std=c99
  2092. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2093. #include <stdlib.h>
  2094. EOF
  2095. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2096. #include <stdlib.h>
  2097. EOF
  2098. check_host_cflags -std=c99
  2099. case "$arch" in
  2100. alpha|ia64|mips|parisc|sparc)
  2101. spic=$shared
  2102. ;;
  2103. x86)
  2104. subarch="x86_32"
  2105. check_cc <<EOF && subarch="x86_64"
  2106. int test[(int)sizeof(char*) - 7];
  2107. EOF
  2108. if test "$subarch" = "x86_64"; then
  2109. spic=$shared
  2110. fi
  2111. ;;
  2112. esac
  2113. enable $subarch
  2114. enabled spic && enable pic
  2115. # OS specific
  2116. case $target_os in
  2117. haiku)
  2118. prefix_default="/boot/common"
  2119. network_extralibs="-lnetwork"
  2120. host_libs=
  2121. ;;
  2122. sunos)
  2123. FFSERVERLDFLAGS=""
  2124. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2125. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2126. network_extralibs="-lsocket -lnsl"
  2127. add_cppflags -D__EXTENSIONS__
  2128. nm_opts='-P -g'
  2129. ;;
  2130. netbsd)
  2131. disable symver
  2132. oss_indev_extralibs="-lossaudio"
  2133. oss_outdev_extralibs="-lossaudio"
  2134. add_cppflags -D_XOPEN_SOURCE=600
  2135. ;;
  2136. openbsd)
  2137. enable malloc_aligned
  2138. # On OpenBSD 4.5. the compiler does not use PIC unless
  2139. # explicitly using -fPIC. Libav builds fine without PIC,
  2140. # however the generated executable will not do anything
  2141. # (simply quits with exit-code 1, no crash, no output).
  2142. # Thus explicitly enable PIC here.
  2143. enable pic
  2144. disable symver
  2145. SHFLAGS='-shared'
  2146. oss_indev_extralibs="-lossaudio"
  2147. oss_outdev_extralibs="-lossaudio"
  2148. ;;
  2149. dragonfly)
  2150. enable malloc_aligned
  2151. disable symver
  2152. ;;
  2153. freebsd)
  2154. enable malloc_aligned
  2155. ;;
  2156. bsd/os)
  2157. add_extralibs -lpoll -lgnugetopt
  2158. strip="strip -d"
  2159. ;;
  2160. darwin)
  2161. enable malloc_aligned
  2162. gas="gas-preprocessor.pl $cc"
  2163. enabled ppc && add_asflags -force_cpusubtype_ALL
  2164. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  2165. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  2166. strip="${strip} -x"
  2167. add_ldflags -Wl,-dynamic,-search_paths_first
  2168. SLIBSUF=".dylib"
  2169. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  2170. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  2171. FFSERVERLDFLAGS=-Wl,-bind_at_load
  2172. objformat="macho"
  2173. enabled x86_64 && objformat="macho64"
  2174. enabled_any pic shared ||
  2175. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  2176. ;;
  2177. mingw32*)
  2178. if test $target_os = "mingw32ce"; then
  2179. disable network
  2180. else
  2181. target_os=mingw32
  2182. fi
  2183. LIBTARGET=i386
  2184. if enabled x86_64; then
  2185. enable malloc_aligned
  2186. LIBTARGET=x64
  2187. elif enabled arm; then
  2188. LIBTARGET=arm
  2189. fi
  2190. shlibdir_default="$bindir_default"
  2191. disable ffserver
  2192. SLIBPREF=""
  2193. SLIBSUF=".dll"
  2194. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2195. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2196. SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
  2197. SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
  2198. install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
  2199. install -d "$(LIBDIR)"; \
  2200. install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
  2201. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
  2202. 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'
  2203. objformat="win32"
  2204. dlltool="${cross_prefix}dlltool"
  2205. enable dos_paths
  2206. check_cflags -fno-common
  2207. check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \
  2208. || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  2209. die "ERROR: MinGW runtime version must be >= 3.15."
  2210. ;;
  2211. cygwin*)
  2212. target_os=cygwin
  2213. shlibdir_default="$bindir_default"
  2214. SLIBPREF="cyg"
  2215. SLIBSUF=".dll"
  2216. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  2217. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  2218. SHFLAGS='-shared -Wl,--enable-auto-image-base'
  2219. objformat="win32"
  2220. enable dos_paths
  2221. check_cflags -fno-common
  2222. ;;
  2223. *-dos|freedos|opendos)
  2224. disable ffplay ffserver
  2225. disable $INDEV_LIST $OUTDEV_LIST
  2226. network_extralibs="-lsocket"
  2227. objformat="coff"
  2228. enable dos_paths
  2229. ;;
  2230. linux)
  2231. enable dv1394
  2232. ;;
  2233. irix*)
  2234. target_os=irix
  2235. ranlib="echo ignoring ranlib"
  2236. ;;
  2237. os/2*)
  2238. strip="lxlite -CS"
  2239. ln_s="cp -f"
  2240. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  2241. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  2242. FFSERVERLDFLAGS=""
  2243. LIBSUF="_s.a"
  2244. SLIBPREF=""
  2245. SLIBSUF=".dll"
  2246. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  2247. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  2248. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  2249. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  2250. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  2251. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  2252. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  2253. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  2254. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  2255. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  2256. SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
  2257. SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
  2258. enable dos_paths
  2259. ;;
  2260. gnu/kfreebsd)
  2261. ;;
  2262. gnu)
  2263. ;;
  2264. qnx)
  2265. add_cppflags -D_QNX_SOURCE
  2266. network_extralibs="-lsocket"
  2267. ;;
  2268. none)
  2269. ;;
  2270. *)
  2271. die "Unknown OS '$target_os'."
  2272. ;;
  2273. esac
  2274. echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$LIBAV_CONFIGURATION" >config.fate
  2275. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  2276. set_default $PATHS_LIST
  2277. # we need to build at least one lib type
  2278. if ! enabled_any static shared; then
  2279. cat <<EOF
  2280. At least one library type must be built.
  2281. Specify --enable-static to build the static libraries or --enable-shared to
  2282. build the shared libraries as well. To only build the shared libraries specify
  2283. --disable-static in addition to --enable-shared.
  2284. EOF
  2285. exit 1;
  2286. fi
  2287. disabled static && LIBNAME=""
  2288. die_license_disabled() {
  2289. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  2290. }
  2291. die_license_disabled gpl libx264
  2292. die_license_disabled gpl libxavs
  2293. die_license_disabled gpl libxvid
  2294. die_license_disabled gpl postproc
  2295. die_license_disabled gpl x11grab
  2296. die_license_disabled nonfree libfaac
  2297. die_license_disabled version3 libopencore_amrnb
  2298. die_license_disabled version3 libopencore_amrwb
  2299. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  2300. disabled optimizations || check_cflags -fomit-frame-pointer
  2301. enable_pic() {
  2302. enable pic
  2303. add_cppflags -DPIC
  2304. add_cflags -fPIC
  2305. add_asflags -fPIC
  2306. }
  2307. enabled pic && enable_pic
  2308. check_cc <<EOF || die "Symbol mangling check failed."
  2309. int ff_extern;
  2310. EOF
  2311. sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  2312. extern_prefix=${sym%%ff_extern*}
  2313. check_cc <<EOF && enable inline_asm
  2314. void foo(void) { __asm__ volatile ("" ::); }
  2315. EOF
  2316. _restrict=
  2317. for restrict_keyword in restrict __restrict__ __restrict; do
  2318. check_cc <<EOF && _restrict=$restrict_keyword && break
  2319. void foo(char * $restrict_keyword p);
  2320. EOF
  2321. done
  2322. check_cc <<EOF && enable attribute_packed
  2323. struct { int x; } __attribute__((packed)) x;
  2324. EOF
  2325. check_cc <<EOF && enable attribute_may_alias
  2326. union { int x; } __attribute__((may_alias)) x;
  2327. EOF
  2328. check_cc <<EOF || die "endian test failed"
  2329. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  2330. EOF
  2331. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  2332. if enabled alpha; then
  2333. check_cflags -mieee
  2334. elif enabled arm; then
  2335. check_cflags -marm
  2336. nogas=die
  2337. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  2338. enable vfp_args
  2339. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  2340. case "${cross_prefix:-$cc}" in
  2341. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  2342. *) check_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  2343. __asm__ (".eabi_attribute 28, 1");
  2344. int main(void) { return 0; }
  2345. EOF
  2346. esac
  2347. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  2348. fi
  2349. # We have to check if pld is a nop and disable it.
  2350. check_asm pld '"pld [r0]"'
  2351. enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
  2352. enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
  2353. enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
  2354. enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
  2355. enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
  2356. enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
  2357. enabled_all armv6t2 shared !pic && enable_pic
  2358. elif enabled mips; then
  2359. check_asm loongson '"dmult.g $1, $2, $3"'
  2360. enabled mmi && check_asm mmi '"lq $2, 0($2)"'
  2361. elif enabled ppc; then
  2362. enable local_aligned_8 local_aligned_16
  2363. check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  2364. check_asm ibm_asm '"add 0, 0, 0"'
  2365. check_asm ppc4xx '"maclhw r10, r11, r12"'
  2366. check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  2367. # AltiVec flags: The FSF version of GCC differs from the Apple version
  2368. if enabled altivec; then
  2369. nogas=warn
  2370. check_cflags -maltivec -mabi=altivec &&
  2371. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  2372. check_cflags -faltivec
  2373. # check if our compiler supports Motorola AltiVec C API
  2374. check_cc <<EOF || disable altivec
  2375. $inc_altivec_h
  2376. int main(void) {
  2377. vector signed int v1, v2, v3;
  2378. v1 = vec_add(v2,v3);
  2379. return 0;
  2380. }
  2381. EOF
  2382. # check if our compiler supports braces for vector declarations
  2383. check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
  2384. $inc_altivec_h
  2385. int main (void) { (vector int) {1}; return 0; }
  2386. EOF
  2387. fi
  2388. elif enabled sparc; then
  2389. enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
  2390. add_cflags -mcpu=ultrasparc -mtune=ultrasparc
  2391. elif enabled x86; then
  2392. enable local_aligned_8 local_aligned_16
  2393. # check whether EBP is available on x86
  2394. # As 'i' is stored on the stack, this program will crash
  2395. # if the base pointer is used to access it because the
  2396. # base pointer is cleared in the inline assembly code.
  2397. check_exec_crash <<EOF && enable ebp_available
  2398. volatile int i=0;
  2399. __asm__ volatile (
  2400. "xorl %%ebp, %%ebp"
  2401. ::: "%ebp");
  2402. return i;
  2403. EOF
  2404. # check whether EBX is available on x86
  2405. check_asm ebx_available '""::"b"(0)' &&
  2406. check_asm ebx_available '"":::"%ebx"'
  2407. # check whether xmm clobbers are supported
  2408. check_asm xmm_clobbers '"":::"%xmm0"'
  2409. # check whether more than 10 operands are supported
  2410. check_cc <<EOF && enable ten_operands
  2411. int main(void) {
  2412. int x=0;
  2413. __asm__ volatile(
  2414. ""
  2415. :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
  2416. );
  2417. return 0;
  2418. }
  2419. EOF
  2420. # check whether binutils is new enough to compile SSSE3/MMX2
  2421. enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
  2422. enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"'
  2423. check_asm bswap '"bswap %%eax" ::: "%eax"'
  2424. if ! disabled_any asm mmx yasm; then
  2425. if check_cmd $yasmexe --version; then
  2426. enabled x86_64 && yasm_extra="-m amd64"
  2427. yasm_debug="-g dwarf2"
  2428. elif check_cmd nasm -v; then
  2429. yasmexe=nasm
  2430. yasm_debug="-g -F dwarf"
  2431. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  2432. fi
  2433. YASMFLAGS="-f $objformat $yasm_extra"
  2434. enabled pic && append YASMFLAGS "-DPIC"
  2435. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  2436. case "$objformat" in
  2437. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  2438. esac
  2439. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  2440. die "yasm not found, use --disable-yasm for a crippled build"
  2441. check_yasm "vpaddw xmm0, xmm0, xmm0" || disable avx
  2442. fi
  2443. case "$cpu" in
  2444. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  2445. disable fast_clz
  2446. ;;
  2447. esac
  2448. fi
  2449. if enabled asm; then
  2450. as=${gas:=$as}
  2451. check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' ||
  2452. $nogas "GNU assembler not found, install gas-preprocessor"
  2453. fi
  2454. if check_func dlopen; then
  2455. ldl=
  2456. elif check_func dlopen -ldl; then
  2457. ldl=-ldl
  2458. fi
  2459. if enabled network; then
  2460. check_type "sys/types.h sys/socket.h" socklen_t
  2461. check_type netdb.h "struct addrinfo"
  2462. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  2463. check_type netinet/in.h "struct sockaddr_in6"
  2464. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  2465. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  2466. # Prefer arpa/inet.h over winsock2
  2467. if check_header arpa/inet.h ; then
  2468. check_func closesocket
  2469. elif check_header winsock2.h ; then
  2470. check_func_headers winsock2.h closesocket -lws2 && \
  2471. network_extralibs="-lws2" || \
  2472. { check_func_headers winsock2.h closesocket -lws2_32 && \
  2473. network_extralibs="-lws2_32"; }
  2474. check_type ws2tcpip.h socklen_t
  2475. check_type ws2tcpip.h "struct addrinfo"
  2476. check_type ws2tcpip.h "struct ipv6_mreq"
  2477. check_type ws2tcpip.h "struct sockaddr_in6"
  2478. check_type ws2tcpip.h "struct sockaddr_storage"
  2479. check_struct winsock2.h "struct sockaddr" sa_len
  2480. else
  2481. disable network
  2482. fi
  2483. fi
  2484. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  2485. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  2486. check_func fcntl
  2487. check_func fork
  2488. check_func getaddrinfo $network_extralibs
  2489. check_func gethrtime
  2490. check_func getrusage
  2491. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  2492. check_func inet_aton $network_extralibs
  2493. check_func isatty
  2494. check_func ${malloc_prefix}memalign && enable memalign
  2495. check_func mkstemp
  2496. check_func mmap
  2497. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  2498. check_func setrlimit
  2499. check_func strerror_r
  2500. check_func strtok_r
  2501. check_func_headers io.h setmode
  2502. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  2503. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  2504. check_func_headers windows.h GetProcessTimes
  2505. check_func_headers windows.h MapViewOfFile
  2506. check_func_headers windows.h VirtualAlloc
  2507. check_header conio.h
  2508. check_header dlfcn.h
  2509. check_header dxva2api.h
  2510. check_header malloc.h
  2511. check_header poll.h
  2512. check_header sys/mman.h
  2513. check_header sys/resource.h
  2514. check_header sys/select.h
  2515. check_header vdpau/vdpau.h
  2516. check_header vdpau/vdpau_x11.h
  2517. check_header X11/extensions/XvMClib.h
  2518. check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
  2519. if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
  2520. enabled_any $need_memalign ; then
  2521. die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
  2522. fi
  2523. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  2524. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  2525. # check for some common methods of building with pthread support
  2526. # do this before the optional library checks as some of them require pthreads
  2527. if ! disabled pthreads && ! enabled w32threads; then
  2528. enable pthreads
  2529. if check_func pthread_create; then
  2530. :
  2531. elif check_func pthread_create -pthread; then
  2532. add_cflags -pthread
  2533. add_extralibs -pthread
  2534. elif check_func pthread_create -pthreads; then
  2535. add_cflags -pthreads
  2536. add_extralibs -pthreads
  2537. elif check_func pthread_create -lpthreadGC2; then
  2538. add_extralibs -lpthreadGC2
  2539. elif ! check_lib pthread.h pthread_create -lpthread; then
  2540. disable pthreads
  2541. fi
  2542. fi
  2543. for thread in $THREADS_LIST; do
  2544. if enabled $thread; then
  2545. test -n "$thread_type" &&
  2546. die "ERROR: Only one thread type must be selected." ||
  2547. thread_type="$thread"
  2548. fi
  2549. done
  2550. check_lib math.h sin -lm
  2551. disabled vaapi || check_lib va/va.h vaInitialize -lva
  2552. check_mathfunc exp2
  2553. check_mathfunc exp2f
  2554. check_mathfunc llrint
  2555. check_mathfunc llrintf
  2556. check_mathfunc log2
  2557. check_mathfunc log2f
  2558. check_mathfunc lrint
  2559. check_mathfunc lrintf
  2560. check_mathfunc round
  2561. check_mathfunc roundf
  2562. check_mathfunc truncf
  2563. # these are off by default, so fail if requested and not available
  2564. enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
  2565. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  2566. enabled libdirac && require_pkg_config dirac \
  2567. "libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
  2568. "dirac_decoder_init dirac_encoder_init"
  2569. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  2570. enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm
  2571. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  2572. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  2573. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  2574. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  2575. enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
  2576. enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
  2577. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  2578. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  2579. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  2580. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  2581. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  2582. enabled libvpx && {
  2583. enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  2584. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  2585. enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
  2586. die "ERROR: libvpx encoder version must be >=0.9.1"; } }
  2587. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  2588. { check_cpp_condition x264.h "X264_BUILD >= 99" ||
  2589. die "ERROR: libx264 version must be >= 0.99."; }
  2590. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  2591. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  2592. enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
  2593. # libdc1394 check
  2594. if enabled libdc1394; then
  2595. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  2596. enable libdc1394_2; } ||
  2597. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  2598. enable libdc1394_1; } ||
  2599. die "ERROR: No version of libdc1394 found "
  2600. fi
  2601. if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
  2602. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  2603. enable sdl &&
  2604. check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
  2605. fi
  2606. texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
  2607. check_header linux/videodev.h
  2608. check_header linux/videodev2.h
  2609. check_header sys/videoio.h
  2610. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  2611. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  2612. # w32api 3.12 had it defined wrong
  2613. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  2614. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  2615. { check_header dev/bktr/ioctl_meteor.h &&
  2616. check_header dev/bktr/ioctl_bt848.h; } ||
  2617. { check_header machine/ioctl_meteor.h &&
  2618. check_header machine/ioctl_bt848.h; } ||
  2619. { check_header dev/video/meteor/ioctl_meteor.h &&
  2620. check_header dev/video/bktr/ioctl_bt848.h; } ||
  2621. check_header dev/ic/bt8xx.h
  2622. check_header sys/soundcard.h
  2623. check_header soundcard.h
  2624. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  2625. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
  2626. enabled x11grab &&
  2627. check_header X11/Xlib.h &&
  2628. check_header X11/extensions/XShm.h &&
  2629. check_header X11/extensions/Xfixes.h &&
  2630. check_func XOpenDisplay -lX11 &&
  2631. check_func XShmCreateImage -lX11 -lXext &&
  2632. check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
  2633. if ! disabled vdpau && enabled vdpau_vdpau_h; then
  2634. check_cpp_condition \
  2635. vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  2636. { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
  2637. disable vdpau; }
  2638. fi
  2639. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  2640. # add some useful compiler flags if supported
  2641. check_cflags -Wdeclaration-after-statement
  2642. check_cflags -Wall
  2643. check_cflags -Wno-parentheses
  2644. check_cflags -Wno-switch
  2645. check_cflags -Wdisabled-optimization
  2646. check_cflags -Wpointer-arith
  2647. check_cflags -Wredundant-decls
  2648. check_cflags -Wno-pointer-sign
  2649. check_cflags -Wcast-qual
  2650. check_cflags -Wwrite-strings
  2651. check_cflags -Wtype-limits
  2652. check_cflags -Wundef
  2653. check_cflags -Wmissing-prototypes
  2654. enabled extra_warnings && check_cflags -Winline
  2655. # add some linker flags
  2656. check_ldflags -Wl,--warn-common
  2657. check_ldflags -Wl,--as-needed
  2658. 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'
  2659. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  2660. echo "X{};" > $TMPV
  2661. if test_ldflags -Wl,--version-script,$TMPV; then
  2662. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  2663. check_cc <<EOF && enable symver_asm_label
  2664. void ff_foo(void) __asm__ ("av_foo@VERSION");
  2665. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  2666. EOF
  2667. check_cc <<EOF && enable symver_gnu_asm
  2668. __asm__(".symver ff_foo,av_foo@VERSION");
  2669. void ff_foo(void) {}
  2670. EOF
  2671. fi
  2672. if enabled small; then
  2673. add_cflags $size_cflags
  2674. optimizations="small"
  2675. elif enabled optimizations; then
  2676. add_cflags $speed_cflags
  2677. else
  2678. add_cflags $noopt_cflags
  2679. fi
  2680. check_cflags -fno-math-errno
  2681. check_cflags -fno-signed-zeros
  2682. if enabled icc; then
  2683. # Just warnings, no remarks
  2684. check_cflags -w1
  2685. # -wd: Disable following warnings
  2686. # 144, 167, 556: -Wno-pointer-sign
  2687. # 10006: ignoring unknown option -fno-signed-zeros
  2688. # 10148: ignoring unknown option -Wno-parentheses
  2689. # 10156: ignoring option '-W'; no argument required
  2690. check_cflags -wd144,167,556,10006,10148,10156
  2691. # 11030: Warning unknown option --as-needed
  2692. # 10156: ignoring option '-export'; no argument required
  2693. check_ldflags -wd10156,11030
  2694. # Allow to compile with optimizations
  2695. check_ldflags -march=$cpu
  2696. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  2697. enable ebp_available
  2698. if enabled x86_32; then
  2699. test ${icc_version%%.*} -ge 11 && \
  2700. check_cflags -falign-stack=maintain-16-byte || \
  2701. disable aligned_stack
  2702. fi
  2703. elif enabled ccc; then
  2704. # disable some annoying warnings
  2705. add_cflags -msg_disable cvtu32to64
  2706. add_cflags -msg_disable embedcomment
  2707. add_cflags -msg_disable needconstext
  2708. add_cflags -msg_disable nomainieee
  2709. add_cflags -msg_disable ptrmismatch1
  2710. add_cflags -msg_disable unreachcode
  2711. elif enabled gcc; then
  2712. check_cflags -fno-tree-vectorize
  2713. check_cflags -Werror=implicit-function-declaration
  2714. check_cflags -Werror=missing-prototypes
  2715. elif enabled llvm_gcc; then
  2716. check_cflags -mllvm -stack-alignment=16
  2717. elif enabled clang; then
  2718. check_cflags -mllvm -stack-alignment=16
  2719. check_cflags -Qunused-arguments
  2720. elif enabled armcc; then
  2721. # 2523: use of inline assembler is deprecated
  2722. add_cflags -W${armcc_opt},--diag_suppress=2523
  2723. add_cflags -W${armcc_opt},--diag_suppress=1207
  2724. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  2725. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  2726. elif enabled tms470; then
  2727. add_cflags -pds=824 -pds=837
  2728. elif enabled pathscale; then
  2729. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  2730. fi
  2731. enabled_any $THREADS_LIST && enable threads
  2732. check_deps $CONFIG_LIST \
  2733. $CONFIG_EXTRA \
  2734. $HAVE_LIST \
  2735. $DECODER_LIST \
  2736. $ENCODER_LIST \
  2737. $HWACCEL_LIST \
  2738. $PARSER_LIST \
  2739. $BSF_LIST \
  2740. $DEMUXER_LIST \
  2741. $MUXER_LIST \
  2742. $FILTER_LIST \
  2743. $INDEV_LIST \
  2744. $OUTDEV_LIST \
  2745. $PROTOCOL_LIST \
  2746. $ACODEC_TESTS \
  2747. $VCODEC_TESTS \
  2748. $LAVF_TESTS \
  2749. $LAVFI_TESTS \
  2750. $SEEK_TESTS \
  2751. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  2752. echo "install prefix $prefix"
  2753. echo "source path $source_path"
  2754. echo "C compiler $cc"
  2755. echo "ARCH $arch ($cpu)"
  2756. if test "$build_suffix" != ""; then
  2757. echo "build suffix $build_suffix"
  2758. fi
  2759. if test "$extra_version" != ""; then
  2760. echo "version string suffix $extra_version"
  2761. fi
  2762. echo "big-endian ${bigendian-no}"
  2763. echo "runtime cpu detection ${runtime_cpudetect-no}"
  2764. if enabled x86; then
  2765. echo "yasm ${yasm-no}"
  2766. echo "MMX enabled ${mmx-no}"
  2767. echo "MMX2 enabled ${mmx2-no}"
  2768. echo "3DNow! enabled ${amd3dnow-no}"
  2769. echo "3DNow! extended enabled ${amd3dnowext-no}"
  2770. echo "SSE enabled ${sse-no}"
  2771. echo "SSSE3 enabled ${ssse3-no}"
  2772. echo "CMOV enabled ${cmov-no}"
  2773. echo "CMOV is fast ${fast_cmov-no}"
  2774. echo "EBX available ${ebx_available-no}"
  2775. echo "EBP available ${ebp_available-no}"
  2776. echo "10 operands supported ${ten_operands-no}"
  2777. fi
  2778. if enabled arm; then
  2779. echo "ARMv5TE enabled ${armv5te-no}"
  2780. echo "ARMv6 enabled ${armv6-no}"
  2781. echo "ARMv6T2 enabled ${armv6t2-no}"
  2782. echo "ARM VFP enabled ${armvfp-no}"
  2783. echo "IWMMXT enabled ${iwmmxt-no}"
  2784. echo "NEON enabled ${neon-no}"
  2785. fi
  2786. if enabled mips; then
  2787. echo "MMI enabled ${mmi-no}"
  2788. fi
  2789. if enabled ppc; then
  2790. echo "AltiVec enabled ${altivec-no}"
  2791. echo "PPC 4xx optimizations ${ppc4xx-no}"
  2792. echo "dcbzl available ${dcbzl-no}"
  2793. fi
  2794. if enabled sparc; then
  2795. echo "VIS enabled ${vis-no}"
  2796. fi
  2797. echo "debug symbols ${debug-no}"
  2798. echo "strip symbols ${stripping-no}"
  2799. echo "optimizations ${optimizations-no}"
  2800. echo "static ${static-no}"
  2801. echo "shared ${shared-no}"
  2802. echo "postprocessing support ${postproc-no}"
  2803. echo "new filter support ${avfilter-no}"
  2804. echo "network support ${network-no}"
  2805. echo "threading support ${thread_type-no}"
  2806. echo "SDL support ${sdl-no}"
  2807. echo "Sun medialib support ${mlib-no}"
  2808. echo "AVISynth enabled ${avisynth-no}"
  2809. echo "frei0r enabled ${frei0r-no}"
  2810. echo "libdc1394 support ${libdc1394-no}"
  2811. echo "libdirac enabled ${libdirac-no}"
  2812. echo "libfaac enabled ${libfaac-no}"
  2813. echo "libgsm enabled ${libgsm-no}"
  2814. echo "libmp3lame enabled ${libmp3lame-no}"
  2815. echo "libnut enabled ${libnut-no}"
  2816. echo "libopencore-amrnb support ${libopencore_amrnb-no}"
  2817. echo "libopencore-amrwb support ${libopencore_amrwb-no}"
  2818. echo "libopencv support ${libopencv-no}"
  2819. echo "libopenjpeg enabled ${libopenjpeg-no}"
  2820. echo "librtmp enabled ${librtmp-no}"
  2821. echo "libschroedinger enabled ${libschroedinger-no}"
  2822. echo "libspeex enabled ${libspeex-no}"
  2823. echo "libtheora enabled ${libtheora-no}"
  2824. echo "libvorbis enabled ${libvorbis-no}"
  2825. echo "libvpx enabled ${libvpx-no}"
  2826. echo "libx264 enabled ${libx264-no}"
  2827. echo "libxavs enabled ${libxavs-no}"
  2828. echo "libxvid enabled ${libxvid-no}"
  2829. echo "zlib enabled ${zlib-no}"
  2830. echo "bzlib enabled ${bzlib-no}"
  2831. echo
  2832. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  2833. echo "Enabled ${type}s:"
  2834. eval list=\$$(toupper $type)_LIST
  2835. print_enabled '_*' $list | sort | pr -r -3 -t
  2836. echo
  2837. done
  2838. license="LGPL version 2.1 or later"
  2839. if enabled nonfree; then
  2840. license="nonfree and unredistributable"
  2841. elif enabled gplv3; then
  2842. license="GPL version 3 or later"
  2843. elif enabled lgplv3; then
  2844. license="LGPL version 3 or later"
  2845. elif enabled gpl; then
  2846. license="GPL version 2 or later"
  2847. fi
  2848. echo "License: $license"
  2849. echo "Creating config.mak and config.h..."
  2850. # build tree in object directory if source path is different from current one
  2851. if enabled source_path_used; then
  2852. DIRS="
  2853. doc
  2854. libavcodec
  2855. libavcodec/$arch
  2856. libavdevice
  2857. libavfilter
  2858. libavfilter/$arch
  2859. libavformat
  2860. libavutil
  2861. libavutil/$arch
  2862. libpostproc
  2863. libswscale
  2864. libswscale/$arch
  2865. tests
  2866. tools
  2867. "
  2868. FILES="
  2869. Makefile
  2870. common.mak
  2871. subdir.mak
  2872. doc/texi2pod.pl
  2873. libavcodec/Makefile
  2874. libavcodec/${arch}/Makefile
  2875. libavdevice/Makefile
  2876. libavfilter/Makefile
  2877. libavfilter/${arch}/Makefile
  2878. libavformat/Makefile
  2879. libavutil/Makefile
  2880. libpostproc/Makefile
  2881. libswscale/Makefile
  2882. "
  2883. map 'mkdir -p $v' $DIRS;
  2884. map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES
  2885. fi
  2886. enabled stripping || strip="echo skipping strip"
  2887. config_files="$TMPH config.mak"
  2888. cat > config.mak <<EOF
  2889. # Automatically generated by configure - do not modify!
  2890. ifndef LIBAV_CONFIG_MAK
  2891. LIBAV_CONFIG_MAK=1
  2892. LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
  2893. prefix=$prefix
  2894. LIBDIR=\$(DESTDIR)$libdir
  2895. SHLIBDIR=\$(DESTDIR)$shlibdir
  2896. INCDIR=\$(DESTDIR)$incdir
  2897. BINDIR=\$(DESTDIR)$bindir
  2898. DATADIR=\$(DESTDIR)$datadir
  2899. MANDIR=\$(DESTDIR)$mandir
  2900. SRC_PATH="$source_path"
  2901. SRC_PATH_BARE=$source_path
  2902. BUILD_ROOT="$PWD"
  2903. CC_IDENT=$cc_ident
  2904. ARCH=$arch
  2905. CC=$cc
  2906. AS=$as
  2907. LD=$ld
  2908. DEPCC=$dep_cc
  2909. YASM=$yasmexe
  2910. YASMDEP=$yasmexe
  2911. AR=$ar
  2912. RANLIB=$ranlib
  2913. CP=cp -p
  2914. LN_S=$ln_s
  2915. STRIP=$strip
  2916. CPPFLAGS=$CPPFLAGS
  2917. CFLAGS=$CFLAGS
  2918. ASFLAGS=$ASFLAGS
  2919. CC_O=$CC_O
  2920. DLLTOOL=$dlltool
  2921. LDFLAGS=$LDFLAGS
  2922. FFSERVERLDFLAGS=$FFSERVERLDFLAGS
  2923. SHFLAGS=$SHFLAGS
  2924. YASMFLAGS=$YASMFLAGS
  2925. BUILDSUF=$build_suffix
  2926. FULLNAME=$FULLNAME
  2927. LIBPREF=$LIBPREF
  2928. LIBSUF=$LIBSUF
  2929. LIBNAME=$LIBNAME
  2930. SLIBPREF=$SLIBPREF
  2931. SLIBSUF=$SLIBSUF
  2932. EXESUF=$EXESUF
  2933. EXTRA_VERSION=$extra_version
  2934. DEPFLAGS=$DEPFLAGS
  2935. CCDEP=$CCDEP
  2936. ASDEP=$ASDEP
  2937. CC_DEPFLAGS=$CC_DEPFLAGS
  2938. AS_DEPFLAGS=$AS_DEPFLAGS
  2939. HOSTCC=$host_cc
  2940. HOSTCFLAGS=$host_cflags
  2941. HOSTEXESUF=$HOSTEXESUF
  2942. HOSTLDFLAGS=$host_ldflags
  2943. HOSTLIBS=$host_libs
  2944. TARGET_EXEC=$target_exec
  2945. TARGET_PATH=$target_path
  2946. SDL_LIBS=$sdl_libs
  2947. SDL_CFLAGS=$sdl_cflags
  2948. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  2949. EXTRALIBS=$extralibs
  2950. INSTALL=install
  2951. LIBTARGET=${LIBTARGET}
  2952. SLIBNAME=${SLIBNAME}
  2953. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  2954. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  2955. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  2956. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  2957. SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
  2958. SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
  2959. SAMPLES=${samples:-\$(FATE_SAMPLES)}
  2960. EOF
  2961. get_version(){
  2962. name=$1
  2963. file=$source_path/$2
  2964. eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
  2965. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  2966. lcname=$(tolower $name)
  2967. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  2968. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  2969. }
  2970. get_version LIBSWSCALE libswscale/swscale.h
  2971. get_version LIBPOSTPROC libpostproc/postprocess.h
  2972. get_version LIBAVCODEC libavcodec/avcodec.h
  2973. get_version LIBAVDEVICE libavdevice/avdevice.h
  2974. get_version LIBAVFORMAT libavformat/version.h
  2975. get_version LIBAVUTIL libavutil/avutil.h
  2976. get_version LIBAVFILTER libavfilter/avfilter.h
  2977. cat > $TMPH <<EOF
  2978. /* Automatically generated by configure - do not modify! */
  2979. #ifndef LIBAV_CONFIG_H
  2980. #define LIBAV_CONFIG_H
  2981. #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
  2982. #define LIBAV_LICENSE "$(c_escape $license)"
  2983. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  2984. #define CC_TYPE "$cc_type"
  2985. #define CC_VERSION $cc_version
  2986. #define restrict $_restrict
  2987. #define EXTERN_PREFIX "${extern_prefix}"
  2988. #define EXTERN_ASM ${extern_prefix}
  2989. #define SLIBSUF "$SLIBSUF"
  2990. EOF
  2991. test -n "$malloc_prefix" &&
  2992. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  2993. if enabled small || disabled optimizations; then
  2994. echo "#undef av_always_inline" >> $TMPH
  2995. if enabled small; then
  2996. echo "#define av_always_inline inline" >> $TMPH
  2997. else
  2998. echo "#define av_always_inline av_unused" >> $TMPH
  2999. fi
  3000. fi
  3001. if enabled yasm; then
  3002. append config_files $TMPASM
  3003. printf '' >$TMPASM
  3004. fi
  3005. print_config ARCH_ "$config_files" $ARCH_LIST
  3006. print_config HAVE_ "$config_files" $HAVE_LIST
  3007. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  3008. $CONFIG_EXTRA \
  3009. $DECODER_LIST \
  3010. $ENCODER_LIST \
  3011. $HWACCEL_LIST \
  3012. $PARSER_LIST \
  3013. $BSF_LIST \
  3014. $DEMUXER_LIST \
  3015. $MUXER_LIST \
  3016. $FILTER_LIST \
  3017. $PROTOCOL_LIST \
  3018. $INDEV_LIST \
  3019. $OUTDEV_LIST \
  3020. cat >>config.mak <<EOF
  3021. ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS)
  3022. VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS)
  3023. LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS)
  3024. LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS)
  3025. SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS)
  3026. EOF
  3027. echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
  3028. echo "endif # LIBAV_CONFIG_MAK" >> config.mak
  3029. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  3030. cp_if_changed $TMPH config.h
  3031. touch .config
  3032. enabled yasm && cp_if_changed $TMPASM config.asm
  3033. cat > $TMPH <<EOF
  3034. /* Generated by ffconf */
  3035. #ifndef AVUTIL_AVCONFIG_H
  3036. #define AVUTIL_AVCONFIG_H
  3037. EOF
  3038. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  3039. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  3040. cp_if_changed $TMPH libavutil/avconfig.h
  3041. test -n "$WARNINGS" && printf "\n$WARNINGS"
  3042. # build pkg-config files
  3043. pkgconfig_generate(){
  3044. name=$1
  3045. shortname=${name#lib}${build_suffix}
  3046. comment=$2
  3047. version=$3
  3048. libs=$4
  3049. requires=$5
  3050. enabled ${name#lib} || return 0
  3051. cat <<EOF > $name/$name.pc
  3052. prefix=$prefix
  3053. exec_prefix=\${prefix}
  3054. libdir=$libdir
  3055. includedir=$incdir
  3056. Name: $name
  3057. Description: $comment
  3058. Version: $version
  3059. Requires: $(enabled shared || echo $requires)
  3060. Requires.private: $(enabled shared && echo $requires)
  3061. Conflicts:
  3062. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  3063. Libs.private: $(enabled shared && echo $libs)
  3064. Cflags: -I\${includedir}
  3065. EOF
  3066. cat <<EOF > $name/$name-uninstalled.pc
  3067. prefix=
  3068. exec_prefix=
  3069. libdir=\${pcfiledir}
  3070. includedir=${source_path}
  3071. Name: $name
  3072. Description: $comment
  3073. Version: $version
  3074. Requires: $requires
  3075. Conflicts:
  3076. Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
  3077. Cflags: -I\${includedir}
  3078. EOF
  3079. }
  3080. pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION"
  3081. pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs"
  3082. pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
  3083. pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
  3084. pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs"
  3085. pkgconfig_generate libpostproc "Libav post processing library" "$LIBPOSTPROC_VERSION"
  3086. pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"