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.

4661 lines
140KB

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