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.

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