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.

4748 lines
144KB

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