1#!/bin/sh
2# Run this to generate all the initial makefiles, etc.
3
4srcdir=`dirname $0`
5test -z "$srcdir" && srcdir=.
6
7DIE=0
8
9if 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
16fi
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
25if ! [ -d config ]; then mkdir -v config; fi
26if ! [ -d m4     ]; then mkdir -v m4;     fi
27
28if ! autoreconf --version </dev/null >/dev/null 2>&1
29then
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
62test -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
70if test "$DIE" -eq 1; then
71  exit 1
72fi
73
74case $CC in
75xlc )
76  am_opt=--include-deps;;
77esac
78
79echo "Running aclocal $aclocalinclude ..."
80aclocal $ACLOCAL_FLAGS || exit 1
81echo "Running $LIBTOOLIZE ..."
82$LIBTOOLIZE || exit 1
83echo "Running automake --gnu $am_opt ..."
84automake --add-missing --gnu $am_opt || exit 1
85echo "Running autoconf ..."
86autoconf || exit 1
87
88else # autoreconf instead
89
90    echo "Running autoreconf --verbose --install ..."
91    autoreconf --verbose --install || exit 1
92
93fi
94
95if ( echo "$@" | grep -q -e "--no-configure" ); then
96  NOCONFIGURE=1
97fi
98
99conf_flags="--enable-maintainer-mode --enable-debug --disable-silent-rules"
100
101if 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
105else
106  echo Skipping configure process.
107fi
108