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.

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