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.

4878 lines
149KB

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