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.

3508 lines
104KB

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