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.

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