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.

4108 lines
123KB

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