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.

4753 lines
144KB

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