autogen aclocal fixups + build chroot dependency fixes
[openitg.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate configure, the initial makefiles, etc.
3 #
4 # Source (non-CVS) distributions should come with a "configure" script
5 # already generated--people simply compiling the program shouldn't
6 # need autoconf and friends installed.
7 #
8 # CVS only contains the source files: Makefile.am, configure.ac, and
9 # so on.
10
11
12 srcdir=`dirname $0`
13 test -z "$srcdir" && srcdir=.
14
15 PKG_NAME="stepmania"
16
17 AUTOHEADER=autoheader
18 ACLOCAL_OPTIONS=-Iautoconf/m4/
19 AUTOMAKE_OPTIONS=-a
20
21 AUTOCONF=autoconf
22
23 (test -f $srcdir/configure.ac \
24 && test -d $srcdir/src) || {
25 echo -n "**Error**: Directory \"$srcdir\" does not look like the"
26 echo " top-level $PKG_NAME directory"
27
28 exit 1
29 }
30
31 DIE=0
32
33 ($AUTOCONF --version) > /dev/null 2>&1 || {
34 echo
35 echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME."
36 echo "Download the appropriate package for your distribution,"
37 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/autoconf/"
38 DIE=1
39 }
40
41 # Try automake-1.9, 1.8, and 1.7.
42 if automake-1.9 --version > /dev/null 2>&1; then
43 ACLOCAL=aclocal-1.9
44 AUTOMAKE=automake-1.9
45 ACLOCAL_OPTIONS='-I autoconf/m4/'
46 elif automake-1.8 --version > /dev/null 2>&1; then
47 ACLOCAL=aclocal-1.8
48 AUTOMAKE=automake-1.8
49 ACLOCAL_OPTIONS='-I autoconf/m4/'
50 elif automake-1.7 --version > /dev/null 2>&1; then
51 ACLOCAL=aclocal-1.7
52 AUTOMAKE=automake-1.7
53 ACLOCAL_OPTIONS='-I autoconf/m4/'
54 fi
55
56 # If none of those were found, check if "automake" exists, and check the version.
57 if test -z "$AUTOMAKE" && automake --version > /dev/null 2>&1; then
58 version=`automake --version 2>/dev/null|head -1|sed -e 's/.* \([0-9]\+\.[0-9]\+\).*$/\1/'`
59
60 IFS=.
61 set $version
62 if test -z "$version"; then
63 echo "\`automake' appears to be installed, but the version string could not"
64 echo "be parsed. Proceeding anyway ..."
65 elif test $1 -lt 1 -o $2 -lt 7; then
66 echo "\`automake' appears to be installed, but is not recent enough. Automake"
67 echo "1.7 or newer is required."
68 exit 1
69 fi
70 IFS=
71 ACLOCAL=aclocal
72 AUTOMAKE=automake
73 fi
74
75 if test -z "$AUTOMAKE"; then
76 echo
77 echo "**Error**: You must have \`automake' installed to compile $PKG_NAME."
78 DIE=1
79 NO_AUTOMAKE=yes
80 fi
81
82
83 # if no automake, don't bother testing for aclocal
84 test -n "$NO_AUTOMAKE" || ($ACLOCAL --version) < /dev/null > /dev/null 2>&1 || {
85 echo
86 echo "**Error**: Missing \`aclocal'. The version of \`automake'"
87 echo "installed doesn't appear recent enough."
88 DIE=1
89 }
90
91 if test "$DIE" -eq 1; then
92 exit 1
93 fi
94
95 $ACLOCAL $ACLOCAL_OPTIONS
96 $AUTOCONF
97 $AUTOHEADER
98 $AUTOMAKE $AUTOMAKE_OPTIONS