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.

4723 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_win32
  1138. atomics_suncc
  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. drawtext_filter_deps="libfreetype"
  1946. ebur128_filter_deps="gpl"
  1947. flite_filter_deps="libflite"
  1948. frei0r_filter_deps="frei0r dlopen"
  1949. frei0r_filter_extralibs='$ldl'
  1950. frei0r_src_filter_deps="frei0r dlopen"
  1951. frei0r_src_filter_extralibs='$ldl'
  1952. geq_filter_deps="gpl"
  1953. histeq_filter_deps="gpl"
  1954. hqdn3d_filter_deps="gpl"
  1955. hue_filter_deps="gpl"
  1956. kerndeint_filter_deps="gpl"
  1957. movie_filter_deps="avcodec avformat"
  1958. mp_filter_deps="gpl avcodec swscale inline_asm"
  1959. mptestsrc_filter_deps="gpl"
  1960. negate_filter_deps="lut_filter"
  1961. noise_filter_deps="gpl"
  1962. resample_filter_deps="avresample"
  1963. ocv_filter_deps="libopencv"
  1964. pan_filter_deps="swresample"
  1965. pp_filter_deps="gpl postproc"
  1966. removelogo_filter_deps="avcodec avformat swscale"
  1967. scale_filter_deps="swscale"
  1968. smartblur_filter_deps="gpl swscale"
  1969. showspectrum_filter_deps="avcodec rdft"
  1970. stereo3d_filter_deps="gpl"
  1971. subtitles_filter_deps="avformat avcodec libass"
  1972. super2xsai_filter_deps="gpl"
  1973. tinterlace_filter_deps="gpl"
  1974. yadif_filter_deps="gpl"
  1975. pixfmts_super2xsai_test_deps="super2xsai_filter"
  1976. tinterlace_merge_test_deps="tinterlace_filter"
  1977. tinterlace_pad_test_deps="tinterlace_filter"
  1978. # libraries
  1979. avcodec_deps="avutil"
  1980. avdevice_deps="avutil avcodec avformat"
  1981. avfilter_deps="avutil"
  1982. avformat_deps="avutil avcodec"
  1983. avresample_deps="avutil"
  1984. postproc_deps="avutil gpl"
  1985. swscale_deps="avutil"
  1986. # programs
  1987. ffmpeg_deps="avcodec avfilter avformat swscale swresample"
  1988. ffmpeg_select="format_filter aformat_filter
  1989. setpts_filter null_filter anull_filter"
  1990. ffplay_deps="avcodec avformat swscale swresample sdl"
  1991. ffplay_select="rdft crop_filter"
  1992. ffprobe_deps="avcodec avformat"
  1993. ffserver_deps="avformat ffm_muxer fork rtp_protocol rtsp_demuxer"
  1994. ffserver_extralibs='$ldl'
  1995. # documentation
  1996. podpages_deps="perl"
  1997. manpages_deps="perl pod2man"
  1998. htmlpages_deps="texi2html"
  1999. txtpages_deps="makeinfo"
  2000. doc_deps_any="manpages htmlpages podpages txtpages"
  2001. # default parameters
  2002. logfile="config.log"
  2003. # installation paths
  2004. prefix_default="/usr/local"
  2005. bindir_default='${prefix}/bin'
  2006. datadir_default='${prefix}/share/ffmpeg'
  2007. incdir_default='${prefix}/include'
  2008. libdir_default='${prefix}/lib'
  2009. mandir_default='${prefix}/share/man'
  2010. shlibdir_default="$libdir_default"
  2011. # toolchain
  2012. ar_default="ar"
  2013. cc_default="gcc"
  2014. cxx_default="g++"
  2015. host_cc_default="gcc"
  2016. cp_f="cp -f"
  2017. install="install"
  2018. ln_s="ln -s -f"
  2019. nm_default="nm -g"
  2020. objformat="elf"
  2021. pkg_config_default=pkg-config
  2022. ranlib="ranlib"
  2023. strip_default="strip"
  2024. yasmexe_default="yasm"
  2025. nogas=":"
  2026. # machine
  2027. arch_default=$(uname -m)
  2028. cpu="generic"
  2029. # OS
  2030. target_os_default=$(tolower $(uname -s))
  2031. host_os=$target_os_default
  2032. # configurable options
  2033. enable $PROGRAM_LIST
  2034. enable $DOCUMENT_LIST
  2035. enable $(filter_out avresample $LIBRARY_LIST)
  2036. enable stripping
  2037. enable asm
  2038. enable debug
  2039. enable doc
  2040. enable optimizations
  2041. enable runtime_cpudetect
  2042. enable safe_bitstream_reader
  2043. enable static
  2044. enable swscale_alpha
  2045. # By default, enable only those hwaccels that have no external dependencies.
  2046. enable dxva2 vdpau
  2047. # build settings
  2048. SHFLAGS='-shared -Wl,-soname,$$(@F)'
  2049. FFSERVERLDFLAGS=-Wl,-E
  2050. LIBPREF="lib"
  2051. LIBSUF=".a"
  2052. FULLNAME='$(NAME)$(BUILDSUF)'
  2053. LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
  2054. SLIBPREF="lib"
  2055. SLIBSUF=".so"
  2056. SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
  2057. SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
  2058. SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
  2059. LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
  2060. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
  2061. SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
  2062. asflags_filter=echo
  2063. cflags_filter=echo
  2064. ldflags_filter=echo
  2065. AS_C='-c'
  2066. AS_O='-o $@'
  2067. CC_C='-c'
  2068. CC_E='-E -o $@'
  2069. CC_O='-o $@'
  2070. CXX_C='-c'
  2071. CXX_O='-o $@'
  2072. LD_O='-o $@'
  2073. LD_LIB='-l%'
  2074. LD_PATH='-L'
  2075. HOSTCC_C='-c'
  2076. HOSTCC_O='-o $@'
  2077. HOSTLD_O='-o $@'
  2078. host_cflags='-O3 -g'
  2079. host_cppflags='-D_ISOC99_SOURCE -D_XOPEN_SOURCE=600'
  2080. host_libs='-lm'
  2081. host_cflags_filter=echo
  2082. host_ldflags_filter=echo
  2083. target_path='$(CURDIR)'
  2084. # since the object filename is not given with the -MM flag, the compiler
  2085. # is only able to print the basename, and we must add the path ourselves
  2086. DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
  2087. DEPFLAGS='-MM'
  2088. # find source path
  2089. if test -f configure; then
  2090. source_path=.
  2091. else
  2092. source_path=$(cd $(dirname "$0"); pwd)
  2093. echo "$source_path" | grep -q '[[:blank:]]' &&
  2094. die "Out of tree builds are impossible with whitespace in source path."
  2095. test -e "$source_path/config.h" &&
  2096. die "Out of tree builds are impossible with config.h in source dir."
  2097. fi
  2098. for v in "$@"; do
  2099. r=${v#*=}
  2100. l=${v%"$r"}
  2101. r=$(sh_quote "$r")
  2102. FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
  2103. done
  2104. find_things(){
  2105. thing=$1
  2106. pattern=$2
  2107. file=$source_path/$3
  2108. sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
  2109. }
  2110. ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
  2111. DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
  2112. HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
  2113. PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
  2114. BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
  2115. MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
  2116. DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
  2117. OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
  2118. INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
  2119. PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
  2120. FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
  2121. ALL_COMPONENTS="
  2122. $BSF_LIST
  2123. $DECODER_LIST
  2124. $DEMUXER_LIST
  2125. $ENCODER_LIST
  2126. $FILTER_LIST
  2127. $HWACCEL_LIST
  2128. $INDEV_LIST
  2129. $MUXER_LIST
  2130. $OUTDEV_LIST
  2131. $PARSER_LIST
  2132. $PROTOCOL_LIST
  2133. "
  2134. for n in $COMPONENT_LIST; do
  2135. v=$(toupper ${n%s})_LIST
  2136. eval enable \$$v
  2137. eval ${n}_if_any="\$$v"
  2138. done
  2139. enable $ARCH_EXT_LIST
  2140. die_unknown(){
  2141. echo "Unknown option \"$1\"."
  2142. echo "See $0 --help for available options."
  2143. exit 1
  2144. }
  2145. print_3_columns() {
  2146. cat | tr ' ' '\n' | sort | pr -r -3 -t
  2147. }
  2148. show_list() {
  2149. suffix=_$1
  2150. shift
  2151. echo $* | sed s/$suffix//g | print_3_columns
  2152. exit 0
  2153. }
  2154. rand_list(){
  2155. IFS=', '
  2156. set -- $*
  2157. unset IFS
  2158. for thing; do
  2159. comp=${thing%:*}
  2160. prob=${thing#$comp}
  2161. prob=${prob#:}
  2162. is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
  2163. echo "prob ${prob:-0.5}"
  2164. printf '%s\n' $comp
  2165. done
  2166. }
  2167. do_random(){
  2168. action=$1
  2169. shift
  2170. random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
  2171. $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
  2172. }
  2173. for opt do
  2174. optval="${opt#*=}"
  2175. case "$opt" in
  2176. --extra-ldflags=*)
  2177. add_ldflags $optval
  2178. ;;
  2179. --extra-libs=*)
  2180. add_extralibs $optval
  2181. ;;
  2182. --disable-devices)
  2183. disable $INDEV_LIST $OUTDEV_LIST
  2184. ;;
  2185. --enable-debug=*)
  2186. debuglevel="$optval"
  2187. ;;
  2188. --disable-programs)
  2189. disable $PROGRAM_LIST
  2190. ;;
  2191. --disable-everything)
  2192. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2193. ;;
  2194. --disable-all)
  2195. map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
  2196. disable $LIBRARY_LIST $PROGRAM_LIST doc
  2197. ;;
  2198. --enable-random|--disable-random)
  2199. action=${opt%%-random}
  2200. do_random ${action#--} $COMPONENT_LIST
  2201. ;;
  2202. --enable-random=*|--disable-random=*)
  2203. action=${opt%%-random=*}
  2204. do_random ${action#--} $optval
  2205. ;;
  2206. --enable-*=*|--disable-*=*)
  2207. eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
  2208. is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
  2209. eval list=\$$(toupper $thing)_LIST
  2210. name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
  2211. list=$(filter "$name" $list)
  2212. [ "$list" = "" ] && warn "Option $opt did not match anything"
  2213. $action $list
  2214. ;;
  2215. --enable-?*|--disable-?*)
  2216. eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
  2217. if is_in $option $COMPONENT_LIST; then
  2218. test $action = disable && action=unset
  2219. eval $action \$$(toupper ${option%s})_LIST
  2220. elif is_in $option $CMDLINE_SELECT; then
  2221. $action $option
  2222. else
  2223. die_unknown $opt
  2224. fi
  2225. ;;
  2226. --list-*)
  2227. NAME="${opt#--list-}"
  2228. is_in $NAME $COMPONENT_LIST || die_unknown $opt
  2229. NAME=${NAME%s}
  2230. eval show_list $NAME \$$(toupper $NAME)_LIST
  2231. ;;
  2232. --help|-h) show_help
  2233. ;;
  2234. --fatal-warnings) enable fatal_warnings
  2235. ;;
  2236. *)
  2237. optname="${opt%%=*}"
  2238. optname="${optname#--}"
  2239. optname=$(echo "$optname" | sed 's/-/_/g')
  2240. if is_in $optname $CMDLINE_SET; then
  2241. eval $optname='$optval'
  2242. elif is_in $optname $CMDLINE_APPEND; then
  2243. append $optname "$optval"
  2244. else
  2245. die_unknown $opt
  2246. fi
  2247. ;;
  2248. esac
  2249. done
  2250. disabled logging && logfile=/dev/null
  2251. echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
  2252. set >> $logfile
  2253. test -n "$cross_prefix" && enable cross_compile
  2254. if enabled cross_compile; then
  2255. test -n "$arch" && test -n "$target_os" ||
  2256. die "Must specify target arch and OS when cross-compiling"
  2257. fi
  2258. ar_default="${cross_prefix}${ar_default}"
  2259. cc_default="${cross_prefix}${cc_default}"
  2260. cxx_default="${cross_prefix}${cxx_default}"
  2261. nm_default="${cross_prefix}${nm_default}"
  2262. pkg_config_default="${cross_prefix}${pkg_config_default}"
  2263. ranlib="${cross_prefix}${ranlib}"
  2264. strip_default="${cross_prefix}${strip_default}"
  2265. sysinclude_default="${sysroot}/usr/include"
  2266. case "$toolchain" in
  2267. clang-asan)
  2268. cc_default="clang"
  2269. add_cflags -fsanitize=address
  2270. add_ldflags -fsanitize=address
  2271. ;;
  2272. clang-tsan)
  2273. cc_default="clang"
  2274. add_cflags -fsanitize=thread -pie
  2275. add_ldflags -fsanitize=thread -pie
  2276. ;;
  2277. msvc)
  2278. cc_default="c99wrap cl"
  2279. ld_default="c99wrap link"
  2280. nm_default="dumpbin -symbols"
  2281. ar_default="lib"
  2282. target_os_default="win32"
  2283. ;;
  2284. gcov)
  2285. add_cflags -fprofile-arcs -ftest-coverage
  2286. add_ldflags -fprofile-arcs -ftest-coverage
  2287. ;;
  2288. ?*)
  2289. die "Unknown toolchain $toolchain"
  2290. ;;
  2291. esac
  2292. set_default arch cc cxx pkg_config strip sysinclude target_os yasmexe
  2293. enabled cross_compile || host_cc_default=$cc
  2294. set_default host_cc
  2295. if ! $pkg_config --version >/dev/null 2>&1; then
  2296. warn "$pkg_config not found, library detection may fail."
  2297. pkg_config=false
  2298. fi
  2299. exesuf() {
  2300. case $1 in
  2301. mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
  2302. esac
  2303. }
  2304. EXESUF=$(exesuf $target_os)
  2305. HOSTEXESUF=$(exesuf $host_os)
  2306. # set temporary file name
  2307. : ${TMPDIR:=$TEMPDIR}
  2308. : ${TMPDIR:=$TMP}
  2309. : ${TMPDIR:=/tmp}
  2310. if ! check_cmd mktemp -u XXXXXX; then
  2311. # simple replacement for missing mktemp
  2312. # NOT SAFE FOR GENERAL USE
  2313. mktemp(){
  2314. echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
  2315. }
  2316. fi
  2317. tmpfile(){
  2318. tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
  2319. (set -C; exec > $tmp) 2>/dev/null ||
  2320. die "Unable to create temporary file in $TMPDIR."
  2321. append TMPFILES $tmp
  2322. eval $1=$tmp
  2323. }
  2324. trap 'rm -f -- $TMPFILES' EXIT
  2325. tmpfile TMPASM .asm
  2326. tmpfile TMPC .c
  2327. tmpfile TMPCPP .cpp
  2328. tmpfile TMPE $EXESUF
  2329. tmpfile TMPH .h
  2330. tmpfile TMPO .o
  2331. tmpfile TMPS .S
  2332. tmpfile TMPSH .sh
  2333. tmpfile TMPV .ver
  2334. unset -f mktemp
  2335. chmod +x $TMPE
  2336. # make sure we can execute files in $TMPDIR
  2337. cat > $TMPSH 2>> $logfile <<EOF
  2338. #! /bin/sh
  2339. EOF
  2340. chmod +x $TMPSH >> $logfile 2>&1
  2341. if ! $TMPSH >> $logfile 2>&1; then
  2342. cat <<EOF
  2343. Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
  2344. variable to another directory and make sure that it is not mounted noexec.
  2345. EOF
  2346. die "Sanity test failed."
  2347. fi
  2348. ccc_flags(){
  2349. for flag; do
  2350. case $flag in
  2351. -std=c99) echo -c99 ;;
  2352. -mcpu=*) echo -arch ${flag#*=} ;;
  2353. -mieee) echo -ieee ;;
  2354. -O*|-fast) echo $flag ;;
  2355. -fno-math-errno) echo -assume nomath_errno ;;
  2356. -g) echo -g3 ;;
  2357. -Wall) echo -msg_enable level2 ;;
  2358. -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
  2359. -Wl,*) echo $flag ;;
  2360. -f*|-W*) ;;
  2361. *) echo $flag ;;
  2362. esac
  2363. done
  2364. }
  2365. msvc_flags(){
  2366. for flag; do
  2367. case $flag in
  2368. -fomit-frame-pointer) echo -Oy ;;
  2369. -g) echo -Z7 ;;
  2370. -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
  2371. -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
  2372. -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
  2373. -wd4554 \
  2374. -wd4996 -wd4273 ;;
  2375. -std=c99) ;;
  2376. -fno-math-errno) ;;
  2377. -fno-common) ;;
  2378. -fno-signed-zeros) ;;
  2379. -fPIC) ;;
  2380. -lz) echo zlib.lib ;;
  2381. -lavifil32) echo vfw32.lib ;;
  2382. -lavicap32) echo vfw32.lib user32.lib ;;
  2383. -l*) echo ${flag#-l}.lib ;;
  2384. *) echo $flag ;;
  2385. esac
  2386. done
  2387. }
  2388. pgi_flags(){
  2389. for flag; do
  2390. case $flag in
  2391. -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
  2392. -fomit-frame-pointer) echo -Mnoframe ;;
  2393. -g) echo -gopt ;;
  2394. *) echo $flag ;;
  2395. esac
  2396. done
  2397. }
  2398. suncc_flags(){
  2399. for flag; do
  2400. case $flag in
  2401. -march=*|-mcpu=*)
  2402. case "${flag#*=}" in
  2403. native) echo -xtarget=native ;;
  2404. v9|niagara) echo -xarch=sparc ;;
  2405. ultrasparc) echo -xarch=sparcvis ;;
  2406. ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
  2407. i586|pentium) echo -xchip=pentium ;;
  2408. i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
  2409. pentium3*|c3-2) echo -xtarget=pentium3 ;;
  2410. pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
  2411. pentium4*) echo -xtarget=pentium4 ;;
  2412. prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
  2413. *-sse3) echo -xarch=sse3 ;;
  2414. core2) echo -xarch=ssse3 -xchip=core2 ;;
  2415. corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
  2416. corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
  2417. amdfam10|barcelona) echo -xtarget=barcelona ;;
  2418. bdver*) echo -xarch=avx ;;
  2419. athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
  2420. k8|opteron|athlon64|athlon-fx)
  2421. echo -xarch=sse2a ;;
  2422. athlon*) echo -xarch=pentium_proa ;;
  2423. esac
  2424. ;;
  2425. -std=c99) echo -xc99 ;;
  2426. -fomit-frame-pointer) echo -xregs=frameptr ;;
  2427. -fPIC) echo -KPIC -xcode=pic32 ;;
  2428. -W*,*) echo $flag ;;
  2429. -f*-*|-W*|-mimpure-text) ;;
  2430. -shared) echo -G ;;
  2431. *) echo $flag ;;
  2432. esac
  2433. done
  2434. }
  2435. tms470_flags(){
  2436. for flag; do
  2437. case $flag in
  2438. -march=*|-mcpu=*)
  2439. case "${flag#*=}" in
  2440. armv7-a|cortex-a*) echo -mv=7a8 ;;
  2441. armv7-r|cortex-r*) echo -mv=7r4 ;;
  2442. armv7-m|cortex-m*) echo -mv=7m3 ;;
  2443. armv6*|arm11*) echo -mv=6 ;;
  2444. armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
  2445. echo -mv=5e ;;
  2446. armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
  2447. esac
  2448. ;;
  2449. -mfpu=neon) echo --float_support=vfpv3 --neon ;;
  2450. -mfpu=vfp) echo --float_support=vfpv2 ;;
  2451. -mfpu=vfpv3) echo --float_support=vfpv3 ;;
  2452. -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
  2453. -msoft-float) echo --float_support=vfplib ;;
  2454. -O[0-3]|-mf=*) echo $flag ;;
  2455. -g) echo -g -mn ;;
  2456. -pds=*) echo $flag ;;
  2457. -D*|-I*) echo $flag ;;
  2458. --gcc|--abi=*) echo $flag ;;
  2459. -me) echo $flag ;;
  2460. esac
  2461. done
  2462. }
  2463. probe_cc(){
  2464. pfx=$1
  2465. _cc=$2
  2466. unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
  2467. unset _ld_o _ldflags _ld_lib _ld_path
  2468. unset _depflags _DEPCMD _DEPFLAGS
  2469. _flags_filter=echo
  2470. if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
  2471. _type=llvm_gcc
  2472. gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
  2473. _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
  2474. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2475. _cflags_speed='-O3'
  2476. _cflags_size='-Os'
  2477. elif $_cc -v 2>&1 | grep -qi ^gcc; then
  2478. _type=gcc
  2479. gcc_version=$($_cc --version | head -n1)
  2480. gcc_basever=$($_cc -dumpversion)
  2481. gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
  2482. gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
  2483. _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
  2484. if ! $_cc -dumpversion | grep -q '^2\.'; then
  2485. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2486. fi
  2487. _cflags_speed='-O3'
  2488. _cflags_size='-Os'
  2489. elif $_cc --version 2>/dev/null | grep -q ^icc; then
  2490. _type=icc
  2491. _ident=$($_cc --version | head -n1)
  2492. _depflags='-MMD'
  2493. _cflags_speed='-O3'
  2494. _cflags_size='-Os'
  2495. _cflags_noopt='-O1'
  2496. elif $_cc -v 2>&1 | grep -q xlc; then
  2497. _type=xlc
  2498. _ident=$($_cc -qversion 2>/dev/null | head -n1)
  2499. _cflags_speed='-O5'
  2500. _cflags_size='-O5 -qcompact'
  2501. elif $_cc -V 2>/dev/null | grep -q Compaq; then
  2502. _type=ccc
  2503. _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
  2504. _DEPFLAGS='-M'
  2505. _cflags_speed='-fast'
  2506. _cflags_size='-O1'
  2507. _flags_filter=ccc_flags
  2508. elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
  2509. test -d "$sysroot" || die "No valid sysroot specified."
  2510. _type=armcc
  2511. _ident=$($_cc --vsn | head -n1)
  2512. armcc_conf="$PWD/armcc.conf"
  2513. $_cc --arm_linux_configure \
  2514. --arm_linux_config_file="$armcc_conf" \
  2515. --configure_sysroot="$sysroot" \
  2516. --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
  2517. die "Error creating armcc configuration file."
  2518. $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
  2519. _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
  2520. as_default="${cross_prefix}gcc"
  2521. _depflags='-MMD'
  2522. _cflags_speed='-O3'
  2523. _cflags_size='-Os'
  2524. elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
  2525. _type=tms470
  2526. _ident=$($_cc -version | head -n1 | tr -s ' ')
  2527. _flags='--gcc --abi=eabi -me'
  2528. _cc_e='-ppl -fe=$@'
  2529. _cc_o='-fe=$@'
  2530. _depflags='-ppa -ppd=$(@:.o=.d)'
  2531. _cflags_speed='-O3 -mf=5'
  2532. _cflags_size='-O3 -mf=2'
  2533. _flags_filter=tms470_flags
  2534. elif $_cc -v 2>&1 | grep -q clang; then
  2535. _type=clang
  2536. _ident=$($_cc --version | head -n1)
  2537. _depflags='-MMD'
  2538. _cflags_speed='-O3'
  2539. _cflags_size='-Os'
  2540. elif $_cc -V 2>&1 | grep -q Sun; then
  2541. _type=suncc
  2542. _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
  2543. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
  2544. _DEPFLAGS='-xM1 -xc99'
  2545. _ldflags='-std=c99'
  2546. _cflags_speed='-O5'
  2547. _cflags_size='-O5 -xspace'
  2548. _flags_filter=suncc_flags
  2549. elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
  2550. _type=pathscale
  2551. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2552. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2553. _cflags_speed='-O2'
  2554. _cflags_size='-Os'
  2555. _flags_filter='filter_out -Wdisabled-optimization'
  2556. elif $_cc -v 2>&1 | grep -q Open64; then
  2557. _type=open64
  2558. _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
  2559. _depflags='-MMD -MF $(@:.o=.d) -MT $@'
  2560. _cflags_speed='-O2'
  2561. _cflags_size='-Os'
  2562. _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
  2563. elif $_cc -V 2>&1 | grep -q Portland; then
  2564. _type=pgi
  2565. _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
  2566. opt_common='-alias=ansi -Mdse -Mlre -Mpre'
  2567. _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
  2568. _cflags_size="-O2 -Munroll=c:1 $opt_common"
  2569. _cflags_noopt="-O1"
  2570. _flags_filter=pgi_flags
  2571. elif $_cc 2>&1 | grep -q Microsoft; then
  2572. _type=msvc
  2573. _ident=$($cc 2>&1 | head -n1)
  2574. _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
  2575. _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
  2576. _cflags_speed="-O2"
  2577. _cflags_size="-O1"
  2578. # Nonstandard output options, to avoid msys path conversion issues, relies on wrapper to remap it
  2579. if $_cc 2>&1 | grep -q Linker; then
  2580. _ld_o='-out $@'
  2581. else
  2582. _ld_o='-Fe$@'
  2583. fi
  2584. _cc_o='-Fo $@'
  2585. _cc_e='-P -Fi $@'
  2586. _flags_filter=msvc_flags
  2587. _ld_lib='lib%.a'
  2588. _ld_path='-libpath:'
  2589. _flags='-nologo'
  2590. _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2591. if [ $pfx = hostcc ]; then
  2592. append _cflags -Dsnprintf=_snprintf
  2593. fi
  2594. disable stripping
  2595. fi
  2596. eval ${pfx}_type=\$_type
  2597. eval ${pfx}_ident=\$_ident
  2598. }
  2599. set_ccvars(){
  2600. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2601. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2602. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2603. if [ -n "$_depflags" ]; then
  2604. eval ${1}_DEPFLAGS=\$_depflags
  2605. else
  2606. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2607. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2608. eval DEP${1}FLAGS=\$_flags
  2609. fi
  2610. }
  2611. probe_cc cc "$cc"
  2612. cflags_filter=$_flags_filter
  2613. cflags_speed=$_cflags_speed
  2614. cflags_size=$_cflags_size
  2615. cflags_noopt=$_cflags_noopt
  2616. add_cflags $_flags $_cflags
  2617. cc_ldflags=$_ldflags
  2618. set_ccvars CC
  2619. probe_cc hostcc "$host_cc"
  2620. host_cflags_filter=$_flags_filter
  2621. add_host_cflags $_flags $_cflags
  2622. set_ccvars HOSTCC
  2623. test -n "$cc_type" && enable $cc_type ||
  2624. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2625. : ${as_default:=$cc}
  2626. : ${dep_cc_default:=$cc}
  2627. : ${ld_default:=$cc}
  2628. : ${host_ld_default:=$host_cc}
  2629. set_default ar as dep_cc ld host_ld
  2630. probe_cc as "$as"
  2631. asflags_filter=$_flags_filter
  2632. add_asflags $_flags $_cflags
  2633. set_ccvars AS
  2634. probe_cc ld "$ld"
  2635. ldflags_filter=$_flags_filter
  2636. add_ldflags $_flags $_ldflags
  2637. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2638. LD_O=${_ld_o-$LD_O}
  2639. LD_LIB=${_ld_lib-$LD_LIB}
  2640. LD_PATH=${_ld_path-$LD_PATH}
  2641. probe_cc hostld "$host_ld"
  2642. host_ldflags_filter=$_flags_filter
  2643. add_host_ldflags $_flags $_ldflags
  2644. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2645. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2646. probe_cc depcc "$dep_cc"
  2647. CCDEP=${_DEPCMD:-$DEPCMD}
  2648. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2649. DEPCCFLAGS=$_flags
  2650. fi
  2651. if $ar 2>&1 | grep -q Microsoft; then
  2652. arflags="-nologo"
  2653. ar_o='-out:$@'
  2654. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2655. arflags="rq"
  2656. ar_o='$@'
  2657. else
  2658. arflags="rc"
  2659. ar_o='$@'
  2660. fi
  2661. add_cflags $extra_cflags
  2662. add_cxxflags $extra_cxxflags
  2663. add_asflags $extra_cflags
  2664. if test -n "$sysroot"; then
  2665. case "$cc_type" in
  2666. gcc|llvm_gcc|clang)
  2667. add_cppflags --sysroot="$sysroot"
  2668. add_ldflags --sysroot="$sysroot"
  2669. ;;
  2670. tms470)
  2671. add_cppflags -I"$sysinclude"
  2672. add_ldflags --sysroot="$sysroot"
  2673. ;;
  2674. esac
  2675. fi
  2676. if test "$cpu" = host; then
  2677. enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
  2678. case "$cc_type" in
  2679. gcc|llvm_gcc)
  2680. check_native(){
  2681. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2682. sed -n "/cc1.*$1=/{
  2683. s/.*$1=\\([^ ]*\\).*/\\1/
  2684. p
  2685. q
  2686. }" $TMPE
  2687. }
  2688. cpu=$(check_native -march || check_native -mcpu)
  2689. ;;
  2690. esac
  2691. test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
  2692. fi
  2693. # Deal with common $arch aliases
  2694. case "$arch" in
  2695. aarch64|arm64)
  2696. arch="aarch64"
  2697. ;;
  2698. arm*|iPad*)
  2699. arch="arm"
  2700. ;;
  2701. mips*|IP*)
  2702. arch="mips"
  2703. ;;
  2704. parisc*|hppa*)
  2705. arch="parisc"
  2706. ;;
  2707. "Power Macintosh"|ppc*|powerpc*)
  2708. arch="ppc"
  2709. ;;
  2710. s390|s390x)
  2711. arch="s390"
  2712. ;;
  2713. sh4|sh)
  2714. arch="sh4"
  2715. ;;
  2716. sun4u|sparc*)
  2717. arch="sparc"
  2718. ;;
  2719. tilegx|tile-gx)
  2720. arch="tilegx"
  2721. ;;
  2722. i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  2723. arch="x86"
  2724. ;;
  2725. esac
  2726. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2727. enable $arch
  2728. # Add processor-specific flags
  2729. if enabled aarch64; then
  2730. case $cpu in
  2731. armv*)
  2732. cpuflags="-march=$cpu"
  2733. ;;
  2734. *)
  2735. cpuflags="-mcpu=$cpu"
  2736. ;;
  2737. esac
  2738. elif enabled alpha; then
  2739. cpuflags="-mcpu=$cpu"
  2740. elif enabled arm; then
  2741. check_arm_arch() {
  2742. check_cpp_condition stddef.h \
  2743. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  2744. $cpuflags
  2745. }
  2746. probe_arm_arch() {
  2747. if check_arm_arch 4; then echo armv4;
  2748. elif check_arm_arch 4T; then echo armv4t;
  2749. elif check_arm_arch 5; then echo armv5;
  2750. elif check_arm_arch 5E; then echo armv5e;
  2751. elif check_arm_arch 5T; then echo armv5t;
  2752. elif check_arm_arch 5TE; then echo armv5te;
  2753. elif check_arm_arch 5TEJ; then echo armv5te;
  2754. elif check_arm_arch 6; then echo armv6;
  2755. elif check_arm_arch 6J; then echo armv6j;
  2756. elif check_arm_arch 6K; then echo armv6k;
  2757. elif check_arm_arch 6Z; then echo armv6z;
  2758. elif check_arm_arch 6ZK; then echo armv6zk;
  2759. elif check_arm_arch 6T2; then echo armv6t2;
  2760. elif check_arm_arch 7; then echo armv7;
  2761. elif check_arm_arch 7A 7_A; then echo armv7-a;
  2762. elif check_arm_arch 7R 7_R; then echo armv7-r;
  2763. elif check_arm_arch 7M 7_M; then echo armv7-m;
  2764. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  2765. elif check_arm_arch 8A 8_A; then echo armv8-a;
  2766. fi
  2767. }
  2768. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  2769. case $cpu in
  2770. armv*)
  2771. cpuflags="-march=$cpu"
  2772. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2773. ;;
  2774. *)
  2775. cpuflags="-mcpu=$cpu"
  2776. case $cpu in
  2777. cortex-a*) subarch=armv7a ;;
  2778. cortex-r*) subarch=armv7r ;;
  2779. cortex-m*) enable thumb; subarch=armv7m ;;
  2780. arm11*) subarch=armv6 ;;
  2781. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2782. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2783. *) subarch=$(probe_arm_arch) ;;
  2784. esac
  2785. ;;
  2786. esac
  2787. case "$subarch" in
  2788. armv5t*) enable fast_clz ;;
  2789. armv[6-8]*) enable fast_clz fast_unaligned ;;
  2790. esac
  2791. elif enabled avr32; then
  2792. case $cpu in
  2793. ap7[02]0[0-2])
  2794. subarch="avr32_ap"
  2795. cpuflags="-mpart=$cpu"
  2796. ;;
  2797. ap)
  2798. subarch="avr32_ap"
  2799. cpuflags="-march=$cpu"
  2800. ;;
  2801. uc3[ab]*)
  2802. subarch="avr32_uc"
  2803. cpuflags="-mcpu=$cpu"
  2804. ;;
  2805. uc)
  2806. subarch="avr32_uc"
  2807. cpuflags="-march=$cpu"
  2808. ;;
  2809. esac
  2810. elif enabled bfin; then
  2811. cpuflags="-mcpu=$cpu"
  2812. elif enabled mips; then
  2813. cpuflags="-march=$cpu"
  2814. case $cpu in
  2815. 24kc)
  2816. disable mipsfpu
  2817. disable mipsdspr1
  2818. disable mipsdspr2
  2819. ;;
  2820. 24kf*)
  2821. disable mipsdspr1
  2822. disable mipsdspr2
  2823. ;;
  2824. 24kec|34kc|1004kc)
  2825. disable mipsfpu
  2826. disable mipsdspr2
  2827. ;;
  2828. 24kef*|34kf*|1004kf*)
  2829. disable mipsdspr2
  2830. ;;
  2831. 74kc)
  2832. disable mipsfpu
  2833. ;;
  2834. esac
  2835. elif enabled ppc; then
  2836. case $(tolower $cpu) in
  2837. 601|ppc601|powerpc601)
  2838. cpuflags="-mcpu=601"
  2839. disable altivec
  2840. ;;
  2841. 603*|ppc603*|powerpc603*)
  2842. cpuflags="-mcpu=603"
  2843. disable altivec
  2844. ;;
  2845. 604*|ppc604*|powerpc604*)
  2846. cpuflags="-mcpu=604"
  2847. disable altivec
  2848. ;;
  2849. g3|75*|ppc75*|powerpc75*)
  2850. cpuflags="-mcpu=750"
  2851. disable altivec
  2852. ;;
  2853. g4|745*|ppc745*|powerpc745*)
  2854. cpuflags="-mcpu=7450"
  2855. ;;
  2856. 74*|ppc74*|powerpc74*)
  2857. cpuflags="-mcpu=7400"
  2858. ;;
  2859. g5|970|ppc970|powerpc970)
  2860. cpuflags="-mcpu=970"
  2861. ;;
  2862. power[3-7]*)
  2863. cpuflags="-mcpu=$cpu"
  2864. ;;
  2865. cell)
  2866. cpuflags="-mcpu=cell"
  2867. enable ldbrx
  2868. ;;
  2869. e500mc)
  2870. cpuflags="-mcpu=e500mc"
  2871. disable altivec
  2872. ;;
  2873. e500v2)
  2874. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2875. disable altivec
  2876. ;;
  2877. e500)
  2878. cpuflags="-mcpu=8540 -mhard-float"
  2879. disable altivec
  2880. ;;
  2881. esac
  2882. elif enabled sparc; then
  2883. case $cpu in
  2884. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  2885. cpuflags="-mcpu=$cpu"
  2886. disable vis
  2887. ;;
  2888. ultrasparc*|niagara[234])
  2889. cpuflags="-mcpu=$cpu"
  2890. ;;
  2891. esac
  2892. elif enabled x86; then
  2893. case $cpu in
  2894. i[345]86|pentium)
  2895. cpuflags="-march=$cpu"
  2896. disable mmx
  2897. ;;
  2898. # targets that do NOT support conditional mov (cmov)
  2899. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  2900. cpuflags="-march=$cpu"
  2901. disable cmov
  2902. ;;
  2903. # targets that do support conditional mov (cmov)
  2904. 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*)
  2905. cpuflags="-march=$cpu"
  2906. enable cmov
  2907. enable fast_cmov
  2908. ;;
  2909. # targets that do support conditional mov but on which it's slow
  2910. pentium4|pentium4m|prescott|nocona)
  2911. cpuflags="-march=$cpu"
  2912. enable cmov
  2913. disable fast_cmov
  2914. ;;
  2915. esac
  2916. fi
  2917. if [ "$cpu" != generic ]; then
  2918. add_cflags $cpuflags
  2919. add_asflags $cpuflags
  2920. fi
  2921. # compiler sanity check
  2922. check_exec <<EOF
  2923. int main(void){ return 0; }
  2924. EOF
  2925. if test "$?" != 0; then
  2926. echo "$cc is unable to create an executable file."
  2927. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  2928. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  2929. echo "Only do this if you know what cross compiling means."
  2930. fi
  2931. die "C compiler test failed."
  2932. fi
  2933. add_cppflags -D_ISOC99_SOURCE
  2934. add_cxxflags -D__STDC_CONSTANT_MACROS
  2935. check_cflags -std=c99
  2936. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  2937. #include <stdlib.h>
  2938. EOF
  2939. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  2940. #include <stdlib.h>
  2941. EOF
  2942. check_host_cflags -std=c99
  2943. check_host_cflags -Wall
  2944. check_64bit(){
  2945. arch32=$1
  2946. arch64=$2
  2947. expr=$3
  2948. check_code cc "" "int test[2*($expr) - 1]" &&
  2949. subarch=$arch64 || subarch=$arch32
  2950. }
  2951. case "$arch" in
  2952. aarch64|alpha|ia64)
  2953. spic=$shared
  2954. ;;
  2955. mips)
  2956. check_64bit mips mips64 '_MIPS_SIM > 1'
  2957. spic=$shared
  2958. ;;
  2959. parisc)
  2960. check_64bit parisc parisc64 'sizeof(void *) > 4'
  2961. spic=$shared
  2962. ;;
  2963. ppc)
  2964. check_64bit ppc ppc64 'sizeof(void *) > 4'
  2965. spic=$shared
  2966. ;;
  2967. sparc)
  2968. check_64bit sparc sparc64 'sizeof(void *) > 4'
  2969. spic=$shared
  2970. ;;
  2971. x86)
  2972. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  2973. if test "$subarch" = "x86_64"; then
  2974. spic=$shared
  2975. fi
  2976. ;;
  2977. ppc)
  2978. check_cc <<EOF && subarch="ppc64"
  2979. int test[(int)sizeof(char*) - 7];
  2980. EOF
  2981. ;;
  2982. esac
  2983. enable $subarch
  2984. enabled spic && enable pic
  2985. # OS specific
  2986. case $target_os in
  2987. haiku)
  2988. prefix_default="/boot/common"
  2989. network_extralibs="-lnetwork"
  2990. host_libs=
  2991. ;;
  2992. sunos)
  2993. FFSERVERLDFLAGS=""
  2994. SHFLAGS='-shared -Wl,-h,$$(@F)'
  2995. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  2996. network_extralibs="-lsocket -lnsl"
  2997. add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  2998. # When using suncc to build, the Solaris linker will mark
  2999. # an executable with each instruction set encountered by
  3000. # the Solaris assembler. As our libraries contain their own
  3001. # guards for processor-specific code, instead suppress
  3002. # generation of the HWCAPS ELF section on Solaris x86 only.
  3003. enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
  3004. nm_default='nm -P -g'
  3005. ;;
  3006. netbsd)
  3007. disable symver
  3008. oss_indev_extralibs="-lossaudio"
  3009. oss_outdev_extralibs="-lossaudio"
  3010. enabled gcc || check_ldflags -Wl,-zmuldefs
  3011. ;;
  3012. openbsd|bitrig)
  3013. disable symver
  3014. SHFLAGS='-shared'
  3015. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3016. SLIB_INSTALL_LINKS=
  3017. oss_indev_extralibs="-lossaudio"
  3018. oss_outdev_extralibs="-lossaudio"
  3019. ;;
  3020. dragonfly)
  3021. disable symver
  3022. ;;
  3023. freebsd)
  3024. ;;
  3025. bsd/os)
  3026. add_extralibs -lpoll -lgnugetopt
  3027. strip="strip -d"
  3028. ;;
  3029. darwin)
  3030. gas="gas-preprocessor.pl $cc"
  3031. enabled ppc && add_asflags -force_cpusubtype_ALL
  3032. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3033. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3034. strip="${strip} -x"
  3035. add_ldflags -Wl,-dynamic,-search_paths_first
  3036. SLIBSUF=".dylib"
  3037. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  3038. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  3039. FFSERVERLDFLAGS=-Wl,-bind_at_load
  3040. objformat="macho"
  3041. enabled x86_64 && objformat="macho64"
  3042. enabled_any pic shared ||
  3043. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3044. ;;
  3045. mingw32*)
  3046. if test $target_os = "mingw32ce"; then
  3047. disable network
  3048. else
  3049. target_os=mingw32
  3050. fi
  3051. LIBTARGET=i386
  3052. if enabled x86_64; then
  3053. LIBTARGET="i386:x86-64"
  3054. elif enabled arm; then
  3055. LIBTARGET=arm-wince
  3056. fi
  3057. shlibdir_default="$bindir_default"
  3058. SLIBPREF=""
  3059. SLIBSUF=".dll"
  3060. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3061. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3062. dlltool="${cross_prefix}dlltool"
  3063. if check_cmd lib.exe -list; then
  3064. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3065. if enabled x86_64; then
  3066. LIBTARGET=x64
  3067. fi
  3068. elif check_cmd $dlltool --version; then
  3069. 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)'
  3070. fi
  3071. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3072. SLIB_INSTALL_LINKS=
  3073. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3074. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3075. 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'
  3076. objformat="win32"
  3077. ranlib=:
  3078. enable dos_paths
  3079. ;;
  3080. win32|win64)
  3081. if enabled shared; then
  3082. # Link to the import library instead of the normal static library
  3083. # for shared libs.
  3084. LD_LIB='%.lib'
  3085. # Cannot build shared and static libraries at the same time with
  3086. # MSVC.
  3087. disable static
  3088. fi
  3089. shlibdir_default="$bindir_default"
  3090. SLIBPREF=""
  3091. SLIBSUF=".dll"
  3092. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3093. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3094. SLIB_CREATE_DEF_CMD='makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3095. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3096. SLIB_INSTALL_LINKS=
  3097. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3098. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3099. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3100. objformat="win32"
  3101. ranlib=:
  3102. enable dos_paths
  3103. ;;
  3104. cygwin*)
  3105. target_os=cygwin
  3106. shlibdir_default="$bindir_default"
  3107. SLIBPREF="cyg"
  3108. SLIBSUF=".dll"
  3109. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3110. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3111. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3112. SLIB_INSTALL_LINKS=
  3113. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  3114. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  3115. objformat="win32"
  3116. enable dos_paths
  3117. ;;
  3118. *-dos|freedos|opendos)
  3119. network_extralibs="-lsocket"
  3120. objformat="coff"
  3121. enable dos_paths
  3122. add_cppflags -U__STRICT_ANSI__
  3123. ;;
  3124. linux)
  3125. enable dv1394
  3126. ;;
  3127. irix*)
  3128. target_os=irix
  3129. ranlib="echo ignoring ranlib"
  3130. ;;
  3131. os/2*)
  3132. strip="lxlite -CS"
  3133. ln_s="cp -f"
  3134. objformat="aout"
  3135. add_cppflags -D_GNU_SOURCE
  3136. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  3137. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3138. FFSERVERLDFLAGS=""
  3139. LIBSUF="_s.a"
  3140. SLIBPREF=""
  3141. SLIBSUF=".dll"
  3142. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3143. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3144. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3145. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  3146. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3147. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3148. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3149. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  3150. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3151. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3152. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3153. enable dos_paths
  3154. enable_weak os2threads
  3155. ;;
  3156. gnu/kfreebsd)
  3157. add_cppflags -D_BSD_SOURCE
  3158. ;;
  3159. gnu)
  3160. ;;
  3161. qnx)
  3162. add_cppflags -D_QNX_SOURCE
  3163. network_extralibs="-lsocket"
  3164. ;;
  3165. symbian)
  3166. SLIBSUF=".dll"
  3167. enable dos_paths
  3168. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3169. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3170. add_ldflags -Wl,--target1-abs,--no-undefined \
  3171. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3172. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3173. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3174. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3175. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3176. ;;
  3177. osf1)
  3178. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  3179. FFSERVERLDFLAGS=
  3180. ;;
  3181. minix)
  3182. ;;
  3183. plan9)
  3184. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  3185. -D_REENTRANT_SOURCE \
  3186. -D_RESEARCH_SOURCE \
  3187. -DFD_SETSIZE=96 \
  3188. -DHAVE_SOCK_OPTS
  3189. add_compat strtod.o strtod=avpriv_strtod
  3190. network_extralibs='-lbsd'
  3191. exeobjs=compat/plan9/main.o
  3192. disable ffserver
  3193. cp_f='cp'
  3194. ;;
  3195. none)
  3196. ;;
  3197. *)
  3198. die "Unknown OS '$target_os'."
  3199. ;;
  3200. esac
  3201. # determine libc flavour
  3202. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3203. if check_cpp_condition features.h "defined __UCLIBC__"; then
  3204. libc_type=uclibc
  3205. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3206. elif check_cpp_condition features.h "defined __GLIBC__"; then
  3207. libc_type=glibc
  3208. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3209. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3210. elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3211. libc_type=newlib
  3212. add_cppflags -U__STRICT_ANSI__
  3213. elif check_header _mingw.h; then
  3214. libc_type=mingw
  3215. check_cpp_condition _mingw.h \
  3216. "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
  3217. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3218. die "ERROR: MinGW runtime version must be >= 3.15."
  3219. add_cppflags -U__STRICT_ANSI__
  3220. if check_cpp_condition _mingw.h "defined(__MINGW64_VERSION_MAJOR) && \
  3221. __MINGW64_VERSION_MAJOR < 3"; then
  3222. add_compat msvcrt/snprintf.o
  3223. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  3224. fi
  3225. elif check_func_headers stdlib.h _get_doserrno; then
  3226. libc_type=msvcrt
  3227. add_compat strtod.o strtod=avpriv_strtod
  3228. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3229. _snprintf=avpriv_snprintf \
  3230. vsnprintf=avpriv_vsnprintf
  3231. elif check_cpp_condition stddef.h "defined __KLIBC__"; then
  3232. libc_type=klibc
  3233. fi
  3234. test -n "$libc_type" && enable $libc_type
  3235. # hacks for compiler/libc/os combinations
  3236. if enabled_all tms470 glibc; then
  3237. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3238. add_cppflags -D__USER_LABEL_PREFIX__=
  3239. add_cppflags -D__builtin_memset=memset
  3240. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3241. add_cflags -pds=48 # incompatible redefinition of macro
  3242. fi
  3243. if enabled_all ccc glibc; then
  3244. add_ldflags -Wl,-z,now # calls to libots crash without this
  3245. fi
  3246. esc(){
  3247. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3248. }
  3249. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
  3250. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
  3251. set_default $PATHS_LIST
  3252. set_default nm
  3253. # we need to build at least one lib type
  3254. if ! enabled_any static shared; then
  3255. cat <<EOF
  3256. At least one library type must be built.
  3257. Specify --enable-static to build the static libraries or --enable-shared to
  3258. build the shared libraries as well. To only build the shared libraries specify
  3259. --disable-static in addition to --enable-shared.
  3260. EOF
  3261. exit 1;
  3262. fi
  3263. die_license_disabled() {
  3264. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  3265. }
  3266. die_license_disabled_gpl() {
  3267. enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; }
  3268. }
  3269. die_license_disabled gpl libcdio
  3270. die_license_disabled gpl libutvideo
  3271. die_license_disabled gpl libx264
  3272. die_license_disabled gpl libxavs
  3273. die_license_disabled gpl libxvid
  3274. die_license_disabled gpl x11grab
  3275. die_license_disabled nonfree libaacplus
  3276. die_license_disabled nonfree libfaac
  3277. enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
  3278. enabled gpl && die_license_disabled_gpl nonfree openssl
  3279. die_license_disabled version3 libopencore_amrnb
  3280. die_license_disabled version3 libopencore_amrwb
  3281. die_license_disabled version3 libvo_aacenc
  3282. die_license_disabled version3 libvo_amrwbenc
  3283. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3284. disabled optimizations || check_cflags -fomit-frame-pointer
  3285. enable_pic() {
  3286. enable pic
  3287. add_cppflags -DPIC
  3288. add_cflags -fPIC
  3289. add_asflags -fPIC
  3290. }
  3291. enabled pic && enable_pic
  3292. check_cc <<EOF || die "Symbol mangling check failed."
  3293. int ff_extern;
  3294. EOF
  3295. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3296. extern_prefix=${sym%%ff_extern*}
  3297. check_cc <<EOF && enable_weak inline_asm
  3298. void foo(void) { __asm__ volatile ("" ::); }
  3299. EOF
  3300. _restrict=
  3301. for restrict_keyword in restrict __restrict__ __restrict; do
  3302. check_cc <<EOF && _restrict=$restrict_keyword && break
  3303. void foo(char * $restrict_keyword p);
  3304. EOF
  3305. done
  3306. check_cc <<EOF && enable attribute_packed
  3307. struct { int x; } __attribute__((packed)) x;
  3308. EOF
  3309. check_cc <<EOF && enable attribute_may_alias
  3310. union { int x; } __attribute__((may_alias)) x;
  3311. EOF
  3312. check_cc <<EOF || die "endian test failed"
  3313. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3314. EOF
  3315. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3316. if enabled alpha; then
  3317. check_cflags -mieee
  3318. elif enabled arm; then
  3319. check_cpp_condition stddef.h "defined __thumb__" && check_cc <<EOF && enable_weak thumb
  3320. float func(float a, float b){ return a+b; }
  3321. EOF
  3322. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3323. nogas=die
  3324. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3325. enable vfp_args
  3326. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  3327. case "${cross_prefix:-$cc}" in
  3328. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3329. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3330. __asm__ (".eabi_attribute 28, 1");
  3331. int main(void) { return 0; }
  3332. EOF
  3333. esac
  3334. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3335. fi
  3336. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3337. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3338. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3339. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3340. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3341. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3342. [ $target_os = linux ] ||
  3343. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3344. $ARCH_EXT_LIST_ARM
  3345. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3346. check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  3347. enabled_all armv6t2 shared !pic && enable_pic
  3348. elif enabled mips; then
  3349. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3350. enabled mips32r2 && add_cflags "-mips32r2" && add_asflags "-mips32r2" &&
  3351. check_inline_asm mips32r2 '"rotr $t0, $t1, 1"'
  3352. enabled mipsdspr1 && add_cflags "-mdsp" && add_asflags "-mdsp" &&
  3353. check_inline_asm mipsdspr1 '"addu.qb $t0, $t1, $t2"'
  3354. enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
  3355. check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
  3356. enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
  3357. check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"'
  3358. elif enabled parisc; then
  3359. if enabled gcc; then
  3360. case $($cc -dumpversion) in
  3361. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3362. esac
  3363. fi
  3364. elif enabled ppc; then
  3365. enable local_aligned_8 local_aligned_16
  3366. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3367. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3368. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3369. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3370. # AltiVec flags: The FSF version of GCC differs from the Apple version
  3371. if enabled altivec; then
  3372. nogas=warn
  3373. check_cflags -maltivec -mabi=altivec &&
  3374. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  3375. check_cflags -faltivec
  3376. # check if our compiler supports Motorola AltiVec C API
  3377. check_cc <<EOF || disable altivec
  3378. $inc_altivec_h
  3379. int main(void) {
  3380. vector signed int v1 = (vector signed int) { 0 };
  3381. vector signed int v2 = (vector signed int) { 1 };
  3382. v1 = vec_add(v1, v2);
  3383. return 0;
  3384. }
  3385. EOF
  3386. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3387. fi
  3388. elif enabled sparc; then
  3389. enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
  3390. elif enabled x86; then
  3391. check_builtin rdtsc intrin.h "__rdtsc()"
  3392. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3393. enable local_aligned_8 local_aligned_16
  3394. # check whether EBP is available on x86
  3395. # As 'i' is stored on the stack, this program will crash
  3396. # if the base pointer is used to access it because the
  3397. # base pointer is cleared in the inline assembly code.
  3398. check_exec_crash <<EOF && enable ebp_available
  3399. volatile int i=0;
  3400. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3401. return i;
  3402. EOF
  3403. # check whether EBX is available on x86
  3404. check_inline_asm ebx_available '""::"b"(0)' &&
  3405. check_inline_asm ebx_available '"":::"%ebx"'
  3406. # check whether xmm clobbers are supported
  3407. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3408. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3409. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3410. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3411. if ! disabled_any asm mmx yasm; then
  3412. if check_cmd $yasmexe --version; then
  3413. enabled x86_64 && yasm_extra="-m amd64"
  3414. yasm_debug="-g dwarf2"
  3415. elif check_cmd nasm -v; then
  3416. yasmexe=nasm
  3417. yasm_debug="-g -F dwarf"
  3418. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3419. fi
  3420. YASMFLAGS="-f $objformat $yasm_extra"
  3421. enabled pic && append YASMFLAGS "-DPIC"
  3422. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3423. case "$objformat" in
  3424. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3425. esac
  3426. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  3427. die "yasm not found, use --disable-yasm for a crippled build"
  3428. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx_external
  3429. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  3430. check_yasm "CPU amdnop" && enable cpunop
  3431. fi
  3432. case "$cpu" in
  3433. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  3434. disable fast_clz
  3435. ;;
  3436. esac
  3437. fi
  3438. if enabled asm; then
  3439. as=${gas:=$as}
  3440. check_as <<EOF && enable gnu_as || \
  3441. $nogas "GNU assembler not found, install gas-preprocessor"
  3442. .macro m n
  3443. \n: .int 0
  3444. .endm
  3445. m x
  3446. EOF
  3447. fi
  3448. check_ldflags -Wl,--as-needed
  3449. if check_func dlopen; then
  3450. ldl=
  3451. elif check_func dlopen -ldl; then
  3452. ldl=-ldl
  3453. fi
  3454. if ! disabled network; then
  3455. check_type "sys/types.h sys/socket.h" socklen_t
  3456. check_type netdb.h "struct addrinfo"
  3457. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3458. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3459. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3460. check_type netinet/in.h "struct sockaddr_in6"
  3461. check_type poll.h "struct pollfd"
  3462. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3463. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3464. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3465. check_func getaddrinfo $network_extralibs
  3466. check_func getservbyport $network_extralibs
  3467. # Prefer arpa/inet.h over winsock2
  3468. if check_header arpa/inet.h ; then
  3469. check_func closesocket
  3470. elif check_header winsock2.h ; then
  3471. check_func_headers winsock2.h closesocket -lws2 &&
  3472. network_extralibs="-lws2" ||
  3473. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3474. network_extralibs="-lws2_32"; }
  3475. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3476. check_type ws2tcpip.h socklen_t
  3477. check_type ws2tcpip.h "struct addrinfo"
  3478. check_type ws2tcpip.h "struct group_source_req"
  3479. check_type ws2tcpip.h "struct ip_mreq_source"
  3480. check_type ws2tcpip.h "struct ipv6_mreq"
  3481. check_type winsock2.h "struct pollfd"
  3482. check_type ws2tcpip.h "struct sockaddr_in6"
  3483. check_type ws2tcpip.h "struct sockaddr_storage"
  3484. check_struct winsock2.h "struct sockaddr" sa_len
  3485. else
  3486. disable network
  3487. fi
  3488. fi
  3489. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3490. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  3491. check_func access
  3492. check_func clock_gettime || { check_func clock_gettime -lrt && add_extralibs -lrt; }
  3493. check_func fcntl
  3494. check_func fork
  3495. check_func gethrtime
  3496. check_func getopt
  3497. check_func getrusage
  3498. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3499. check_func gettimeofday
  3500. check_func inet_aton $network_extralibs
  3501. check_func isatty
  3502. check_func localtime_r
  3503. check_func ${malloc_prefix}memalign && enable memalign
  3504. check_func mkstemp
  3505. check_func mmap
  3506. check_func mprotect
  3507. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3508. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3509. check_func setrlimit
  3510. check_func strerror_r
  3511. check_func sched_getaffinity
  3512. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  3513. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  3514. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  3515. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  3516. check_func sysconf
  3517. check_func sysctl
  3518. check_func usleep
  3519. check_func_headers conio.h kbhit
  3520. check_func_headers windows.h PeekNamedPipe
  3521. check_func_headers io.h setmode
  3522. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  3523. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3524. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3525. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3526. check_func_headers windows.h GetProcessAffinityMask
  3527. check_func_headers windows.h GetProcessTimes
  3528. check_func_headers windows.h GetSystemTimeAsFileTime
  3529. check_func_headers windows.h MapViewOfFile
  3530. check_func_headers windows.h SetConsoleTextAttribute
  3531. check_func_headers windows.h Sleep
  3532. check_func_headers windows.h VirtualAlloc
  3533. check_func_headers glob.h glob
  3534. check_header direct.h
  3535. check_header dlfcn.h
  3536. check_header dxva.h
  3537. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  3538. check_header io.h
  3539. check_header libcrystalhd/libcrystalhd_if.h
  3540. check_header malloc.h
  3541. check_header poll.h
  3542. check_header sys/mman.h
  3543. check_header sys/param.h
  3544. check_header sys/resource.h
  3545. check_header sys/select.h
  3546. check_header sys/time.h
  3547. check_header termios.h
  3548. check_header unistd.h
  3549. check_header vdpau/vdpau.h
  3550. check_header vdpau/vdpau_x11.h
  3551. check_header VideoDecodeAcceleration/VDADecoder.h
  3552. check_header windows.h
  3553. check_header X11/extensions/XvMClib.h
  3554. check_header asm/types.h
  3555. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3556. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3557. if ! disabled w32threads && ! enabled pthreads; then
  3558. check_func_headers "windows.h process.h" _beginthreadex && enable w32threads
  3559. fi
  3560. # check for some common methods of building with pthread support
  3561. # do this before the optional library checks as some of them require pthreads
  3562. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  3563. enable pthreads
  3564. if check_func pthread_create; then
  3565. :
  3566. elif check_func pthread_create -pthread; then
  3567. add_cflags -pthread
  3568. add_extralibs -pthread
  3569. elif check_func pthread_create -pthreads; then
  3570. add_cflags -pthreads
  3571. add_extralibs -pthreads
  3572. elif check_func pthread_create -lpthreadGC2; then
  3573. add_extralibs -lpthreadGC2
  3574. elif ! check_lib pthread.h pthread_create -lpthread; then
  3575. disable pthreads
  3576. fi
  3577. fi
  3578. for thread in $THREADS_LIST; do
  3579. if enabled $thread; then
  3580. test -n "$thread_type" &&
  3581. die "ERROR: Only one thread type must be selected." ||
  3582. thread_type="$thread"
  3583. fi
  3584. done
  3585. if enabled pthreads; then
  3586. check_func pthread_cancel
  3587. fi
  3588. enabled sync_val_compare_and_swap && enable atomics_gcc
  3589. enabled machine_rw_barrier && enabled atomic_cas_ptr && enable atomics_suncc
  3590. enabled MemoryBarrier && enable atomics_win32
  3591. check_lib math.h sin -lm && LIBM="-lm"
  3592. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  3593. enabled vaapi && require vaapi va/va.h vaInitialize -lva
  3594. atan2f_args=2
  3595. ldexpf_args=2
  3596. powf_args=2
  3597. for func in $MATH_FUNCS; do
  3598. eval check_mathfunc $func \${${func}_args:-1}
  3599. done
  3600. # these are off by default, so fail if requested and not available
  3601. enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } ||
  3602. { check_lib2 "dlfcn.h" dlopen -ldl; } ||
  3603. die "ERROR: LoadLibrary/dlopen not found for avisynth"; }
  3604. enabled fontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  3605. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3606. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3607. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  3608. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  3609. enabled libass && require_pkg_config libass ass/ass.h ass_library_init
  3610. enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray
  3611. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  3612. { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
  3613. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  3614. enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
  3615. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  3616. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  3617. 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"
  3618. enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
  3619. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  3620. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  3621. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  3622. done || die "ERROR: libgsm not found"; }
  3623. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  3624. enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
  3625. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  3626. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  3627. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  3628. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  3629. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  3630. enabled libopenjpeg && { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg ||
  3631. check_lib openjpeg.h opj_version -lopenjpeg ||
  3632. die "ERROR: libopenjpeg not found"; }
  3633. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  3634. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  3635. enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
  3636. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  3637. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  3638. enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_frame
  3639. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  3640. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  3641. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  3642. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  3643. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
  3644. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  3645. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  3646. { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  3647. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  3648. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  3649. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  3650. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  3651. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  3652. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  3653. enabled libvpx && {
  3654. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  3655. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  3656. 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 ||
  3657. die "ERROR: libvpx encoder version must be >=0.9.7"; }
  3658. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  3659. enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } }
  3660. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  3661. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  3662. die "ERROR: libx264 must be installed and version must be >= 0.118."; }
  3663. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  3664. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  3665. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  3666. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  3667. die "ERROR: openal not found"; } &&
  3668. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  3669. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  3670. enabled opencl && require2 opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL
  3671. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  3672. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  3673. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  3674. die "ERROR: openssl not found"; }
  3675. if enabled gnutls; then
  3676. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  3677. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  3678. fi
  3679. # libdc1394 check
  3680. if enabled libdc1394; then
  3681. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  3682. enable libdc1394_2; } ||
  3683. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  3684. enable libdc1394_1; } ||
  3685. die "ERROR: No version of libdc1394 found "
  3686. fi
  3687. SDL_CONFIG="${cross_prefix}sdl-config"
  3688. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3689. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3690. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  3691. enable sdl
  3692. else
  3693. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  3694. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  3695. sdl_libs=$("${SDL_CONFIG}" --libs)
  3696. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  3697. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3698. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  3699. enable sdl
  3700. fi
  3701. fi
  3702. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  3703. texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  3704. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  3705. perl --version > /dev/null 2>&1 && enable perl || disable perl
  3706. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  3707. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  3708. check_header linux/fb.h
  3709. check_header linux/videodev.h
  3710. check_header linux/videodev2.h
  3711. check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  3712. check_header sys/videoio.h
  3713. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  3714. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  3715. # w32api 3.12 had it defined wrong
  3716. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  3717. check_type "dshow.h" IBaseFilter
  3718. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  3719. { check_header dev/bktr/ioctl_meteor.h &&
  3720. check_header dev/bktr/ioctl_bt848.h; } ||
  3721. { check_header machine/ioctl_meteor.h &&
  3722. check_header machine/ioctl_bt848.h; } ||
  3723. { check_header dev/video/meteor/ioctl_meteor.h &&
  3724. check_header dev/video/bktr/ioctl_bt848.h; } ||
  3725. check_header dev/ic/bt8xx.h
  3726. check_header sndio.h
  3727. if check_struct sys/soundcard.h audio_buf_info bytes; then
  3728. enable_safe sys/soundcard.h
  3729. else
  3730. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  3731. #include <sys/soundcard.h>
  3732. audio_buf_info abc;
  3733. EOF
  3734. fi
  3735. check_header soundcard.h
  3736. enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  3737. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait &&
  3738. check_func jack_port_get_latency_range -ljack
  3739. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  3740. if enabled libcdio; then
  3741. 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
  3742. fi
  3743. enabled x11grab &&
  3744. require X11 X11/Xlib.h XOpenDisplay -lX11 &&
  3745. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  3746. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  3747. if ! disabled vaapi; then
  3748. check_lib va/va.h vaInitialize -lva && {
  3749. check_cpp_condition va/va_version.h "VA_CHECK_VERSION(0,32,0)" ||
  3750. warn "Please upgrade to VA-API >= 0.32 if you would like full VA-API support.";
  3751. } || disable vaapi
  3752. fi
  3753. enabled vdpau &&
  3754. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  3755. disable vdpau
  3756. # Funny iconv installations are not unusual, so check it after all flags have been set
  3757. disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv
  3758. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  3759. 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"
  3760. # add some useful compiler flags if supported
  3761. check_cflags -Wdeclaration-after-statement
  3762. check_cflags -Wall
  3763. check_cflags -Wno-parentheses
  3764. check_cflags -Wno-switch
  3765. check_cflags -Wno-format-zero-length
  3766. check_cflags -Wdisabled-optimization
  3767. check_cflags -Wpointer-arith
  3768. check_cflags -Wredundant-decls
  3769. check_cflags -Wno-pointer-sign
  3770. check_cflags -Wwrite-strings
  3771. check_cflags -Wtype-limits
  3772. check_cflags -Wundef
  3773. check_cflags -Wmissing-prototypes
  3774. check_cflags -Wno-pointer-to-int-cast
  3775. check_cflags -Wstrict-prototypes
  3776. enabled extra_warnings && check_cflags -Winline
  3777. # add some linker flags
  3778. check_ldflags -Wl,--warn-common
  3779. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  3780. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  3781. enabled xmm_clobber_test &&
  3782. check_ldflags -Wl,--wrap,avcodec_open2 \
  3783. -Wl,--wrap,avcodec_decode_audio4 \
  3784. -Wl,--wrap,avcodec_decode_video2 \
  3785. -Wl,--wrap,avcodec_decode_subtitle2 \
  3786. -Wl,--wrap,avcodec_encode_audio2 \
  3787. -Wl,--wrap,avcodec_encode_video \
  3788. -Wl,--wrap,avcodec_encode_subtitle \
  3789. -Wl,--wrap,sws_scale ||
  3790. disable xmm_clobber_test
  3791. echo "X{};" > $TMPV
  3792. if test_ldflags -Wl,--version-script,$TMPV; then
  3793. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  3794. check_cc <<EOF && enable symver_asm_label
  3795. void ff_foo(void) __asm__ ("av_foo@VERSION");
  3796. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  3797. EOF
  3798. check_cc <<EOF && enable symver_gnu_asm
  3799. __asm__(".symver ff_foo,av_foo@VERSION");
  3800. void ff_foo(void) {}
  3801. EOF
  3802. fi
  3803. if [ -z "$optflags" ]; then
  3804. if enabled small; then
  3805. optflags=$cflags_size
  3806. elif enabled optimizations; then
  3807. optflags=$cflags_speed
  3808. else
  3809. optflags=$cflags_noopt
  3810. fi
  3811. fi
  3812. check_optflags(){
  3813. check_cflags "$@"
  3814. enabled lto && check_ldflags "$@"
  3815. }
  3816. if enabled lto; then
  3817. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  3818. check_cflags -flto
  3819. check_ldflags -flto $cpuflags
  3820. fi
  3821. check_optflags $optflags
  3822. check_optflags -fno-math-errno
  3823. check_optflags -fno-signed-zeros
  3824. enabled ftrapv && check_cflags -ftrapv
  3825. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  3826. int x;
  3827. EOF
  3828. if enabled icc; then
  3829. # Just warnings, no remarks
  3830. check_cflags -w1
  3831. # -wd: Disable following warnings
  3832. # 144, 167, 556: -Wno-pointer-sign
  3833. # 188: enumerated type mixed with another type
  3834. # 1292: attribute "foo" ignored
  3835. # 1419: external declaration in primary source file
  3836. # 10006: ignoring unknown option -fno-signed-zeros
  3837. # 10148: ignoring unknown option -Wno-parentheses
  3838. # 10156: ignoring option '-W'; no argument required
  3839. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156
  3840. # 11030: Warning unknown option --as-needed
  3841. # 10156: ignoring option '-export'; no argument required
  3842. check_ldflags -wd10156,11030
  3843. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  3844. enable ebp_available
  3845. if enabled x86_32; then
  3846. icc_version=$($cc -dumpversion)
  3847. test ${icc_version%%.*} -ge 11 &&
  3848. check_cflags -falign-stack=maintain-16-byte ||
  3849. disable aligned_stack
  3850. fi
  3851. elif enabled ccc; then
  3852. # disable some annoying warnings
  3853. add_cflags -msg_disable bitnotint
  3854. add_cflags -msg_disable mixfuncvoid
  3855. add_cflags -msg_disable nonstandcast
  3856. add_cflags -msg_disable unsupieee
  3857. elif enabled gcc; then
  3858. check_optflags -fno-tree-vectorize
  3859. check_cflags -Werror=implicit-function-declaration
  3860. check_cflags -Werror=missing-prototypes
  3861. check_cflags -Werror=return-type
  3862. check_cflags -Werror=vla
  3863. elif enabled llvm_gcc; then
  3864. check_cflags -mllvm -stack-alignment=16
  3865. elif enabled clang; then
  3866. check_cflags -mllvm -stack-alignment=16
  3867. check_cflags -Qunused-arguments
  3868. check_cflags -Werror=implicit-function-declaration
  3869. check_cflags -Werror=missing-prototypes
  3870. check_cflags -Werror=return-type
  3871. elif enabled armcc; then
  3872. # 2523: use of inline assembler is deprecated
  3873. add_cflags -W${armcc_opt},--diag_suppress=2523
  3874. add_cflags -W${armcc_opt},--diag_suppress=1207
  3875. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  3876. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  3877. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  3878. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  3879. elif enabled tms470; then
  3880. add_cflags -pds=824 -pds=837
  3881. elif enabled pathscale; then
  3882. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  3883. elif enabled msvc; then
  3884. enabled x86_32 && disable aligned_stack
  3885. fi
  3886. case $target_os in
  3887. osf1)
  3888. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  3889. ;;
  3890. plan9)
  3891. add_cppflags -Dmain=plan9_main
  3892. ;;
  3893. esac
  3894. enable frame_thread_encoder
  3895. enabled_any $THREADS_LIST && enable threads
  3896. enabled_any $ATOMICS_LIST && enable atomics_native
  3897. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  3898. check_deps $CONFIG_LIST \
  3899. $CONFIG_EXTRA \
  3900. $HAVE_LIST \
  3901. $ALL_COMPONENTS \
  3902. if test $target_os = "haiku"; then
  3903. disable memalign
  3904. disable posix_memalign
  3905. fi
  3906. ! enabled_any memalign posix_memalign aligned_malloc &&
  3907. enabled_any $need_memalign && enable memalign_hack
  3908. # add_dep lib dep
  3909. # -> enable ${lib}_deps_${dep}
  3910. # -> add $dep to ${lib}_deps only once
  3911. add_dep() {
  3912. lib=$1
  3913. dep=$2
  3914. enabled "${lib}_deps_${dep}" && return 0
  3915. enable "${lib}_deps_${dep}"
  3916. prepend "${lib}_deps" $dep
  3917. }
  3918. # merge deps lib components
  3919. # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
  3920. merge_deps() {
  3921. lib=$1
  3922. shift
  3923. for comp in $*; do
  3924. enabled $comp || continue
  3925. eval "dep=\"\$${comp}_deps\""
  3926. for d in $dep; do
  3927. add_dep $lib $d
  3928. done
  3929. done
  3930. }
  3931. merge_deps libavfilter $FILTER_LIST
  3932. echo "install prefix $prefix"
  3933. echo "source path $source_path"
  3934. echo "C compiler $cc"
  3935. echo "ARCH $arch ($cpu)"
  3936. if test "$build_suffix" != ""; then
  3937. echo "build suffix $build_suffix"
  3938. fi
  3939. if test "$progs_suffix" != ""; then
  3940. echo "progs suffix $progs_suffix"
  3941. fi
  3942. if test "$extra_version" != ""; then
  3943. echo "version string suffix $extra_version"
  3944. fi
  3945. echo "big-endian ${bigendian-no}"
  3946. echo "runtime cpu detection ${runtime_cpudetect-no}"
  3947. if enabled x86; then
  3948. echo "${yasmexe} ${yasm-no}"
  3949. echo "MMX enabled ${mmx-no}"
  3950. echo "MMXEXT enabled ${mmxext-no}"
  3951. echo "3DNow! enabled ${amd3dnow-no}"
  3952. echo "3DNow! extended enabled ${amd3dnowext-no}"
  3953. echo "SSE enabled ${sse-no}"
  3954. echo "SSSE3 enabled ${ssse3-no}"
  3955. echo "AVX enabled ${avx-no}"
  3956. echo "FMA4 enabled ${fma4-no}"
  3957. echo "CMOV enabled ${cmov-no}"
  3958. echo "CMOV is fast ${fast_cmov-no}"
  3959. echo "EBX available ${ebx_available-no}"
  3960. echo "EBP available ${ebp_available-no}"
  3961. fi
  3962. if enabled arm; then
  3963. echo "ARMv5TE enabled ${armv5te-no}"
  3964. echo "ARMv6 enabled ${armv6-no}"
  3965. echo "ARMv6T2 enabled ${armv6t2-no}"
  3966. echo "VFP enabled ${vfp-no}"
  3967. echo "NEON enabled ${neon-no}"
  3968. echo "THUMB enabled ${thumb-no}"
  3969. fi
  3970. if enabled mips; then
  3971. echo "MIPS FPU enabled ${mipsfpu-no}"
  3972. echo "MIPS32R2 enabled ${mips32r2-no}"
  3973. echo "MIPS DSP R1 enabled ${mipsdspr1-no}"
  3974. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  3975. fi
  3976. if enabled ppc; then
  3977. echo "AltiVec enabled ${altivec-no}"
  3978. echo "PPC 4xx optimizations ${ppc4xx-no}"
  3979. echo "dcbzl available ${dcbzl-no}"
  3980. fi
  3981. if enabled sparc; then
  3982. echo "VIS enabled ${vis-no}"
  3983. fi
  3984. echo "debug symbols ${debug-no}"
  3985. echo "strip symbols ${stripping-no}"
  3986. echo "optimize for size ${small-no}"
  3987. echo "optimizations ${optimizations-no}"
  3988. echo "static ${static-no}"
  3989. echo "shared ${shared-no}"
  3990. echo "postprocessing support ${postproc-no}"
  3991. echo "new filter support ${avfilter-no}"
  3992. echo "network support ${network-no}"
  3993. echo "threading support ${thread_type-no}"
  3994. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  3995. echo "SDL support ${sdl-no}"
  3996. echo "opencl enabled ${opencl-no}"
  3997. echo "libshine enabled ${libshine-no}"
  3998. echo "texi2html enabled ${texi2html-no}"
  3999. echo "perl enabled ${perl-no}"
  4000. echo "pod2man enabled ${pod2man-no}"
  4001. echo "makeinfo enabled ${makeinfo-no}"
  4002. test -n "$random_seed" &&
  4003. echo "random seed ${random_seed}"
  4004. echo
  4005. echo "External libraries:"
  4006. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4007. echo
  4008. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  4009. echo "Enabled ${type}s:"
  4010. eval list=\$$(toupper $type)_LIST
  4011. print_enabled '_*' $list | print_3_columns
  4012. echo
  4013. done
  4014. license="LGPL version 2.1 or later"
  4015. if enabled nonfree; then
  4016. license="nonfree and unredistributable"
  4017. elif enabled gplv3; then
  4018. license="GPL version 3 or later"
  4019. elif enabled lgplv3; then
  4020. license="LGPL version 3 or later"
  4021. elif enabled gpl; then
  4022. license="GPL version 2 or later"
  4023. fi
  4024. echo "License: $license"
  4025. echo "Creating config.mak, config.h, and doc/config.texi..."
  4026. test -e Makefile || $ln_s "$source_path/Makefile" .
  4027. enabled stripping || strip="echo skipping strip"
  4028. config_files="$TMPH config.mak doc/config.texi"
  4029. cat > config.mak <<EOF
  4030. # Automatically generated by configure - do not modify!
  4031. ifndef FFMPEG_CONFIG_MAK
  4032. FFMPEG_CONFIG_MAK=1
  4033. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  4034. prefix=$prefix
  4035. LIBDIR=\$(DESTDIR)$libdir
  4036. SHLIBDIR=\$(DESTDIR)$shlibdir
  4037. INCDIR=\$(DESTDIR)$incdir
  4038. BINDIR=\$(DESTDIR)$bindir
  4039. DATADIR=\$(DESTDIR)$datadir
  4040. MANDIR=\$(DESTDIR)$mandir
  4041. SRC_PATH=$source_path
  4042. ifndef MAIN_MAKEFILE
  4043. SRC_PATH:=\$(SRC_PATH:.%=..%)
  4044. endif
  4045. CC_IDENT=$cc_ident
  4046. ARCH=$arch
  4047. CC=$cc
  4048. CXX=$cxx
  4049. AS=$as
  4050. LD=$ld
  4051. DEPCC=$dep_cc
  4052. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4053. DEPAS=$as
  4054. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4055. YASM=$yasmexe
  4056. DEPYASM=$yasmexe
  4057. AR=$ar
  4058. ARFLAGS=$arflags
  4059. AR_O=$ar_o
  4060. RANLIB=$ranlib
  4061. CP=cp -p
  4062. LN_S=$ln_s
  4063. STRIP=$strip
  4064. CPPFLAGS=$CPPFLAGS
  4065. CFLAGS=$CFLAGS
  4066. CXXFLAGS=$CXXFLAGS
  4067. ASFLAGS=$ASFLAGS
  4068. AS_C=$AS_C
  4069. AS_O=$AS_O
  4070. CC_C=$CC_C
  4071. CC_E=$CC_E
  4072. CC_O=$CC_O
  4073. CXX_C=$CXX_C
  4074. CXX_O=$CXX_O
  4075. LD_O=$LD_O
  4076. LD_LIB=$LD_LIB
  4077. LD_PATH=$LD_PATH
  4078. DLLTOOL=$dlltool
  4079. LDFLAGS=$LDFLAGS
  4080. LDFLAGS-ffserver=$FFSERVERLDFLAGS
  4081. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4082. YASMFLAGS=$YASMFLAGS
  4083. BUILDSUF=$build_suffix
  4084. PROGSSUF=$progs_suffix
  4085. FULLNAME=$FULLNAME
  4086. LIBPREF=$LIBPREF
  4087. LIBSUF=$LIBSUF
  4088. LIBNAME=$LIBNAME
  4089. SLIBPREF=$SLIBPREF
  4090. SLIBSUF=$SLIBSUF
  4091. EXESUF=$EXESUF
  4092. EXTRA_VERSION=$extra_version
  4093. CCDEP=$CCDEP
  4094. CXXDEP=$CXXDEP
  4095. CCDEP_FLAGS=$CCDEP_FLAGS
  4096. ASDEP=$ASDEP
  4097. ASDEP_FLAGS=$ASDEP_FLAGS
  4098. CC_DEPFLAGS=$CC_DEPFLAGS
  4099. AS_DEPFLAGS=$AS_DEPFLAGS
  4100. HOSTCC=$host_cc
  4101. HOSTLD=$host_ld
  4102. HOSTCFLAGS=$host_cflags
  4103. HOSTCPPFLAGS=$host_cppflags
  4104. HOSTEXESUF=$HOSTEXESUF
  4105. HOSTLDFLAGS=$host_ldflags
  4106. HOSTLIBS=$host_libs
  4107. DEPHOSTCC=$host_cc
  4108. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4109. HOSTCCDEP=$HOSTCCDEP
  4110. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4111. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4112. HOSTCC_C=$HOSTCC_C
  4113. HOSTCC_O=$HOSTCC_O
  4114. HOSTLD_O=$HOSTLD_O
  4115. TARGET_EXEC=$target_exec
  4116. TARGET_PATH=$target_path
  4117. LIBS-ffplay=$sdl_libs
  4118. CFLAGS-ffplay=$sdl_cflags
  4119. ZLIB=$($ldflags_filter -lz)
  4120. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4121. EXTRALIBS=$extralibs
  4122. COMPAT_OBJS=$compat_objs
  4123. EXEOBJS=$exeobjs
  4124. INSTALL=$install
  4125. LIBTARGET=${LIBTARGET}
  4126. SLIBNAME=${SLIBNAME}
  4127. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4128. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4129. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4130. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4131. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4132. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4133. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4134. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4135. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  4136. NOREDZONE_FLAGS=$noredzone_flags
  4137. EOF
  4138. get_version(){
  4139. lcname=lib${1}
  4140. name=$(toupper $lcname)
  4141. file=$source_path/$lcname/version.h
  4142. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  4143. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  4144. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  4145. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  4146. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  4147. }
  4148. map 'get_version $v' $LIBRARY_LIST
  4149. cat > $TMPH <<EOF
  4150. /* Automatically generated by configure - do not modify! */
  4151. #ifndef FFMPEG_CONFIG_H
  4152. #define FFMPEG_CONFIG_H
  4153. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  4154. #define FFMPEG_LICENSE "$(c_escape $license)"
  4155. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  4156. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4157. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4158. #define av_restrict $_restrict
  4159. #define EXTERN_PREFIX "${extern_prefix}"
  4160. #define EXTERN_ASM ${extern_prefix}
  4161. #define SLIBSUF "$SLIBSUF"
  4162. #define HAVE_MMX2 HAVE_MMXEXT
  4163. EOF
  4164. test -n "$assert_level" &&
  4165. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  4166. test -n "$malloc_prefix" &&
  4167. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4168. if enabled yasm; then
  4169. append config_files $TMPASM
  4170. printf '' >$TMPASM
  4171. fi
  4172. mkdir -p doc
  4173. echo "@c auto-generated by configure" > doc/config.texi
  4174. print_config ARCH_ "$config_files" $ARCH_LIST
  4175. print_config HAVE_ "$config_files" $HAVE_LIST
  4176. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4177. $CONFIG_EXTRA \
  4178. $ALL_COMPONENTS \
  4179. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  4180. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  4181. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4182. cp_if_changed $TMPH config.h
  4183. touch .config
  4184. enabled yasm && cp_if_changed $TMPASM config.asm
  4185. cat > $TMPH <<EOF
  4186. /* Generated by ffconf */
  4187. #ifndef AVUTIL_AVCONFIG_H
  4188. #define AVUTIL_AVCONFIG_H
  4189. EOF
  4190. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4191. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4192. cp_if_changed $TMPH libavutil/avconfig.h
  4193. if test -n "$WARNINGS"; then
  4194. printf "\n$WARNINGS"
  4195. enabled fatal_warnings && exit 1
  4196. fi
  4197. # build pkg-config files
  4198. pkgconfig_generate(){
  4199. name=$1
  4200. shortname=${name#lib}${build_suffix}
  4201. comment=$2
  4202. version=$3
  4203. libs=$4
  4204. requires=$5
  4205. enabled ${name#lib} || return 0
  4206. mkdir -p $name
  4207. cat <<EOF > $name/$name${build_suffix}.pc
  4208. prefix=$prefix
  4209. exec_prefix=\${prefix}
  4210. libdir=$libdir
  4211. includedir=$incdir
  4212. Name: $name
  4213. Description: $comment
  4214. Version: $version
  4215. Requires: $(enabled shared || echo $requires)
  4216. Requires.private: $(enabled shared && echo $requires)
  4217. Conflicts:
  4218. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4219. Libs.private: $(enabled shared && echo $libs)
  4220. Cflags: -I\${includedir}
  4221. EOF
  4222. mkdir -p doc/examples/pc-uninstalled
  4223. includedir=${source_path}
  4224. [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
  4225. cat <<EOF > doc/examples/pc-uninstalled/$name.pc
  4226. prefix=
  4227. exec_prefix=
  4228. libdir=\${pcfiledir}/../../../$name
  4229. includedir=${includedir}
  4230. Name: $name
  4231. Description: $comment
  4232. Version: $version
  4233. Requires: $requires
  4234. Conflicts:
  4235. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4236. Cflags: -I\${includedir}
  4237. EOF
  4238. }
  4239. libavfilter_pc_deps="libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4240. enabled libavfilter_deps_avcodec && prepend libavfilter_pc_deps "libavcodec${build_suffix} = $LIBAVCODEC_VERSION,"
  4241. enabled libavfilter_deps_avformat && prepend libavfilter_pc_deps "libavformat${build_suffix} = $LIBAVFORMAT_VERSION,"
  4242. enabled libavfilter_deps_avresample && prepend libavfilter_pc_deps "libavresample${build_suffix} = $LIBAVRESAMPLE_VERSION,"
  4243. enabled libavfilter_deps_swscale && prepend libavfilter_pc_deps "libswscale${build_suffix} = $LIBSWSCALE_VERSION,"
  4244. enabled libavfilter_deps_swresample && prepend libavfilter_pc_deps "libswresample${build_suffix} = $LIBSWRESAMPLE_VERSION,"
  4245. enabled libavfilter_deps_postproc && prepend libavfilter_pc_deps "libpostproc${build_suffix} = $LIBPOSTPROC_VERSION,"
  4246. libavfilter_pc_deps=${libavfilter_pc_deps%, }
  4247. libavdevice_pc_deps="libavformat${build_suffix} = $LIBAVFORMAT_VERSION"
  4248. enabled lavfi_indev && prepend libavdevice_pc_deps "libavfilter${build_suffix} = $LIBAVFILTER_VERSION,"
  4249. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  4250. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4251. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec${build_suffix} = $LIBAVCODEC_VERSION"
  4252. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$libavdevice_pc_deps"
  4253. pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$libavfilter_pc_deps"
  4254. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4255. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4256. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4257. pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4258. fix_ffmpeg_remote(){
  4259. git_remote_from=$1
  4260. git_remote_to=$2
  4261. fixme_remote=$(git --git-dir=$source_path/.git --work-tree=$source_path remote -v | grep $git_remote_from | cut -f 1 | sort | uniq)
  4262. if [ "$fixme_remote" != "" ]; then
  4263. echolog "
  4264. Outdated domain in git config, the official domain for ffmpeg git is since
  4265. November 2011, source.ffmpeg.org, both the old and the new point to the same
  4266. repository and server. To update it enter the following commands:
  4267. "
  4268. for remote in $fixme_remote; do
  4269. echolog "git remote set-url $remote $git_remote_to"
  4270. done
  4271. fi
  4272. }
  4273. if test -f "$source_path/.git/config"; then
  4274. remote_from=git.videolan.org
  4275. remote_to=source.ffmpeg.org
  4276. fix_ffmpeg_remote git@$remote_from:ffmpeg git@$remote_to:ffmpeg
  4277. fix_ffmpeg_remote git://$remote_from/ffmpeg git://$remote_to/ffmpeg
  4278. fi