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.

3839 lines
116KB

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