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.

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