summaryrefslogtreecommitdiff
path: root/configure
blob: 3c060b2503e910204640bb02e058106795e04337 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash

checking() {
  printf "checking for %s... " "$1" >&2
}

check() {
  checking "$1"
  var="${VAR:-${1^^}}"
  cmd="${!var}"
  : ${cmd:=${1}}
  shift
  varflags="${var}FLAGS"
  varflags="$@ ${!varflags}"
  get=$(command -v "${cmd}")
  e=$?
  if [[ -n "$get" ]]; then
    if [[ -z "$NO_RUN" ]]; then
      ${get} -h >/dev/null 2>&1
      e=$?
      if (( $e )); then
        echo unusable, returned $e
        return $e
      fi
    fi
    declare -g "$var=$get"
    echo ${get}
    # intentionally stripping whitespace
    echo ${var} := ${get} ${varflags} >> "${OUT}" || exit 1
  else
    echo no
  fi
  return $e
}

rcheck() {
  check "$@" || exit
}

fcheck() {
  for f in $3; do
    checking "$f $1 support in ffmpeg"
    if grep -Eq "^ $2 $f " <<< "$4"; then
      echo yes
    else
      echo no
      exit 1
    fi
  done
}

OUT=Makefile.inc
> "${OUT}" || exit 1

VAR=GZIP check zopfli || rcheck gzip -9
NO_RUN=1 rcheck apngasm
rcheck convert
rcheck cwebp -quiet -alpha_cleanup -m 6
rcheck ffmpeg -v warning -y
F=$($FFMPEG -formats 2>&1)
fcheck demuxing "D." "matroska,webm ogg wav yuv4mpegpipe" "$F"
fcheck muxing ".E" "ipod mp4 ogg wav webm yuv4mpegpipe" "$F"
fcheck decoding ".{6}" "mpeg4 rawvideo pcm_s16le vorbis" "$($FFMPEG -decoders 2>&1)"
fcheck encoding ".{6}" "libx264 rawvideo libtheora libvpx libvpx-vp9 libfdk_aac libopus pcm_s16le" "$($FFMPEG -encoders 2>&1)"
rcheck npm --quiet
rcheck webpmux
NO_RUN=1 check defluff
check pngquant
check zopflipng