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.

4958 lines
152KB

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