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.

5156 lines
159KB

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