summaryrefslogtreecommitdiff
path: root/configure
blob: e5c7fe780a0bf80ea848a7a08a245c30bc58a126 (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
#!/bin/bash

set -e

OUT=Makefile.inc

> "${OUT}"

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

check() {
  checking="$1"
  shift
  var="${VAR:-${checking^^}}"
  cmd="${!var}"
  varflags="${var}FLAGS"
  varflags="$@ ${!varflags}"
  if [[ -z "${cmd}" ]]; then
    cmd="${checking}"
  fi
  get=$(command -v "${cmd}")
  e=$?
  if [[ -n "$get" ]]; then
    echo ${get}
    echo ${var} := ${get} ${varflags} >> "${OUT}"
  fi
  return $e
}

rcheck() {
  checking "$1"
  if ! check "$@"; then
    echo no
    return 1
  fi
}

ocheck() {
  rcheck "$@" || true
}

checking "zopfli or gzip"
VAR=GZIP check zopfli || check gzip -9

rcheck apngasm
rcheck convert
rcheck cwebp -quiet -alpha_cleanup -m 6
rcheck ffmpeg -v warning -y
rcheck npm --quiet
rcheck webpmux
ocheck defluff
ocheck pngquant
ocheck zopflipng