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.

4453 lines
135KB

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