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.

4671 lines
141KB

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