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.

4890 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) ;;
  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.
  2664. # Relies on wrapper to remap it.
  2665. if $_cc 2>&1 | grep -q Linker; then
  2666. _ld_o='-out $@'
  2667. else
  2668. _ld_o='-Fe$@'
  2669. fi
  2670. _cc_o='-Fo $@'
  2671. _cc_e='-P -Fi $@'
  2672. _flags_filter=msvc_flags
  2673. _ld_lib='lib%.a'
  2674. _ld_path='-libpath:'
  2675. _flags='-nologo'
  2676. _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
  2677. if [ $pfx = hostcc ]; then
  2678. append _cflags -Dsnprintf=_snprintf
  2679. fi
  2680. disable stripping
  2681. elif $_cc 2>&1 | grep -q Intel; then
  2682. _type=icl
  2683. _ident=$($cc 2>&1 | head -n1)
  2684. _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
  2685. # Not only is O3 broken on 13.x+ but it is slower on all previous
  2686. # versions (tested) as well.
  2687. _cflags_speed="-O2"
  2688. _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
  2689. # Nonstandard output options, to avoid msys path conversion issues.
  2690. # Relies on wrapper to remap it.
  2691. if $_cc 2>&1 | grep -q Linker; then
  2692. _ld_o='-out $@'
  2693. else
  2694. _ld_o='-Fe$@'
  2695. fi
  2696. _cc_o='-Fo $@'
  2697. _cc_e='-P'
  2698. _flags_filter=icl_flags
  2699. _ld_lib='lib%.a'
  2700. _ld_path='-libpath:'
  2701. # -Qdiag-error to make icl error when seeing certain unknown arguments
  2702. _flags='-nologo -Qdiag-error:4044,10157'
  2703. # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
  2704. # with MSVC which enables it by default.
  2705. _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
  2706. if [ $pfx = hostcc ]; then
  2707. append _cflags -Dsnprintf=_snprintf
  2708. fi
  2709. fi
  2710. eval ${pfx}_type=\$_type
  2711. eval ${pfx}_ident=\$_ident
  2712. }
  2713. set_ccvars(){
  2714. eval ${1}_C=\${_cc_c-\${${1}_C}}
  2715. eval ${1}_E=\${_cc_e-\${${1}_E}}
  2716. eval ${1}_O=\${_cc_o-\${${1}_O}}
  2717. if [ -n "$_depflags" ]; then
  2718. eval ${1}_DEPFLAGS=\$_depflags
  2719. else
  2720. eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
  2721. eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
  2722. eval DEP${1}FLAGS=\$_flags
  2723. fi
  2724. }
  2725. probe_cc cc "$cc"
  2726. cflags_filter=$_flags_filter
  2727. cflags_speed=$_cflags_speed
  2728. cflags_size=$_cflags_size
  2729. cflags_noopt=$_cflags_noopt
  2730. add_cflags $_flags $_cflags
  2731. cc_ldflags=$_ldflags
  2732. set_ccvars CC
  2733. probe_cc hostcc "$host_cc"
  2734. host_cflags_filter=$_flags_filter
  2735. add_host_cflags $_flags $_cflags
  2736. set_ccvars HOSTCC
  2737. test -n "$cc_type" && enable $cc_type ||
  2738. warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
  2739. : ${as_default:=$cc}
  2740. : ${dep_cc_default:=$cc}
  2741. : ${ld_default:=$cc}
  2742. : ${host_ld_default:=$host_cc}
  2743. set_default ar as dep_cc ld host_ld
  2744. probe_cc as "$as"
  2745. asflags_filter=$_flags_filter
  2746. add_asflags $_flags $_cflags
  2747. set_ccvars AS
  2748. probe_cc ld "$ld"
  2749. ldflags_filter=$_flags_filter
  2750. add_ldflags $_flags $_ldflags
  2751. test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
  2752. LD_O=${_ld_o-$LD_O}
  2753. LD_LIB=${_ld_lib-$LD_LIB}
  2754. LD_PATH=${_ld_path-$LD_PATH}
  2755. probe_cc hostld "$host_ld"
  2756. host_ldflags_filter=$_flags_filter
  2757. add_host_ldflags $_flags $_ldflags
  2758. HOSTLD_O=${_ld_o-$HOSTLD_O}
  2759. if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
  2760. probe_cc depcc "$dep_cc"
  2761. CCDEP=${_DEPCMD:-$DEPCMD}
  2762. CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
  2763. DEPCCFLAGS=$_flags
  2764. fi
  2765. if $ar 2>&1 | grep -q Microsoft; then
  2766. arflags="-nologo"
  2767. ar_o='-out:$@'
  2768. elif $ar 2>&1 | grep -q 'Texas Instruments'; then
  2769. arflags="rq"
  2770. ar_o='$@'
  2771. else
  2772. arflags="rc"
  2773. ar_o='$@'
  2774. fi
  2775. add_cflags $extra_cflags
  2776. add_cxxflags $extra_cxxflags
  2777. add_asflags $extra_cflags
  2778. if test -n "$sysroot"; then
  2779. case "$cc_type" in
  2780. gcc|llvm_gcc|clang)
  2781. add_cppflags --sysroot="$sysroot"
  2782. add_ldflags --sysroot="$sysroot"
  2783. ;;
  2784. tms470)
  2785. add_cppflags -I"$sysinclude"
  2786. add_ldflags --sysroot="$sysroot"
  2787. ;;
  2788. esac
  2789. fi
  2790. if test "$cpu" = host; then
  2791. enabled cross_compile &&
  2792. die "--cpu=host makes no sense when cross-compiling."
  2793. case "$cc_type" in
  2794. gcc|llvm_gcc)
  2795. check_native(){
  2796. $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
  2797. sed -n "/cc1.*$1=/{
  2798. s/.*$1=\\([^ ]*\\).*/\\1/
  2799. p
  2800. q
  2801. }" $TMPE
  2802. }
  2803. cpu=$(check_native -march || check_native -mcpu)
  2804. ;;
  2805. esac
  2806. test "${cpu:-host}" = host &&
  2807. die "--cpu=host not supported with compiler $cc"
  2808. fi
  2809. # Deal with common $arch aliases
  2810. case "$arch" in
  2811. aarch64|arm64)
  2812. arch="aarch64"
  2813. ;;
  2814. arm*|iPad*)
  2815. arch="arm"
  2816. ;;
  2817. mips*|IP*)
  2818. arch="mips"
  2819. ;;
  2820. parisc*|hppa*)
  2821. arch="parisc"
  2822. ;;
  2823. "Power Macintosh"|ppc*|powerpc*)
  2824. arch="ppc"
  2825. ;;
  2826. s390|s390x)
  2827. arch="s390"
  2828. ;;
  2829. sh4|sh)
  2830. arch="sh4"
  2831. ;;
  2832. sun4u|sparc*)
  2833. arch="sparc"
  2834. ;;
  2835. tilegx|tile-gx)
  2836. arch="tilegx"
  2837. ;;
  2838. i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
  2839. arch="x86"
  2840. ;;
  2841. esac
  2842. is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
  2843. enable $arch
  2844. # Add processor-specific flags
  2845. if enabled aarch64; then
  2846. case $cpu in
  2847. armv*)
  2848. cpuflags="-march=$cpu"
  2849. ;;
  2850. *)
  2851. cpuflags="-mcpu=$cpu"
  2852. ;;
  2853. esac
  2854. elif enabled alpha; then
  2855. cpuflags="-mcpu=$cpu"
  2856. elif enabled arm; then
  2857. check_arm_arch() {
  2858. check_cpp_condition stddef.h \
  2859. "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
  2860. $cpuflags
  2861. }
  2862. probe_arm_arch() {
  2863. if check_arm_arch 4; then echo armv4;
  2864. elif check_arm_arch 4T; then echo armv4t;
  2865. elif check_arm_arch 5; then echo armv5;
  2866. elif check_arm_arch 5E; then echo armv5e;
  2867. elif check_arm_arch 5T; then echo armv5t;
  2868. elif check_arm_arch 5TE; then echo armv5te;
  2869. elif check_arm_arch 5TEJ; then echo armv5te;
  2870. elif check_arm_arch 6; then echo armv6;
  2871. elif check_arm_arch 6J; then echo armv6j;
  2872. elif check_arm_arch 6K; then echo armv6k;
  2873. elif check_arm_arch 6Z; then echo armv6z;
  2874. elif check_arm_arch 6ZK; then echo armv6zk;
  2875. elif check_arm_arch 6T2; then echo armv6t2;
  2876. elif check_arm_arch 7; then echo armv7;
  2877. elif check_arm_arch 7A 7_A; then echo armv7-a;
  2878. elif check_arm_arch 7R 7_R; then echo armv7-r;
  2879. elif check_arm_arch 7M 7_M; then echo armv7-m;
  2880. elif check_arm_arch 7EM 7E_M; then echo armv7-m;
  2881. elif check_arm_arch 8A 8_A; then echo armv8-a;
  2882. fi
  2883. }
  2884. [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
  2885. case $cpu in
  2886. armv*)
  2887. cpuflags="-march=$cpu"
  2888. subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
  2889. ;;
  2890. *)
  2891. cpuflags="-mcpu=$cpu"
  2892. case $cpu in
  2893. cortex-a*) subarch=armv7a ;;
  2894. cortex-r*) subarch=armv7r ;;
  2895. cortex-m*) enable thumb; subarch=armv7m ;;
  2896. arm11*) subarch=armv6 ;;
  2897. arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
  2898. armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
  2899. *) subarch=$(probe_arm_arch) ;;
  2900. esac
  2901. ;;
  2902. esac
  2903. case "$subarch" in
  2904. armv5t*) enable fast_clz ;;
  2905. armv[6-8]*) enable fast_clz fast_unaligned ;;
  2906. esac
  2907. elif enabled avr32; then
  2908. case $cpu in
  2909. ap7[02]0[0-2])
  2910. subarch="avr32_ap"
  2911. cpuflags="-mpart=$cpu"
  2912. ;;
  2913. ap)
  2914. subarch="avr32_ap"
  2915. cpuflags="-march=$cpu"
  2916. ;;
  2917. uc3[ab]*)
  2918. subarch="avr32_uc"
  2919. cpuflags="-mcpu=$cpu"
  2920. ;;
  2921. uc)
  2922. subarch="avr32_uc"
  2923. cpuflags="-march=$cpu"
  2924. ;;
  2925. esac
  2926. elif enabled bfin; then
  2927. cpuflags="-mcpu=$cpu"
  2928. elif enabled mips; then
  2929. cpuflags="-march=$cpu"
  2930. case $cpu in
  2931. 24kc)
  2932. disable mipsfpu
  2933. disable mipsdspr1
  2934. disable mipsdspr2
  2935. ;;
  2936. 24kf*)
  2937. disable mipsdspr1
  2938. disable mipsdspr2
  2939. ;;
  2940. 24kec|34kc|1004kc)
  2941. disable mipsfpu
  2942. disable mipsdspr2
  2943. ;;
  2944. 24kef*|34kf*|1004kf*)
  2945. disable mipsdspr2
  2946. ;;
  2947. 74kc)
  2948. disable mipsfpu
  2949. ;;
  2950. esac
  2951. elif enabled ppc; then
  2952. case $(tolower $cpu) in
  2953. 601|ppc601|powerpc601)
  2954. cpuflags="-mcpu=601"
  2955. disable altivec
  2956. ;;
  2957. 603*|ppc603*|powerpc603*)
  2958. cpuflags="-mcpu=603"
  2959. disable altivec
  2960. ;;
  2961. 604*|ppc604*|powerpc604*)
  2962. cpuflags="-mcpu=604"
  2963. disable altivec
  2964. ;;
  2965. g3|75*|ppc75*|powerpc75*)
  2966. cpuflags="-mcpu=750"
  2967. disable altivec
  2968. ;;
  2969. g4|745*|ppc745*|powerpc745*)
  2970. cpuflags="-mcpu=7450"
  2971. ;;
  2972. 74*|ppc74*|powerpc74*)
  2973. cpuflags="-mcpu=7400"
  2974. ;;
  2975. g5|970|ppc970|powerpc970)
  2976. cpuflags="-mcpu=970"
  2977. ;;
  2978. power[3-7]*)
  2979. cpuflags="-mcpu=$cpu"
  2980. ;;
  2981. cell)
  2982. cpuflags="-mcpu=cell"
  2983. enable ldbrx
  2984. ;;
  2985. e500mc)
  2986. cpuflags="-mcpu=e500mc"
  2987. disable altivec
  2988. ;;
  2989. e500v2)
  2990. cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
  2991. disable altivec
  2992. ;;
  2993. e500)
  2994. cpuflags="-mcpu=8540 -mhard-float"
  2995. disable altivec
  2996. ;;
  2997. esac
  2998. elif enabled sparc; then
  2999. case $cpu in
  3000. cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
  3001. cpuflags="-mcpu=$cpu"
  3002. disable vis
  3003. ;;
  3004. ultrasparc*|niagara[234])
  3005. cpuflags="-mcpu=$cpu"
  3006. ;;
  3007. esac
  3008. elif enabled x86; then
  3009. case $cpu in
  3010. i[345]86|pentium)
  3011. cpuflags="-march=$cpu"
  3012. disable mmx
  3013. ;;
  3014. # targets that do NOT support nopl and conditional mov (cmov)
  3015. pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
  3016. cpuflags="-march=$cpu"
  3017. disable i686
  3018. ;;
  3019. # targets that do support nopl and conditional mov (cmov)
  3020. 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*)
  3021. cpuflags="-march=$cpu"
  3022. enable i686
  3023. enable fast_cmov
  3024. ;;
  3025. # targets that do support conditional mov but on which it's slow
  3026. pentium4|pentium4m|prescott|nocona)
  3027. cpuflags="-march=$cpu"
  3028. enable i686
  3029. disable fast_cmov
  3030. ;;
  3031. esac
  3032. fi
  3033. if [ "$cpu" != generic ]; then
  3034. add_cflags $cpuflags
  3035. add_asflags $cpuflags
  3036. fi
  3037. # compiler sanity check
  3038. check_exec <<EOF
  3039. int main(void){ return 0; }
  3040. EOF
  3041. if test "$?" != 0; then
  3042. echo "$cc is unable to create an executable file."
  3043. if test -z "$cross_prefix" && ! enabled cross_compile ; then
  3044. echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
  3045. echo "Only do this if you know what cross compiling means."
  3046. fi
  3047. die "C compiler test failed."
  3048. fi
  3049. add_cppflags -D_ISOC99_SOURCE
  3050. add_cxxflags -D__STDC_CONSTANT_MACROS
  3051. check_cflags -std=c99
  3052. check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
  3053. #include <stdlib.h>
  3054. EOF
  3055. check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
  3056. #include <stdlib.h>
  3057. EOF
  3058. check_host_cflags -std=c99
  3059. check_host_cflags -Wall
  3060. check_64bit(){
  3061. arch32=$1
  3062. arch64=$2
  3063. expr=$3
  3064. check_code cc "" "int test[2*($expr) - 1]" &&
  3065. subarch=$arch64 || subarch=$arch32
  3066. }
  3067. case "$arch" in
  3068. aarch64|alpha|ia64)
  3069. spic=$shared
  3070. ;;
  3071. mips)
  3072. check_64bit mips mips64 '_MIPS_SIM > 1'
  3073. spic=$shared
  3074. ;;
  3075. parisc)
  3076. check_64bit parisc parisc64 'sizeof(void *) > 4'
  3077. spic=$shared
  3078. ;;
  3079. ppc)
  3080. check_64bit ppc ppc64 'sizeof(void *) > 4'
  3081. spic=$shared
  3082. ;;
  3083. sparc)
  3084. check_64bit sparc sparc64 'sizeof(void *) > 4'
  3085. spic=$shared
  3086. ;;
  3087. x86)
  3088. check_64bit x86_32 x86_64 'sizeof(void *) > 4'
  3089. if test "$subarch" = "x86_64"; then
  3090. spic=$shared
  3091. fi
  3092. ;;
  3093. ppc)
  3094. check_cc <<EOF && subarch="ppc64"
  3095. int test[(int)sizeof(char*) - 7];
  3096. EOF
  3097. ;;
  3098. esac
  3099. enable $subarch
  3100. enabled spic && enable_weak pic
  3101. # OS specific
  3102. case $target_os in
  3103. haiku)
  3104. prefix_default="/boot/common"
  3105. network_extralibs="-lnetwork"
  3106. host_libs=
  3107. ;;
  3108. sunos)
  3109. FFSERVERLDFLAGS=""
  3110. SHFLAGS='-shared -Wl,-h,$$(@F)'
  3111. enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
  3112. network_extralibs="-lsocket -lnsl"
  3113. add_cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
  3114. # When using suncc to build, the Solaris linker will mark
  3115. # an executable with each instruction set encountered by
  3116. # the Solaris assembler. As our libraries contain their own
  3117. # guards for processor-specific code, instead suppress
  3118. # generation of the HWCAPS ELF section on Solaris x86 only.
  3119. enabled_all suncc x86 &&
  3120. echo "hwcap_1 = OVERRIDE;" > mapfile &&
  3121. add_ldflags -Wl,-M,mapfile
  3122. nm_default='nm -P -g'
  3123. ;;
  3124. netbsd)
  3125. disable symver
  3126. oss_indev_extralibs="-lossaudio"
  3127. oss_outdev_extralibs="-lossaudio"
  3128. enabled gcc || check_ldflags -Wl,-zmuldefs
  3129. ;;
  3130. openbsd|bitrig)
  3131. disable symver
  3132. SHFLAGS='-shared'
  3133. SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
  3134. SLIB_INSTALL_LINKS=
  3135. oss_indev_extralibs="-lossaudio"
  3136. oss_outdev_extralibs="-lossaudio"
  3137. ;;
  3138. dragonfly)
  3139. disable symver
  3140. ;;
  3141. freebsd)
  3142. ;;
  3143. bsd/os)
  3144. add_extralibs -lpoll -lgnugetopt
  3145. strip="strip -d"
  3146. ;;
  3147. darwin)
  3148. gas="gas-preprocessor.pl $cc"
  3149. enabled ppc && add_asflags -force_cpusubtype_ALL
  3150. SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
  3151. enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
  3152. strip="${strip} -x"
  3153. add_ldflags -Wl,-dynamic,-search_paths_first
  3154. SLIBSUF=".dylib"
  3155. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
  3156. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
  3157. FFSERVERLDFLAGS=-Wl,-bind_at_load
  3158. objformat="macho"
  3159. enabled x86_64 && objformat="macho64"
  3160. enabled_any pic shared ||
  3161. { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
  3162. ;;
  3163. mingw32*)
  3164. if test $target_os = "mingw32ce"; then
  3165. disable network
  3166. else
  3167. target_os=mingw32
  3168. fi
  3169. LIBTARGET=i386
  3170. if enabled x86_64; then
  3171. LIBTARGET="i386:x86-64"
  3172. elif enabled arm; then
  3173. LIBTARGET=arm-wince
  3174. fi
  3175. check_ldflags -Wl,--nxcompat
  3176. check_ldflags -Wl,--dynamicbase
  3177. shlibdir_default="$bindir_default"
  3178. SLIBPREF=""
  3179. SLIBSUF=".dll"
  3180. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3181. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3182. dlltool="${cross_prefix}dlltool"
  3183. if check_cmd lib.exe -list; then
  3184. SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3185. if enabled x86_64; then
  3186. LIBTARGET=x64
  3187. fi
  3188. elif check_cmd $dlltool --version; then
  3189. 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)'
  3190. fi
  3191. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3192. SLIB_INSTALL_LINKS=
  3193. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3194. SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3195. 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'
  3196. objformat="win32"
  3197. ranlib=:
  3198. enable dos_paths
  3199. ;;
  3200. win32|win64)
  3201. if enabled shared; then
  3202. # Link to the import library instead of the normal static library
  3203. # for shared libs.
  3204. LD_LIB='%.lib'
  3205. # Cannot build shared and static libs at the same time with MSVC.
  3206. disable static
  3207. fi
  3208. shlibdir_default="$bindir_default"
  3209. SLIBPREF=""
  3210. SLIBSUF=".dll"
  3211. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3212. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3213. SLIB_CREATE_DEF_CMD='makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
  3214. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3215. SLIB_INSTALL_LINKS=
  3216. SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
  3217. SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
  3218. SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
  3219. objformat="win32"
  3220. ranlib=:
  3221. enable dos_paths
  3222. ;;
  3223. cygwin*)
  3224. target_os=cygwin
  3225. shlibdir_default="$bindir_default"
  3226. SLIBPREF="cyg"
  3227. SLIBSUF=".dll"
  3228. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
  3229. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
  3230. SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
  3231. SLIB_INSTALL_LINKS=
  3232. SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
  3233. SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
  3234. objformat="win32"
  3235. enable dos_paths
  3236. ;;
  3237. *-dos|freedos|opendos)
  3238. network_extralibs="-lsocket"
  3239. objformat="coff"
  3240. enable dos_paths
  3241. add_cppflags -U__STRICT_ANSI__
  3242. ;;
  3243. linux)
  3244. enable dv1394
  3245. ;;
  3246. irix*)
  3247. target_os=irix
  3248. ranlib="echo ignoring ranlib"
  3249. ;;
  3250. os/2*)
  3251. strip="lxlite -CS"
  3252. ln_s="cp -f"
  3253. objformat="aout"
  3254. add_cppflags -D_GNU_SOURCE
  3255. add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
  3256. SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
  3257. FFSERVERLDFLAGS=""
  3258. LIBSUF="_s.a"
  3259. SLIBPREF=""
  3260. SLIBSUF=".dll"
  3261. SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
  3262. SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
  3263. SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
  3264. echo PROTMODE >> $(SUBDIR)$(NAME).def; \
  3265. echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
  3266. echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
  3267. echo EXPORTS >> $(SUBDIR)$(NAME).def; \
  3268. emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
  3269. SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
  3270. emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
  3271. SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
  3272. enable dos_paths
  3273. enable_weak os2threads
  3274. ;;
  3275. gnu/kfreebsd)
  3276. add_cppflags -D_BSD_SOURCE
  3277. ;;
  3278. gnu)
  3279. ;;
  3280. qnx)
  3281. add_cppflags -D_QNX_SOURCE
  3282. network_extralibs="-lsocket"
  3283. ;;
  3284. symbian)
  3285. SLIBSUF=".dll"
  3286. enable dos_paths
  3287. add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
  3288. add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
  3289. add_ldflags -Wl,--target1-abs,--no-undefined \
  3290. -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
  3291. -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
  3292. add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
  3293. -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
  3294. -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
  3295. ;;
  3296. osf1)
  3297. add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
  3298. FFSERVERLDFLAGS=
  3299. ;;
  3300. minix)
  3301. ;;
  3302. plan9)
  3303. add_cppflags -D_C99_SNPRINTF_EXTENSION \
  3304. -D_REENTRANT_SOURCE \
  3305. -D_RESEARCH_SOURCE \
  3306. -DFD_SETSIZE=96 \
  3307. -DHAVE_SOCK_OPTS
  3308. add_compat strtod.o strtod=avpriv_strtod
  3309. network_extralibs='-lbsd'
  3310. exeobjs=compat/plan9/main.o
  3311. disable ffserver
  3312. cp_f='cp'
  3313. ;;
  3314. none)
  3315. ;;
  3316. *)
  3317. die "Unknown OS '$target_os'."
  3318. ;;
  3319. esac
  3320. # determine libc flavour
  3321. # uclibc defines __GLIBC__, so it needs to be checked before glibc.
  3322. if check_cpp_condition features.h "defined __UCLIBC__"; then
  3323. libc_type=uclibc
  3324. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3325. elif check_cpp_condition features.h "defined __GLIBC__"; then
  3326. libc_type=glibc
  3327. add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
  3328. # MinGW headers can be installed on Cygwin, so check for newlib first.
  3329. elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
  3330. libc_type=newlib
  3331. add_cppflags -U__STRICT_ANSI__
  3332. elif check_header _mingw.h; then
  3333. libc_type=mingw
  3334. check_cpp_condition _mingw.h \
  3335. "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) || \
  3336. (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
  3337. die "ERROR: MinGW runtime version must be >= 3.15."
  3338. add_cppflags -U__STRICT_ANSI__
  3339. if check_cpp_condition _mingw.h "defined(__MINGW64_VERSION_MAJOR) && \
  3340. __MINGW64_VERSION_MAJOR < 3"; then
  3341. add_compat msvcrt/snprintf.o
  3342. add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
  3343. else
  3344. add_cppflags -D__USE_MINGW_ANSI_STDIO=1
  3345. fi
  3346. elif check_func_headers stdlib.h _get_doserrno; then
  3347. libc_type=msvcrt
  3348. add_compat strtod.o strtod=avpriv_strtod
  3349. add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
  3350. _snprintf=avpriv_snprintf \
  3351. vsnprintf=avpriv_vsnprintf
  3352. # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
  3353. # 0x601 by default unless something else is set by the user.
  3354. # This can easily lead to us detecting functions only present
  3355. # in such new versions and producing binaries requiring windows 7.0.
  3356. # Therefore explicitly set the default to XP unless the user has
  3357. # set something else on the command line.
  3358. check_cpp_condition stdlib.h "defined(_WIN32_WINNT)" || add_cppflags -D_WIN32_WINNT=0x0502
  3359. elif check_cpp_condition stddef.h "defined __KLIBC__"; then
  3360. libc_type=klibc
  3361. elif check_cpp_condition sys/cdefs.h "defined __BIONIC__"; then
  3362. libc_type=bionic
  3363. add_compat strtod.o strtod=avpriv_strtod
  3364. fi
  3365. test -n "$libc_type" && enable $libc_type
  3366. # hacks for compiler/libc/os combinations
  3367. if enabled_all tms470 glibc; then
  3368. CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
  3369. add_cppflags -D__USER_LABEL_PREFIX__=
  3370. add_cppflags -D__builtin_memset=memset
  3371. add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
  3372. add_cflags -pds=48 # incompatible redefinition of macro
  3373. fi
  3374. if enabled_all ccc glibc; then
  3375. add_ldflags -Wl,-z,now # calls to libots crash without this
  3376. fi
  3377. esc(){
  3378. echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
  3379. }
  3380. echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
  3381. check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
  3382. set_default $PATHS_LIST
  3383. set_default nm
  3384. # we need to build at least one lib type
  3385. if ! enabled_any static shared; then
  3386. cat <<EOF
  3387. At least one library type must be built.
  3388. Specify --enable-static to build the static libraries or --enable-shared to
  3389. build the shared libraries as well. To only build the shared libraries specify
  3390. --disable-static in addition to --enable-shared.
  3391. EOF
  3392. exit 1;
  3393. fi
  3394. die_license_disabled() {
  3395. enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
  3396. }
  3397. die_license_disabled_gpl() {
  3398. enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; }
  3399. }
  3400. die_license_disabled gpl frei0r
  3401. die_license_disabled gpl libcdio
  3402. die_license_disabled gpl libutvideo
  3403. die_license_disabled gpl libvidstab
  3404. die_license_disabled gpl libx264
  3405. die_license_disabled gpl libxavs
  3406. die_license_disabled gpl libxvid
  3407. die_license_disabled gpl x11grab
  3408. die_license_disabled nonfree libaacplus
  3409. die_license_disabled nonfree libfaac
  3410. enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
  3411. enabled gpl && die_license_disabled_gpl nonfree openssl
  3412. die_license_disabled version3 libopencore_amrnb
  3413. die_license_disabled version3 libopencore_amrwb
  3414. die_license_disabled version3 libvo_aacenc
  3415. die_license_disabled version3 libvo_amrwbenc
  3416. enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
  3417. disabled optimizations || check_cflags -fomit-frame-pointer
  3418. enable_weak_pic() {
  3419. disabled pic && return
  3420. enable pic
  3421. add_cppflags -DPIC
  3422. case "$target_os" in
  3423. mingw*|cygwin*)
  3424. ;;
  3425. *)
  3426. add_cflags -fPIC
  3427. ;;
  3428. esac
  3429. add_asflags -fPIC
  3430. }
  3431. enabled pic && enable_weak_pic
  3432. check_cc <<EOF || die "Symbol mangling check failed."
  3433. int ff_extern;
  3434. EOF
  3435. sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
  3436. extern_prefix=${sym%%ff_extern*}
  3437. check_cc <<EOF && enable_weak inline_asm
  3438. void foo(void) { __asm__ volatile ("" ::); }
  3439. EOF
  3440. _restrict=
  3441. for restrict_keyword in restrict __restrict__ __restrict; do
  3442. check_cc <<EOF && _restrict=$restrict_keyword && break
  3443. void foo(char * $restrict_keyword p);
  3444. EOF
  3445. done
  3446. check_cc <<EOF && enable attribute_packed
  3447. struct { int x; } __attribute__((packed)) x;
  3448. EOF
  3449. check_cc <<EOF && enable attribute_may_alias
  3450. union { int x; } __attribute__((may_alias)) x;
  3451. EOF
  3452. check_cc <<EOF || die "endian test failed"
  3453. unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
  3454. EOF
  3455. od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
  3456. if enabled alpha; then
  3457. check_cflags -mieee
  3458. elif enabled arm; then
  3459. check_cpp_condition stddef.h "defined __thumb__" && check_cc <<EOF && enable_weak thumb
  3460. float func(float a, float b){ return a+b; }
  3461. EOF
  3462. enabled thumb && check_cflags -mthumb || check_cflags -marm
  3463. nogas=die
  3464. if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
  3465. enable vfp_args
  3466. elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
  3467. case "${cross_prefix:-$cc}" in
  3468. *hardfloat*) enable vfp_args; fpabi=vfp ;;
  3469. *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
  3470. __asm__ (".eabi_attribute 28, 1");
  3471. int main(void) { return 0; }
  3472. EOF
  3473. esac
  3474. warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
  3475. fi
  3476. enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
  3477. enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
  3478. enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
  3479. enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
  3480. enabled vfp && check_insn vfp 'fadds s0, s0, s0'
  3481. enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
  3482. [ $target_os = linux ] ||
  3483. map 'enabled_any ${v}_external ${v}_inline || disable $v' \
  3484. $ARCH_EXT_LIST_ARM
  3485. check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
  3486. check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
  3487. [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
  3488. elif enabled mips; then
  3489. check_inline_asm loongson '"dmult.g $1, $2, $3"'
  3490. enabled mips32r2 && add_cflags "-mips32r2" && add_asflags "-mips32r2" &&
  3491. check_inline_asm mips32r2 '"rotr $t0, $t1, 1"'
  3492. enabled mipsdspr1 && add_cflags "-mdsp" && add_asflags "-mdsp" &&
  3493. check_inline_asm mipsdspr1 '"addu.qb $t0, $t1, $t2"'
  3494. enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
  3495. check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
  3496. enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
  3497. check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"'
  3498. elif enabled parisc; then
  3499. if enabled gcc; then
  3500. case $($cc -dumpversion) in
  3501. 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
  3502. esac
  3503. fi
  3504. elif enabled ppc; then
  3505. enable local_aligned_8 local_aligned_16
  3506. check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
  3507. check_inline_asm ibm_asm '"add 0, 0, 0"'
  3508. check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
  3509. check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
  3510. # AltiVec flags: The FSF version of GCC differs from the Apple version
  3511. if enabled altivec; then
  3512. nogas=warn
  3513. check_cflags -maltivec -mabi=altivec &&
  3514. { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
  3515. check_cflags -faltivec
  3516. # check if our compiler supports Motorola AltiVec C API
  3517. check_cc <<EOF || disable altivec
  3518. $inc_altivec_h
  3519. int main(void) {
  3520. vector signed int v1 = (vector signed int) { 0 };
  3521. vector signed int v2 = (vector signed int) { 1 };
  3522. v1 = vec_add(v1, v2);
  3523. return 0;
  3524. }
  3525. EOF
  3526. enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
  3527. fi
  3528. elif enabled sparc; then
  3529. enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
  3530. elif enabled x86; then
  3531. check_builtin rdtsc intrin.h "__rdtsc()"
  3532. check_builtin mm_empty mmintrin.h "_mm_empty()"
  3533. enable local_aligned_8 local_aligned_16
  3534. # check whether EBP is available on x86
  3535. # As 'i' is stored on the stack, this program will crash
  3536. # if the base pointer is used to access it because the
  3537. # base pointer is cleared in the inline assembly code.
  3538. check_exec_crash <<EOF && enable ebp_available
  3539. volatile int i=0;
  3540. __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
  3541. return i;
  3542. EOF
  3543. # check whether EBX is available on x86
  3544. check_inline_asm ebx_available '""::"b"(0)' &&
  3545. check_inline_asm ebx_available '"":::"%ebx"'
  3546. # check whether xmm clobbers are supported
  3547. check_inline_asm xmm_clobbers '"":::"%xmm0"'
  3548. # check whether binutils is new enough to compile SSSE3/MMXEXT
  3549. enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
  3550. enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
  3551. if ! disabled_any asm mmx yasm; then
  3552. if check_cmd $yasmexe --version; then
  3553. enabled x86_64 && yasm_extra="-m amd64"
  3554. yasm_debug="-g dwarf2"
  3555. elif check_cmd nasm -v; then
  3556. yasmexe=nasm
  3557. yasm_debug="-g -F dwarf"
  3558. enabled x86_64 && test "$objformat" = elf && objformat=elf64
  3559. fi
  3560. YASMFLAGS="-f $objformat $yasm_extra"
  3561. enabled pic && append YASMFLAGS "-DPIC"
  3562. test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
  3563. case "$objformat" in
  3564. elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
  3565. esac
  3566. check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
  3567. die "yasm not found, use --disable-yasm for a crippled build"
  3568. check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx_external
  3569. check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
  3570. check_yasm "CPU amdnop" && enabled i686 && enable cpunop
  3571. fi
  3572. case "$cpu" in
  3573. athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
  3574. disable fast_clz
  3575. ;;
  3576. esac
  3577. fi
  3578. if enabled asm; then
  3579. as=${gas:=$as}
  3580. check_as <<EOF && enable gnu_as || \
  3581. $nogas "GNU assembler not found, install gas-preprocessor"
  3582. .macro m n
  3583. \n: .int 0
  3584. .endm
  3585. m x
  3586. EOF
  3587. fi
  3588. check_ldflags -Wl,--as-needed
  3589. if check_func dlopen; then
  3590. ldl=
  3591. elif check_func dlopen -ldl; then
  3592. ldl=-ldl
  3593. fi
  3594. if ! disabled network; then
  3595. check_type "sys/types.h sys/socket.h" socklen_t
  3596. check_type netdb.h "struct addrinfo"
  3597. check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
  3598. check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
  3599. check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
  3600. check_type netinet/in.h "struct sockaddr_in6"
  3601. check_type poll.h "struct pollfd"
  3602. check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
  3603. check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
  3604. check_type netinet/sctp.h "struct sctp_event_subscribe"
  3605. check_func getaddrinfo $network_extralibs
  3606. check_func getservbyport $network_extralibs
  3607. # Prefer arpa/inet.h over winsock2
  3608. if check_header arpa/inet.h ; then
  3609. check_func closesocket
  3610. elif check_header winsock2.h ; then
  3611. check_func_headers winsock2.h closesocket -lws2 &&
  3612. network_extralibs="-lws2" ||
  3613. { check_func_headers winsock2.h closesocket -lws2_32 &&
  3614. network_extralibs="-lws2_32"; }
  3615. check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
  3616. check_type ws2tcpip.h socklen_t
  3617. check_type ws2tcpip.h "struct addrinfo"
  3618. check_type ws2tcpip.h "struct group_source_req"
  3619. check_type ws2tcpip.h "struct ip_mreq_source"
  3620. check_type ws2tcpip.h "struct ipv6_mreq"
  3621. check_type winsock2.h "struct pollfd"
  3622. check_type ws2tcpip.h "struct sockaddr_in6"
  3623. check_type ws2tcpip.h "struct sockaddr_storage"
  3624. check_struct winsock2.h "struct sockaddr" sa_len
  3625. else
  3626. disable network
  3627. fi
  3628. fi
  3629. # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
  3630. check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
  3631. check_func access
  3632. check_func clock_gettime || { check_func clock_gettime -lrt && add_extralibs -lrt; }
  3633. check_func fcntl
  3634. check_func fork
  3635. check_func_headers stdlib.h getenv
  3636. check_func gethrtime
  3637. check_func getopt
  3638. check_func getrusage
  3639. check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  3640. check_func gettimeofday
  3641. check_func inet_aton $network_extralibs
  3642. check_func isatty
  3643. check_func localtime_r
  3644. check_func ${malloc_prefix}memalign && enable memalign
  3645. check_func mkstemp
  3646. check_func mmap
  3647. check_func mprotect
  3648. check_func ${malloc_prefix}posix_memalign && enable posix_memalign
  3649. check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
  3650. check_func setrlimit
  3651. check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  3652. check_func strerror_r
  3653. check_func sched_getaffinity
  3654. check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
  3655. check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
  3656. check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
  3657. check_builtin MemoryBarrier windows.h "MemoryBarrier()"
  3658. check_func sysconf
  3659. check_func sysctl
  3660. check_func usleep
  3661. check_func_headers conio.h kbhit
  3662. check_func_headers windows.h PeekNamedPipe
  3663. check_func_headers io.h setmode
  3664. check_func_headers lzo/lzo1x.h lzo1x_999_compress
  3665. check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
  3666. check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
  3667. check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
  3668. check_func_headers windows.h GetProcessAffinityMask
  3669. check_func_headers windows.h GetProcessTimes
  3670. check_func_headers windows.h GetSystemTimeAsFileTime
  3671. check_func_headers windows.h MapViewOfFile
  3672. check_func_headers windows.h SetConsoleTextAttribute
  3673. check_func_headers windows.h Sleep
  3674. check_func_headers windows.h VirtualAlloc
  3675. check_func_headers glob.h glob
  3676. check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
  3677. check_header cl/cl.h
  3678. check_header direct.h
  3679. check_header dlfcn.h
  3680. check_header dxva.h
  3681. check_header dxva2api.h -D_WIN32_WINNT=0x0600
  3682. check_header io.h
  3683. check_header libcrystalhd/libcrystalhd_if.h
  3684. check_header malloc.h
  3685. check_header poll.h
  3686. check_header sys/mman.h
  3687. check_header sys/param.h
  3688. check_header sys/resource.h
  3689. check_header sys/select.h
  3690. check_header sys/time.h
  3691. check_header termios.h
  3692. check_header unistd.h
  3693. check_header vdpau/vdpau.h
  3694. check_header vdpau/vdpau_x11.h
  3695. check_header VideoDecodeAcceleration/VDADecoder.h
  3696. check_header windows.h
  3697. check_header X11/extensions/XvMClib.h
  3698. check_header asm/types.h
  3699. disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
  3700. disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
  3701. if ! disabled w32threads && ! enabled pthreads; then
  3702. check_func_headers "windows.h process.h" _beginthreadex && enable w32threads
  3703. fi
  3704. # check for some common methods of building with pthread support
  3705. # do this before the optional library checks as some of them require pthreads
  3706. if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
  3707. enable pthreads
  3708. if check_func pthread_create; then
  3709. :
  3710. elif check_func pthread_create -pthread; then
  3711. add_cflags -pthread
  3712. add_extralibs -pthread
  3713. elif check_func pthread_create -pthreads; then
  3714. add_cflags -pthreads
  3715. add_extralibs -pthreads
  3716. elif check_func pthread_create -lpthreadGC2; then
  3717. add_extralibs -lpthreadGC2
  3718. elif ! check_lib pthread.h pthread_create -lpthread; then
  3719. disable pthreads
  3720. fi
  3721. fi
  3722. for thread in $THREADS_LIST; do
  3723. if enabled $thread; then
  3724. test -n "$thread_type" &&
  3725. die "ERROR: Only one thread type must be selected." ||
  3726. thread_type="$thread"
  3727. fi
  3728. done
  3729. if enabled pthreads; then
  3730. check_func pthread_cancel
  3731. fi
  3732. enabled sync_val_compare_and_swap && enable atomics_gcc
  3733. enabled_all atomic_cas_ptr machine_rw_barrier && enable atomics_suncc
  3734. enabled MemoryBarrier && enable atomics_win32
  3735. check_lib math.h sin -lm && LIBM="-lm"
  3736. disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
  3737. atan2f_args=2
  3738. ldexpf_args=2
  3739. powf_args=2
  3740. for func in $MATH_FUNCS; do
  3741. eval check_mathfunc $func \${${func}_args:-1}
  3742. done
  3743. # these are off by default, so fail if requested and not available
  3744. enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } ||
  3745. { check_lib2 "dlfcn.h" dlopen -ldl; } ||
  3746. die "ERROR: LoadLibrary/dlopen not found for avisynth"; }
  3747. enabled fontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
  3748. enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
  3749. enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
  3750. enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
  3751. enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
  3752. enabled libass && require_pkg_config libass ass/ass.h ass_library_init
  3753. enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray
  3754. enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
  3755. { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
  3756. die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
  3757. enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
  3758. enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
  3759. enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
  3760. 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"
  3761. enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
  3762. enabled libfreetype && require_pkg_config freetype2 "ft2build.h freetype/freetype.h" FT_Init_FreeType
  3763. enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
  3764. check_lib "${gsm_hdr}" gsm_create -lgsm && break;
  3765. done || die "ERROR: libgsm not found"; }
  3766. enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  3767. enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
  3768. enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
  3769. enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
  3770. enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  3771. enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
  3772. enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
  3773. enabled libopenjpeg && { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg ||
  3774. check_lib openjpeg.h opj_version -lopenjpeg ||
  3775. die "ERROR: libopenjpeg not found"; }
  3776. enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
  3777. enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
  3778. enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
  3779. enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
  3780. enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
  3781. enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_frame
  3782. enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
  3783. enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
  3784. enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
  3785. media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
  3786. media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
  3787. enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
  3788. enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
  3789. { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
  3790. die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
  3791. enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
  3792. enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
  3793. enabled libvidstab && require_pkg_config vidstab vid.stab/libvidstab.h vsMotionDetectInit
  3794. enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
  3795. enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  3796. enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
  3797. enabled libvpx && {
  3798. enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
  3799. die "ERROR: libvpx decoder version must be >=0.9.1"; }
  3800. 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 ||
  3801. die "ERROR: libvpx encoder version must be >=0.9.7"; }
  3802. enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
  3803. enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } }
  3804. enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
  3805. enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
  3806. { check_cpp_condition x264.h "X264_BUILD >= 118" ||
  3807. die "ERROR: libx264 must be installed and version must be >= 0.118."; }
  3808. enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
  3809. enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
  3810. enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new
  3811. enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
  3812. check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
  3813. die "ERROR: openal not found"; } &&
  3814. { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
  3815. die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
  3816. enabled opencl && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
  3817. check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
  3818. die "ERROR: opencl not found"; } &&
  3819. { enabled_any w32threads os2threads &&
  3820. die "opencl currently needs --enable-pthreads or --disable-w32threads"; } &&
  3821. { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
  3822. check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
  3823. die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
  3824. enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
  3825. check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
  3826. check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
  3827. die "ERROR: openssl not found"; }
  3828. if enabled gnutls; then
  3829. { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
  3830. { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
  3831. fi
  3832. # libdc1394 check
  3833. if enabled libdc1394; then
  3834. { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
  3835. enable libdc1394_2; } ||
  3836. { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
  3837. enable libdc1394_1; } ||
  3838. die "ERROR: No version of libdc1394 found "
  3839. fi
  3840. SDL_CONFIG="${cross_prefix}sdl-config"
  3841. if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
  3842. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3843. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  3844. enable sdl
  3845. else
  3846. if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
  3847. sdl_cflags=$("${SDL_CONFIG}" --cflags)
  3848. sdl_libs=$("${SDL_CONFIG}" --libs)
  3849. check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
  3850. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
  3851. check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
  3852. enable sdl
  3853. fi
  3854. fi
  3855. enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
  3856. texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
  3857. makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
  3858. perl --version > /dev/null 2>&1 && enable perl || disable perl
  3859. pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
  3860. rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  3861. check_header linux/fb.h
  3862. check_header linux/videodev.h
  3863. check_header linux/videodev2.h
  3864. check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  3865. check_header sys/videoio.h
  3866. check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
  3867. # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
  3868. # w32api 3.12 had it defined wrong
  3869. check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  3870. check_type "dshow.h" IBaseFilter
  3871. # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
  3872. { check_header dev/bktr/ioctl_meteor.h &&
  3873. check_header dev/bktr/ioctl_bt848.h; } ||
  3874. { check_header machine/ioctl_meteor.h &&
  3875. check_header machine/ioctl_bt848.h; } ||
  3876. { check_header dev/video/meteor/ioctl_meteor.h &&
  3877. check_header dev/video/bktr/ioctl_bt848.h; } ||
  3878. check_header dev/ic/bt8xx.h
  3879. check_header sndio.h
  3880. if check_struct sys/soundcard.h audio_buf_info bytes; then
  3881. enable_safe sys/soundcard.h
  3882. else
  3883. check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
  3884. #include <sys/soundcard.h>
  3885. audio_buf_info abc;
  3886. EOF
  3887. fi
  3888. check_header soundcard.h
  3889. enabled_any alsa_indev alsa_outdev &&
  3890. check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
  3891. enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait &&
  3892. check_func jack_port_get_latency_range -ljack
  3893. enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
  3894. if enabled libcdio; then
  3895. check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  3896. check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
  3897. die "ERROR: libcdio-paranoia not found"
  3898. fi
  3899. enabled x11grab &&
  3900. require X11 X11/Xlib.h XOpenDisplay -lX11 &&
  3901. require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
  3902. require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes
  3903. enabled vaapi &&
  3904. check_lib va/va.h vaInitialize -lva ||
  3905. disable vaapi
  3906. enabled vdpau &&
  3907. check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
  3908. disable vdpau
  3909. # Funny iconv installations are not unusual, so check it after all flags have been set
  3910. disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv
  3911. enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  3912. # add some useful compiler flags if supported
  3913. check_cflags -Wdeclaration-after-statement
  3914. check_cflags -Wall
  3915. check_cflags -Wno-parentheses
  3916. check_cflags -Wno-switch
  3917. check_cflags -Wno-format-zero-length
  3918. check_cflags -Wdisabled-optimization
  3919. check_cflags -Wpointer-arith
  3920. check_cflags -Wredundant-decls
  3921. check_cflags -Wno-pointer-sign
  3922. check_cflags -Wwrite-strings
  3923. check_cflags -Wtype-limits
  3924. check_cflags -Wundef
  3925. check_cflags -Wmissing-prototypes
  3926. check_cflags -Wno-pointer-to-int-cast
  3927. check_cflags -Wstrict-prototypes
  3928. enabled extra_warnings && check_cflags -Winline
  3929. # add some linker flags
  3930. check_ldflags -Wl,--warn-common
  3931. check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
  3932. test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
  3933. enabled xmm_clobber_test &&
  3934. check_ldflags -Wl,--wrap,avcodec_open2 \
  3935. -Wl,--wrap,avcodec_decode_audio4 \
  3936. -Wl,--wrap,avcodec_decode_video2 \
  3937. -Wl,--wrap,avcodec_decode_subtitle2 \
  3938. -Wl,--wrap,avcodec_encode_audio2 \
  3939. -Wl,--wrap,avcodec_encode_video \
  3940. -Wl,--wrap,avcodec_encode_subtitle \
  3941. -Wl,--wrap,sws_scale ||
  3942. disable xmm_clobber_test
  3943. echo "X{};" > $TMPV
  3944. if test_ldflags -Wl,--version-script,$TMPV; then
  3945. append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
  3946. check_cc <<EOF && enable symver_asm_label
  3947. void ff_foo(void) __asm__ ("av_foo@VERSION");
  3948. void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
  3949. EOF
  3950. check_cc <<EOF && enable symver_gnu_asm
  3951. __asm__(".symver ff_foo,av_foo@VERSION");
  3952. void ff_foo(void) {}
  3953. EOF
  3954. fi
  3955. if [ -z "$optflags" ]; then
  3956. if enabled small; then
  3957. optflags=$cflags_size
  3958. elif enabled optimizations; then
  3959. optflags=$cflags_speed
  3960. else
  3961. optflags=$cflags_noopt
  3962. fi
  3963. fi
  3964. check_optflags(){
  3965. check_cflags "$@"
  3966. enabled lto && check_ldflags "$@"
  3967. }
  3968. if enabled lto; then
  3969. test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
  3970. check_cflags -flto
  3971. check_ldflags -flto $cpuflags
  3972. fi
  3973. check_optflags $optflags
  3974. check_optflags -fno-math-errno
  3975. check_optflags -fno-signed-zeros
  3976. enabled ftrapv && check_cflags -ftrapv
  3977. check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
  3978. int x;
  3979. EOF
  3980. if enabled icc; then
  3981. # Just warnings, no remarks
  3982. check_cflags -w1
  3983. # -wd: Disable following warnings
  3984. # 144, 167, 556: -Wno-pointer-sign
  3985. # 188: enumerated type mixed with another type
  3986. # 1292: attribute "foo" ignored
  3987. # 1419: external declaration in primary source file
  3988. # 10006: ignoring unknown option -fno-signed-zeros
  3989. # 10148: ignoring unknown option -Wno-parentheses
  3990. # 10156: ignoring option '-W'; no argument required
  3991. check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156
  3992. # 11030: Warning unknown option --as-needed
  3993. # 10156: ignoring option '-export'; no argument required
  3994. check_ldflags -wd10156,11030
  3995. # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
  3996. enable ebp_available
  3997. if enabled x86_32; then
  3998. icc_version=$($cc -dumpversion)
  3999. test ${icc_version%%.*} -ge 11 &&
  4000. check_cflags -falign-stack=maintain-16-byte ||
  4001. disable aligned_stack
  4002. fi
  4003. elif enabled ccc; then
  4004. # disable some annoying warnings
  4005. add_cflags -msg_disable bitnotint
  4006. add_cflags -msg_disable mixfuncvoid
  4007. add_cflags -msg_disable nonstandcast
  4008. add_cflags -msg_disable unsupieee
  4009. elif enabled gcc; then
  4010. check_optflags -fno-tree-vectorize
  4011. check_cflags -Werror=implicit-function-declaration
  4012. check_cflags -Werror=missing-prototypes
  4013. check_cflags -Werror=return-type
  4014. check_cflags -Werror=vla
  4015. elif enabled llvm_gcc; then
  4016. check_cflags -mllvm -stack-alignment=16
  4017. elif enabled clang; then
  4018. check_cflags -mllvm -stack-alignment=16
  4019. check_cflags -Qunused-arguments
  4020. check_cflags -Werror=implicit-function-declaration
  4021. check_cflags -Werror=missing-prototypes
  4022. check_cflags -Werror=return-type
  4023. elif enabled armcc; then
  4024. # 2523: use of inline assembler is deprecated
  4025. add_cflags -W${armcc_opt},--diag_suppress=2523
  4026. add_cflags -W${armcc_opt},--diag_suppress=1207
  4027. add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
  4028. add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
  4029. add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
  4030. add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
  4031. elif enabled tms470; then
  4032. add_cflags -pds=824 -pds=837
  4033. elif enabled pathscale; then
  4034. add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
  4035. elif enabled_any msvc icl; then
  4036. enabled x86_32 && disable aligned_stack
  4037. enabled_all x86_32 debug && add_cflags -Oy-
  4038. if enabled icl; then
  4039. # basically -fstrict-aliasing that does not work (correctly) on icl 13.x
  4040. check_cpp_condition "windows.h" "__ICL < 1300" && add_cflags -Qansi-alias
  4041. # icl will pass the inline asm tests but inline asm is currently
  4042. # not supported (build will fail)
  4043. disable inline_asm
  4044. fi
  4045. fi
  4046. case $target_os in
  4047. osf1)
  4048. enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
  4049. ;;
  4050. plan9)
  4051. add_cppflags -Dmain=plan9_main
  4052. ;;
  4053. esac
  4054. enable frame_thread_encoder
  4055. enabled_any $THREADS_LIST && enable threads
  4056. enabled_any $ATOMICS_LIST && enable atomics_native
  4057. enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
  4058. check_deps $CONFIG_LIST \
  4059. $CONFIG_EXTRA \
  4060. $HAVE_LIST \
  4061. $ALL_COMPONENTS \
  4062. if test $target_os = "haiku"; then
  4063. disable memalign
  4064. disable posix_memalign
  4065. fi
  4066. ! enabled_any memalign posix_memalign aligned_malloc &&
  4067. enabled_any $need_memalign && enable memalign_hack
  4068. # add_dep lib dep
  4069. # -> enable ${lib}_deps_${dep}
  4070. # -> add $dep to ${lib}_deps only once
  4071. add_dep() {
  4072. lib=$1
  4073. dep=$2
  4074. enabled "${lib}_deps_${dep}" && return 0
  4075. enable "${lib}_deps_${dep}"
  4076. prepend "${lib}_deps" $dep
  4077. }
  4078. # merge deps lib components
  4079. # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
  4080. merge_deps() {
  4081. lib=$1
  4082. shift
  4083. for comp in $*; do
  4084. enabled $comp || continue
  4085. eval "dep=\"\$${comp}_deps\""
  4086. for d in $dep; do
  4087. add_dep $lib $d
  4088. done
  4089. done
  4090. }
  4091. merge_deps libavfilter $FILTER_LIST
  4092. echo "install prefix $prefix"
  4093. echo "source path $source_path"
  4094. echo "C compiler $cc"
  4095. echo "ARCH $arch ($cpu)"
  4096. if test "$build_suffix" != ""; then
  4097. echo "build suffix $build_suffix"
  4098. fi
  4099. if test "$progs_suffix" != ""; then
  4100. echo "progs suffix $progs_suffix"
  4101. fi
  4102. if test "$extra_version" != ""; then
  4103. echo "version string suffix $extra_version"
  4104. fi
  4105. echo "big-endian ${bigendian-no}"
  4106. echo "runtime cpu detection ${runtime_cpudetect-no}"
  4107. if enabled x86; then
  4108. echo "${yasmexe} ${yasm-no}"
  4109. echo "MMX enabled ${mmx-no}"
  4110. echo "MMXEXT enabled ${mmxext-no}"
  4111. echo "3DNow! enabled ${amd3dnow-no}"
  4112. echo "3DNow! extended enabled ${amd3dnowext-no}"
  4113. echo "SSE enabled ${sse-no}"
  4114. echo "SSSE3 enabled ${ssse3-no}"
  4115. echo "AVX enabled ${avx-no}"
  4116. echo "FMA4 enabled ${fma4-no}"
  4117. echo "i686 features enabled ${i686-no}"
  4118. echo "CMOV is fast ${fast_cmov-no}"
  4119. echo "EBX available ${ebx_available-no}"
  4120. echo "EBP available ${ebp_available-no}"
  4121. fi
  4122. if enabled arm; then
  4123. echo "ARMv5TE enabled ${armv5te-no}"
  4124. echo "ARMv6 enabled ${armv6-no}"
  4125. echo "ARMv6T2 enabled ${armv6t2-no}"
  4126. echo "VFP enabled ${vfp-no}"
  4127. echo "NEON enabled ${neon-no}"
  4128. echo "THUMB enabled ${thumb-no}"
  4129. fi
  4130. if enabled mips; then
  4131. echo "MIPS FPU enabled ${mipsfpu-no}"
  4132. echo "MIPS32R2 enabled ${mips32r2-no}"
  4133. echo "MIPS DSP R1 enabled ${mipsdspr1-no}"
  4134. echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
  4135. fi
  4136. if enabled ppc; then
  4137. echo "AltiVec enabled ${altivec-no}"
  4138. echo "PPC 4xx optimizations ${ppc4xx-no}"
  4139. echo "dcbzl available ${dcbzl-no}"
  4140. fi
  4141. if enabled sparc; then
  4142. echo "VIS enabled ${vis-no}"
  4143. fi
  4144. echo "debug symbols ${debug-no}"
  4145. echo "strip symbols ${stripping-no}"
  4146. echo "optimize for size ${small-no}"
  4147. echo "optimizations ${optimizations-no}"
  4148. echo "static ${static-no}"
  4149. echo "shared ${shared-no}"
  4150. echo "postprocessing support ${postproc-no}"
  4151. echo "new filter support ${avfilter-no}"
  4152. echo "network support ${network-no}"
  4153. echo "threading support ${thread_type-no}"
  4154. echo "safe bitstream reader ${safe_bitstream_reader-no}"
  4155. echo "SDL support ${sdl-no}"
  4156. echo "opencl enabled ${opencl-no}"
  4157. echo "libshine enabled ${libshine-no}"
  4158. echo "texi2html enabled ${texi2html-no}"
  4159. echo "perl enabled ${perl-no}"
  4160. echo "pod2man enabled ${pod2man-no}"
  4161. echo "makeinfo enabled ${makeinfo-no}"
  4162. test -n "$random_seed" &&
  4163. echo "random seed ${random_seed}"
  4164. echo
  4165. echo "External libraries:"
  4166. print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
  4167. echo
  4168. for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
  4169. echo "Enabled ${type}s:"
  4170. eval list=\$$(toupper $type)_LIST
  4171. print_enabled '_*' $list | print_3_columns
  4172. echo
  4173. done
  4174. license="LGPL version 2.1 or later"
  4175. if enabled nonfree; then
  4176. license="nonfree and unredistributable"
  4177. elif enabled gplv3; then
  4178. license="GPL version 3 or later"
  4179. elif enabled lgplv3; then
  4180. license="LGPL version 3 or later"
  4181. elif enabled gpl; then
  4182. license="GPL version 2 or later"
  4183. fi
  4184. echo "License: $license"
  4185. echo "Creating config.mak, config.h, and doc/config.texi..."
  4186. test -e Makefile || $ln_s "$source_path/Makefile" .
  4187. enabled stripping || strip="echo skipping strip"
  4188. config_files="$TMPH config.mak doc/config.texi"
  4189. cat > config.mak <<EOF
  4190. # Automatically generated by configure - do not modify!
  4191. ifndef FFMPEG_CONFIG_MAK
  4192. FFMPEG_CONFIG_MAK=1
  4193. FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
  4194. prefix=$prefix
  4195. LIBDIR=\$(DESTDIR)$libdir
  4196. SHLIBDIR=\$(DESTDIR)$shlibdir
  4197. INCDIR=\$(DESTDIR)$incdir
  4198. BINDIR=\$(DESTDIR)$bindir
  4199. DATADIR=\$(DESTDIR)$datadir
  4200. MANDIR=\$(DESTDIR)$mandir
  4201. SRC_PATH=$source_path
  4202. ifndef MAIN_MAKEFILE
  4203. SRC_PATH:=\$(SRC_PATH:.%=..%)
  4204. endif
  4205. CC_IDENT=$cc_ident
  4206. ARCH=$arch
  4207. CC=$cc
  4208. CXX=$cxx
  4209. AS=$as
  4210. LD=$ld
  4211. DEPCC=$dep_cc
  4212. DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
  4213. DEPAS=$as
  4214. DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
  4215. YASM=$yasmexe
  4216. DEPYASM=$yasmexe
  4217. AR=$ar
  4218. ARFLAGS=$arflags
  4219. AR_O=$ar_o
  4220. RANLIB=$ranlib
  4221. CP=cp -p
  4222. LN_S=$ln_s
  4223. STRIP=$strip
  4224. CPPFLAGS=$CPPFLAGS
  4225. CFLAGS=$CFLAGS
  4226. CXXFLAGS=$CXXFLAGS
  4227. ASFLAGS=$ASFLAGS
  4228. AS_C=$AS_C
  4229. AS_O=$AS_O
  4230. CC_C=$CC_C
  4231. CC_E=$CC_E
  4232. CC_O=$CC_O
  4233. CXX_C=$CXX_C
  4234. CXX_O=$CXX_O
  4235. LD_O=$LD_O
  4236. LD_LIB=$LD_LIB
  4237. LD_PATH=$LD_PATH
  4238. DLLTOOL=$dlltool
  4239. LDFLAGS=$LDFLAGS
  4240. LDFLAGS-ffserver=$FFSERVERLDFLAGS
  4241. SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
  4242. YASMFLAGS=$YASMFLAGS
  4243. BUILDSUF=$build_suffix
  4244. PROGSSUF=$progs_suffix
  4245. FULLNAME=$FULLNAME
  4246. LIBPREF=$LIBPREF
  4247. LIBSUF=$LIBSUF
  4248. LIBNAME=$LIBNAME
  4249. SLIBPREF=$SLIBPREF
  4250. SLIBSUF=$SLIBSUF
  4251. EXESUF=$EXESUF
  4252. EXTRA_VERSION=$extra_version
  4253. CCDEP=$CCDEP
  4254. CXXDEP=$CXXDEP
  4255. CCDEP_FLAGS=$CCDEP_FLAGS
  4256. ASDEP=$ASDEP
  4257. ASDEP_FLAGS=$ASDEP_FLAGS
  4258. CC_DEPFLAGS=$CC_DEPFLAGS
  4259. AS_DEPFLAGS=$AS_DEPFLAGS
  4260. HOSTCC=$host_cc
  4261. HOSTLD=$host_ld
  4262. HOSTCFLAGS=$host_cflags
  4263. HOSTCPPFLAGS=$host_cppflags
  4264. HOSTEXESUF=$HOSTEXESUF
  4265. HOSTLDFLAGS=$host_ldflags
  4266. HOSTLIBS=$host_libs
  4267. DEPHOSTCC=$host_cc
  4268. DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
  4269. HOSTCCDEP=$HOSTCCDEP
  4270. HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
  4271. HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
  4272. HOSTCC_C=$HOSTCC_C
  4273. HOSTCC_O=$HOSTCC_O
  4274. HOSTLD_O=$HOSTLD_O
  4275. TARGET_EXEC=$target_exec $target_exec_args
  4276. TARGET_PATH=$target_path
  4277. TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
  4278. LIBS-ffplay=$sdl_libs
  4279. CFLAGS-ffplay=$sdl_cflags
  4280. ZLIB=$($ldflags_filter -lz)
  4281. LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
  4282. EXTRALIBS=$extralibs
  4283. COMPAT_OBJS=$compat_objs
  4284. EXEOBJS=$exeobjs
  4285. INSTALL=$install
  4286. LIBTARGET=${LIBTARGET}
  4287. SLIBNAME=${SLIBNAME}
  4288. SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
  4289. SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
  4290. SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
  4291. SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
  4292. SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
  4293. SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
  4294. SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
  4295. SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
  4296. SAMPLES:=${samples:-\$(FATE_SAMPLES)}
  4297. NOREDZONE_FLAGS=$noredzone_flags
  4298. EOF
  4299. get_version(){
  4300. lcname=lib${1}
  4301. name=$(toupper $lcname)
  4302. file=$source_path/$lcname/version.h
  4303. eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
  4304. eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
  4305. eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
  4306. eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
  4307. eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
  4308. }
  4309. map 'get_version $v' $LIBRARY_LIST
  4310. cat > $TMPH <<EOF
  4311. /* Automatically generated by configure - do not modify! */
  4312. #ifndef FFMPEG_CONFIG_H
  4313. #define FFMPEG_CONFIG_H
  4314. #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
  4315. #define FFMPEG_LICENSE "$(c_escape $license)"
  4316. #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
  4317. #define AVCONV_DATADIR "$(eval c_escape $datadir)"
  4318. #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
  4319. #define av_restrict $_restrict
  4320. #define EXTERN_PREFIX "${extern_prefix}"
  4321. #define EXTERN_ASM ${extern_prefix}
  4322. #define SLIBSUF "$SLIBSUF"
  4323. #define HAVE_MMX2 HAVE_MMXEXT
  4324. EOF
  4325. test -n "$assert_level" &&
  4326. echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
  4327. test -n "$malloc_prefix" &&
  4328. echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
  4329. if enabled yasm; then
  4330. append config_files $TMPASM
  4331. printf '' >$TMPASM
  4332. fi
  4333. enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
  4334. mkdir -p doc
  4335. echo "@c auto-generated by configure" > doc/config.texi
  4336. print_config ARCH_ "$config_files" $ARCH_LIST
  4337. print_config HAVE_ "$config_files" $HAVE_LIST
  4338. print_config CONFIG_ "$config_files" $CONFIG_LIST \
  4339. $CONFIG_EXTRA \
  4340. $ALL_COMPONENTS \
  4341. echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
  4342. echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
  4343. # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
  4344. cp_if_changed $TMPH config.h
  4345. touch .config
  4346. enabled yasm && cp_if_changed $TMPASM config.asm
  4347. cat > $TMPH <<EOF
  4348. /* Generated by ffconf */
  4349. #ifndef AVUTIL_AVCONFIG_H
  4350. #define AVUTIL_AVCONFIG_H
  4351. EOF
  4352. print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
  4353. echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
  4354. cp_if_changed $TMPH libavutil/avconfig.h
  4355. if test -n "$WARNINGS"; then
  4356. printf "\n$WARNINGS"
  4357. enabled fatal_warnings && exit 1
  4358. fi
  4359. # build pkg-config files
  4360. pkgconfig_generate(){
  4361. name=$1
  4362. shortname=${name#lib}${build_suffix}
  4363. comment=$2
  4364. version=$3
  4365. libs=$4
  4366. requires=$5
  4367. enabled ${name#lib} || return 0
  4368. mkdir -p $name
  4369. cat <<EOF > $name/$name${build_suffix}.pc
  4370. prefix=$prefix
  4371. exec_prefix=\${prefix}
  4372. libdir=$libdir
  4373. includedir=$incdir
  4374. Name: $name
  4375. Description: $comment
  4376. Version: $version
  4377. Requires: $(enabled shared || echo $requires)
  4378. Requires.private: $(enabled shared && echo $requires)
  4379. Conflicts:
  4380. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4381. Libs.private: $(enabled shared && echo $libs)
  4382. Cflags: -I\${includedir}
  4383. EOF
  4384. mkdir -p doc/examples/pc-uninstalled
  4385. includedir=${source_path}
  4386. [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
  4387. cat <<EOF > doc/examples/pc-uninstalled/$name.pc
  4388. prefix=
  4389. exec_prefix=
  4390. libdir=\${pcfiledir}/../../../$name
  4391. includedir=${includedir}
  4392. Name: $name
  4393. Description: $comment
  4394. Version: $version
  4395. Requires: $requires
  4396. Conflicts:
  4397. Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
  4398. Cflags: -I\${includedir}
  4399. EOF
  4400. }
  4401. lavfi_libs="libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4402. enabled libavfilter_deps_avcodec && prepend lavfi_libs "libavcodec${build_suffix} = $LIBAVCODEC_VERSION,"
  4403. enabled libavfilter_deps_avformat && prepend lavfi_libs "libavformat${build_suffix} = $LIBAVFORMAT_VERSION,"
  4404. enabled libavfilter_deps_avresample && prepend lavfi_libs "libavresample${build_suffix} = $LIBAVRESAMPLE_VERSION,"
  4405. enabled libavfilter_deps_swscale && prepend lavfi_libs "libswscale${build_suffix} = $LIBSWSCALE_VERSION,"
  4406. enabled libavfilter_deps_swresample && prepend lavfi_libs "libswresample${build_suffix} = $LIBSWRESAMPLE_VERSION,"
  4407. enabled libavfilter_deps_postproc && prepend lavfi_libs "libpostproc${build_suffix} = $LIBPOSTPROC_VERSION,"
  4408. lavfi_libs=${lavfi_libs%, }
  4409. lavd_libs="libavformat${build_suffix} = $LIBAVFORMAT_VERSION"
  4410. enabled lavfi_indev && prepend lavd_libs "libavfilter${build_suffix} = $LIBAVFILTER_VERSION,"
  4411. pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
  4412. pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4413. pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec${build_suffix} = $LIBAVCODEC_VERSION"
  4414. pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$lavd_libs"
  4415. pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs"
  4416. pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4417. pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4418. pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4419. pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
  4420. fix_ffmpeg_remote(){
  4421. git_remote_from=$1
  4422. git_remote_to=$2
  4423. fixme_remote=$(git --git-dir=$source_path/.git --work-tree=$source_path remote -v | grep $git_remote_from | cut -f 1 | sort | uniq)
  4424. if [ "$fixme_remote" != "" ]; then
  4425. echolog "
  4426. Outdated domain in git config, the official domain for ffmpeg git is since
  4427. November 2011, source.ffmpeg.org, both the old and the new point to the same
  4428. repository and server. To update it enter the following commands:
  4429. "
  4430. for remote in $fixme_remote; do
  4431. echolog "git remote set-url $remote $git_remote_to"
  4432. done
  4433. fi
  4434. }
  4435. if test -f "$source_path/.git/config"; then
  4436. remote_from=git.videolan.org
  4437. remote_to=source.ffmpeg.org
  4438. fix_ffmpeg_remote git@$remote_from:ffmpeg git@$remote_to:ffmpeg
  4439. fix_ffmpeg_remote git://$remote_from/ffmpeg git://$remote_to/ffmpeg
  4440. fi