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.

5199 lines
160KB

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