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.

4776 lines
145KB

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