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.

3448 lines
101KB

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