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.

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