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.

4724 lines
143KB

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