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.

4992 lines
153KB

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