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.

4833 lines
147KB

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