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.

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