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.

4616 lines
140KB

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