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
9(test -f $srcdir/configure.ac) || {
10    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
11    echo " top-level package directory"
12    exit 1
13}
14
15(autoconf --version) < /dev/null > /dev/null 2>&1 || {
16  echo
17  echo "**Error**: You must have \`autoconf' installed."
18  echo "Download the appropriate package for your distribution,"
19  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
20  DIE=1
21}
22
23(grep "^IT_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && {
24  (intltoolize --version) < /dev/null > /dev/null 2>&1 || {
25    echo
26    echo "**Error**: You must have \`intltool' installed."
27    echo "You can get it from:"
28    echo "  ftp://ftp.gnome.org/pub/GNOME/stable/sources/intltool/"
29    DIE=1
30  }
31}
32
33(grep "^LT_INIT" $srcdir/configure.ac >/dev/null) && {
34  (libtoolize --version) < /dev/null > /dev/null 2>&1 || {
35    echo
36    echo "**Error**: You must have \`libtool' installed."
37    echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
38    DIE=1
39  }
40}
41
42grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
43  grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
44  (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
45    echo
46    echo "**Error**: You must have \`glib' installed."
47    echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
48    DIE=1
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
74if test x$NOCONFIGURE = x -a -z "$*"; then
75  echo "**Warning**: I am going to run \`configure' with no arguments."
76  echo "If you wish to pass any to it, please specify them on the"
77  echo \`$0\'" command line."
78  echo
79fi
80
81case $CC in
82xlc )
83  am_opt=--include-deps;;
84esac
85
86for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.ac -print`
87do
88  dr=`dirname $coin`
89  if test -f $dr/NO-AUTO-GEN; then
90    echo skipping $dr -- flagged as no auto-gen
91  else
92    echo processing $dr
93    ( cd $dr
94
95      aclocalinclude="$ACLOCAL_FLAGS"
96
97      if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then
98	echo "Creating $dr/aclocal.m4 ..."
99	test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
100	echo "Running glib-gettextize...  Ignore non-fatal messages."
101	echo "no" | glib-gettextize --force --copy
102	echo "Making $dr/aclocal.m4 writable ..."
103	test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
104      fi
105      if grep "^IT_PROG_INTLTOOL" configure.ac >/dev/null; then
106        echo "Running intltoolize..."
107	intltoolize --copy --force --automake
108      fi
109      if grep "^LT_INIT" configure.ac >/dev/null; then
110	if test -z "$NO_LIBTOOLIZE" ; then
111	  echo "Running libtoolize..."
112	  libtoolize --force --copy
113	fi
114      fi
115      echo "Running aclocal $aclocalinclude ..."
116      aclocal $aclocalinclude
117      if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
118	echo "Running autoheader..."
119	autoheader
120      fi
121      echo "Running automake --gnu $am_opt ..."
122      automake --add-missing --gnu $am_opt
123      echo "Running autoconf ..."
124      autoconf
125    )
126  fi
127done
128
129conf_flags="--enable-maintainer-mode"
130
131if test x$NOCONFIGURE = x; then
132  echo Running $srcdir/configure $conf_flags "$@" ...
133  $srcdir/configure $conf_flags "$@" \
134  && echo Now type \`make\' to compile. || exit 1
135else
136  echo Skipping configure process.
137fi
138