Merge remote-tracking branch 'github/pr/2059'
[collectd.git] / build.sh
1 #! /bin/sh
2
3 GLOBAL_ERROR_INDICATOR=0
4
5 check_for_application ()
6 {
7         for PROG in "$@"
8         do
9                 which "$PROG" >/dev/null 2>&1
10                 if test $? -ne 0; then
11                         cat >&2 <<EOF
12 WARNING: \`$PROG' not found!
13     Please make sure that \`$PROG' is installed and is in one of the
14     directories listed in the PATH environment variable.
15 EOF
16                         GLOBAL_ERROR_INDICATOR=1
17                 fi
18         done
19 }
20
21 check_for_application lex bison autoheader aclocal automake autoconf
22
23 # Actually we don't need the pkg-config executable, but we need the M4 macros.
24 # We check for `pkg-config' here and hope that M4 macros will then be
25 # available, too.
26 check_for_application pkg-config
27
28 libtoolize=""
29 libtoolize --version >/dev/null 2>/dev/null
30 if test $? -eq 0
31 then
32         libtoolize=libtoolize
33 else
34         glibtoolize --version >/dev/null 2>/dev/null
35         if test $? -eq 0
36         then
37                 libtoolize=glibtoolize
38         else
39                 cat >&2 <<EOF
40 WARNING: Neither \`libtoolize' nor \`glibtoolize' have been found!
41     Please make sure that one of them is installed and is in one of the
42     directories listed in the PATH environment variable.
43 EOF
44                 GLOBAL_ERROR_INDICATOR=1
45         fi
46  fi
47
48 if test "$GLOBAL_ERROR_INDICATOR" != "0"
49 then
50         exit 1
51 fi
52
53 set -x
54
55 autoheader \
56 && aclocal \
57 && $libtoolize --copy --force \
58 && automake --add-missing --copy \
59 && autoconf