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.

4954 lines
151KB

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