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