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.

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