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.

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