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.

4867 lines
148KB

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