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.

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