Update Finnish translation
[banshee.git] / autogen.sh
blob9f8aeed24968324a50cdc73835480f5c1a97f334
1 #!/usr/bin/env bash
3 PROJECT=banshee
5 function error () {
6 echo "Error: $1" 1>&2
7 exit 1
10 function check_autotool_version () {
11 which $1 &>/dev/null || {
12 error "$1 is not installed, and is required to configure $PACKAGE"
15 version=$($1 --version | head -n 1 | cut -f4 -d' ')
16 major=$(echo $version | cut -f1 -d.)
17 minor=$(echo $version | cut -f2 -d.)
18 rev=$(echo $version | cut -f3 -d. | sed 's/[^0-9].*$//')
19 major_check=$(echo $2 | cut -f1 -d.)
20 minor_check=$(echo $2 | cut -f2 -d.)
21 rev_check=$(echo $2 | cut -f3 -d.)
23 if [ $major -lt $major_check ]; then
24 do_bail=yes
25 elif [[ $minor -lt $minor_check && $major = $major_check ]]; then
26 do_bail=yes
27 elif [[ $rev -lt $rev_check && $minor = $minor_check && $major = $major_check ]]; then
28 do_bail=yes
31 if [ x"$do_bail" = x"yes" ]; then
32 error "$1 version $2 or better is required to configure $PROJECT"
36 function run () {
37 which $1 >/dev/null || {
38 error "Could not find '$1', which is required to configure $PROJECT"
40 echo "Running $@ ..."
41 $@ 2>.autogen.log || {
42 cat .autogen.log 1>&2
43 rm .autogen.log
44 error "There were errors when running '$1', a step that is required to configure $PROJECT"
46 rm .autogen.log
49 srcdir=$(dirname $0)
50 test -z "$srcdir" && srcdir=.
52 (test -f $srcdir/configure.ac) || {
53 error "Directory \"$srcdir\" does not look like the top-level $PROJECT directory"
56 builddir=`pwd`
57 cd "$srcdir"
59 # in case there are binaries from a previous compilation
60 make distclean 2>/dev/null
62 # MacPorts on OS X only seems to have glibtoolize
63 WHICHLIBTOOLIZE=$(which libtoolize || which glibtoolize)
64 if [ x"$WHICHLIBTOOLIZE" == x"" ]; then
65 error "libtool is required to configure $PROJECT"
67 LIBTOOLIZE=$(basename $WHICHLIBTOOLIZE)
69 check_autotool_version aclocal 1.9
70 check_autotool_version automake 1.10
71 check_autotool_version autoconf 2.53
72 check_autotool_version $LIBTOOLIZE 1.4.3
73 check_autotool_version intltoolize 0.35.0
74 check_autotool_version pkg-config 0.14.0
76 if git --help &>/dev/null; then
77 git submodule update --init
80 run intltoolize --force --copy
81 run $LIBTOOLIZE --force --copy --automake
82 run aclocal -I build/m4/banshee -I build/m4/shamrock -I build/m4/shave $ACLOCAL_FLAGS
83 run autoconf
84 run autoheader
86 test -f config.h.in && touch config.h.in
87 run automake --gnu --add-missing --force --copy \
88 -Wno-portability -Wno-portability
90 if [ ! -z "$NOCONFIGURE" ]; then
91 echo "Done. ./configure skipped."
92 exit $?
95 if [ $# = 0 ]; then
96 echo "WARNING: I am going to run configure without any arguments."
99 cd "$builddir"
101 { cat <<EOF
102 #!/usr/bin/env bash
103 ./autogen.sh $@ \$@
105 } > reautogen.sh
106 chmod +x reautogen.sh
108 run "$srcdir/configure" $@