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.

5189 lines
160KB

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