More detailed error message.
[rtaudio-cdist.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 srcdir=`dirname $0`
5 test -z "$srcdir" && srcdir=.
6
7 DIE=0
8
9 if test -z "$*"; then
10   echo "**Warning**: I am going to run \`configure' with arguments for"
11   echo "developer/maintainer mode.  If you wish to pass extra arguments,"
12   echo "(such as --prefix), please specify them on the \`$0'"
13   echo "command line."
14   echo "If you wish to run configure yourself, please specify --no-configure."
15   echo
16 fi
17
18 (test -f $srcdir/configure.ac) || {
19     echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
20     echo " top-level package directory"
21     exit 1
22 }
23
24 # Make some directories required by automake, if they don't exist
25 if ! [ -d config ]; then mkdir -v config; fi
26 if ! [ -d m4     ]; then mkdir -v m4;     fi
27
28 if ! autoreconf --version </dev/null >/dev/null 2>&1
29 then
30
31 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
32   echo
33   echo "**Error**: You must have \`autoconf' installed."
34   echo "Download the appropriate package for your distribution,"
35   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
36   DIE=1
37 }
38
39 (grep "^LT_INIT" $srcdir/configure.ac >/dev/null) && {
40   (libtoolize --version) < /dev/null > /dev/null 2>&1 \
41           && LIBTOOLIZE=libtoolize || {
42         (glibtoolize --version) < /dev/null > /dev/null 2>&1 \
43                 && LIBTOOLIZE=glibtoolize || {
44       echo
45       echo "**Error**: You must have \`libtool' installed."
46       echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
47       DIE=1
48     }
49   }
50 }
51
52 (automake --version) < /dev/null > /dev/null 2>&1 || {
53   echo
54   echo "**Error**: You must have \`automake' installed."
55   echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
56   DIE=1
57   NO_AUTOMAKE=yes
58 }
59
60
61 # if no automake, don't bother testing for aclocal
62 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
63   echo
64   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
65   echo "installed doesn't appear recent enough."
66   echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
67   DIE=1
68 }
69
70 if test "$DIE" -eq 1; then
71   exit 1
72 fi
73
74 case $CC in
75 xlc )
76   am_opt=--include-deps;;
77 esac
78
79 echo "Running aclocal $aclocalinclude ..."
80 aclocal $ACLOCAL_FLAGS || exit 1
81 echo "Running $LIBTOOLIZE ..."
82 $LIBTOOLIZE || exit 1
83 echo "Running automake --gnu $am_opt ..."
84 automake --add-missing --gnu $am_opt || exit 1
85 echo "Running autoconf ..."
86 autoconf || exit 1
87
88 else # autoreconf instead
89
90     echo "Running autoreconf --verbose --install ..."
91     autoreconf --verbose --install || exit 1
92
93 fi
94
95 if ( echo "$@" | grep -q -e "--no-configure" ); then
96   NOCONFIGURE=1
97 fi
98
99 conf_flags="--enable-maintainer-mode --enable-debug --disable-silent-rules"
100
101 if test x$NOCONFIGURE = x; then
102   echo Running $srcdir/configure $conf_flags "$@" ...
103   $srcdir/configure $conf_flags "$@" \
104   && echo Now type \`make\' to compile. || exit 1
105 else
106   echo Skipping configure process.
107 fi