add a bit of comments on internal functions.
[asterisk/asterisk.git] / bootstrap.sh
1 #!/bin/sh
2
3 check_for_app() {
4         $1 --version 2>&1 >/dev/null
5         if [ $? != 0 ]
6         then
7                 echo "Please install $1 and run bootstrap.sh again!"
8                 exit 1
9         fi
10 }
11
12 # On FreeBSD and OpenBSD, multiple autoconf/automake versions have different names.
13 # On linux, envitonment variables tell which one to use.
14
15 uname -s | grep -q BSD
16 if [ $? = 0 ] ; then    # BSD case
17         uname -s | grep -q FreeBSD
18         if [ $? = 0 ] ; then # FreeBSD case
19                 MY_AC_VER=259
20                 MY_AM_VER=19
21         fi
22         uname -s | grep -q OpenBSD
23         if [ $? = 0 ] ; then # OpenBSD case
24                 MY_AC_VER=-2.61
25                 MY_AM_VER=-1.9
26         fi
27 else    # linux case
28         MY_AC_VER=
29         MY_AM_VER=
30         AUTOCONF_VERSION=2.60
31         AUTOMAKE_VERSION=1.9
32         export AUTOCONF_VERSION
33         export AUTOMAKE_VERSION
34 fi
35
36 check_for_app autoconf${MY_AC_VER}
37 check_for_app autoheader${MY_AC_VER}
38 check_for_app automake${MY_AM_VER}
39 check_for_app aclocal${MY_AM_VER}
40
41 echo "Generating the configure script ..."
42
43 aclocal${MY_AM_VER} 2>/dev/null
44 autoconf${MY_AC_VER}
45 autoheader${MY_AC_VER}
46 automake${MY_AM_VER} --add-missing --copy 2>/dev/null
47
48 exit 0