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.

4725 lines
143KB

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