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