release: updated changelog.
[profile/ivi/pulseaudio.git] / bootstrap.sh
1 #!/bin/bash
2
3 # This file is part of PulseAudio.
4 #
5 # PulseAudio is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # PulseAudio is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with PulseAudio; if not, write to the Free Software Foundation,
17 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18
19 VERSION=1.11
20
21 run_versioned() {
22     local P
23     local V
24
25     V=$(echo "$2" | sed -e 's,\.,,g')
26
27     if [ -e "`which $1$V 2> /dev/null`" ] ; then
28         P="$1$V"
29     else
30         if [ -e "`which $1-$2 2> /dev/null`" ] ; then
31             P="$1-$2"
32         else
33             P="$1"
34         fi
35     fi
36
37     shift 2
38     "$P" "$@"
39 }
40
41 set -ex
42
43 case $(uname) in
44         *Darwin*)
45                 LIBTOOLIZE="glibtoolize"
46                 ;;
47 esac
48 test "x$LIBTOOLIZE" = "x" && LIBTOOLIZE=libtoolize
49
50 if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
51     cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
52     chmod +x .git/hooks/pre-commit && \
53     echo "Activated pre-commit hook."
54 fi
55
56 if [ -f .tarball-version ]; then
57     echo "Marking tarball version as modified."
58     echo -n `cat .tarball-version | sed 's/-rebootstrapped$//'`-rebootstrapped >.tarball-version
59 fi
60
61 # We check for this here, because if pkg-config is not found in the
62 # system, it's likely that the pkg.m4 macro file is also not present,
63 # which will make PKG_PROG_PKG_CONFIG be undefined and the generated
64 # configure file faulty.
65 if ! pkg-config --version &>/dev/null; then
66     echo "pkg-config is required to bootstrap this program" &>/dev/null
67     DIE=1
68 fi
69
70 # Other necessary programs
71 glib-gettextize --version >/dev/null || DIE=1
72 intltoolize --version >/dev/null || DIE=1
73 $LIBTOOLIZE --version >/dev/null || DIE=1
74 test "$DIE" = 1 && exit 1
75
76 if type -p colorgcc > /dev/null ; then
77    export CC=colorgcc
78 fi
79
80 if [ "x$1" = "xam" ] ; then
81     run_versioned automake "$VERSION" -a -c --foreign
82     ./config.status
83 else
84     rm -rf autom4te.cache
85     rm -f config.cache
86
87     rm -f Makefile.am~ configure.ac~
88     glib-gettextize --copy --force
89     test -f Makefile.am~ && mv Makefile.am~ Makefile.am
90     test -f configure.ac~ && mv configure.ac~ configure.ac
91
92     touch config.rpath
93     intltoolize --copy --force --automake
94     "$LIBTOOLIZE" -c --force
95     run_versioned aclocal "$VERSION" -I m4
96     run_versioned autoconf 2.63 -Wall
97     run_versioned autoheader 2.63
98     run_versioned automake "$VERSION" --copy --foreign --add-missing
99
100     if test "x$NOCONFIGURE" = "x"; then
101         CFLAGS="$CFLAGS -g -O0" ./configure --sysconfdir=/etc --localstatedir=/var --enable-force-preopen "$@"
102         make clean
103     fi
104 fi