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.

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