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.

4128 lines
124KB

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