1#!/bin/sh
2win=$1
3
4#autopoint check
5(autopoint --version) > /dev/null 2>&1 ||
6{
7    echo
8    echo "Error: you must have autopoint installed to compile mp3splt-gtk !"
9    echo
10    exit 1
11}
12
13#autoconf check
14(autoconf --version && autoheader --version) > /dev/null 2>&1 ||
15{
16    echo
17    echo "Error: you must have autoconf installed to compile mp3splt-gtk !"
18    echo
19    exit 1
20}
21
22#automake check
23(aclocal --version) > /dev/null 2>&1 ||
24{
25    echo
26    echo "Error: you must have automake installed to compile mp3splt-gtk !"
27    echo
28    exit 1
29}
30
31#msgfmt check
32(msgfmt --version) > /dev/null 2>&1 ||
33{
34    echo
35    echo "Error: you must have gettext(msgfmt) installed to compile mp3splt-gtk !"
36    echo
37    exit 1
38}
39
40#remove old libtool generated files
41rm -f m4/{libtool,argz,ltdl,ltoptions,lt~obsolete,ltversion,ltsugar}.m4
42rm -f libtool aclocal.m4 config.status configure autom4te.cache/* ltmain.sh
43
44if test "x$win" != x;then
45 WIN_ACLOCAL_FLAGS="-I /usr/share/aclocal"
46fi
47
48echo -n "Running autopoint... ";
49autopoint --ver 0.13.1 -f && echo "done";
50echo -n "Running aclocal... " \
51&& aclocal -I m4 $WIN_ACLOCAL_FLAGS $ACLOCAL_FLAGS && echo "done" \
52&& echo -n "Running autoheader... " \
53&& autoheader && echo "done"
54
55if test "x$win" = x; then {
56  echo "Trying to initialize the help file builder... "
57  echo " "
58  echo -n "Running gnome-doc-prepare... " \
59  && gnome-doc-prepare --force --automake \
60  && echo "done" \
61  && echo -n "Running aclocal again after adding the help files... " \
62  && aclocal -I m4 $WIN_ACLOCAL_FLAGS $ACLOCAL_FLAGS \
63  && echo "done"
64}; fi
65
66{
67   `which glibtoolize 2>&1 >/dev/null`
68    if [ $? -eq 0 ]; then
69      echo -n "Running glibtoolize (in case we use the cutter testing framework) ... "
70      glibtoolize -c --force
71    else
72      echo -n "Running libtoolize (in case we use the cutter testing framework) ... "
73      libtoolize -c --force
74    fi
75} && echo "done"
76
77echo -n "Running autoconf... " \
78&& autoconf && echo "done" \
79&& if test "x$win" = x; then {
80  if test -e build-aux/gnome-doc-utils.make; then
81    echo "Seems like we found working gnome documentation build utilities.";
82  else
83    echo "doc-dist-hook:" > build-aux/gnome-doc-utils.make;
84  fi
85}; else rm -f build-aux/gnome-doc-utils.make && touch build-aux/gnome-doc-utils.make; fi \
86&& echo -n "Running automake... " \
87&& automake -a -c && echo "done"
88
89if ! test -z $win ;then
90  touch build-aux/config.rpath
91  automake -a -c
92fi
93
94echo -n "Formatting language files with msgfmt... " && \
95{
96    cd po
97    for f in *.po; do
98        if test -r "$f"; then
99            lang=`echo $f | sed -e 's,\.po$,,'`
100            msgfmt -c -o $lang.gmo $lang.po
101        fi
102    done
103    cd ..
104} && echo "done"
105
106