1#!/bin/sh
2# Run this to generate all the initial makefiles, etc.
3
4srcdir=`pwd`
5
6DIE=0
7
8(autoconf --version) < /dev/null > /dev/null 2>&1 || {
9  echo
10  echo "**Error**: You must have \`autoconf' installed to compile."
11  echo "Download the appropriate package for your distribution,"
12  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
13  DIE=1
14}
15
16(automake --version) < /dev/null > /dev/null 2>&1 || {
17  echo
18  echo "**Error**: You must have \`automake' installed to compile."
19  echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
20  echo "(or a newer version if it is available)"
21  DIE=1
22  NO_AUTOMAKE=yes
23}
24
25
26# if no automake, don't bother testing for aclocal
27test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
28  echo
29  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
30  echo "installed doesn't appear recent enough."
31  echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
32  echo "(or a newer version if it is available)"
33  DIE=1
34}
35
36if test "$DIE" -eq 1; then
37  exit 1
38fi
39
40if test -z "$*"; then
41  echo "**Warning**: I am going to run \`configure' with no arguments."
42  echo "If you wish to pass any to it, please specify them on the"
43  echo \`$0\'" command line."
44  echo
45fi
46
47case $CC in
48xlc )
49  am_opt=--include-deps;;
50esac
51
52for coin in `find $srcdir -name configure.in -print`
53do
54  dr=`dirname $coin`
55  if test -f $dr/NO-AUTO-GEN; then
56    echo skipping $dr -- flagged as no auto-gen
57  else
58    echo processing $dr
59    macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
60    ( cd $dr
61      aclocalinclude="$ACLOCAL_FLAGS"
62      for k in $macrodirs; do
63  	if test -d $k; then
64          aclocalinclude="$aclocalinclude -I $k"
65  	##else
66	##  echo "**Warning**: No such directory \`$k'.  Ignored."
67        fi
68      done
69      if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
70	if grep "sed.*POTFILES" configure.in >/dev/null; then
71	  : do nothing -- we still have an old unmodified configure.in
72	else
73	  echo "Creating $dr/aclocal.m4 ..."
74	  test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
75	  echo "Running gettextize...  Ignore non-fatal messages."
76	  echo "no" | gettextize --force --copy
77	  echo "Making $dr/aclocal.m4 writable ..."
78	  test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
79        fi
80      fi
81      if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
82	echo "Running libtoolize..."
83	libtoolize --force --copy
84      fi
85      echo "Running aclocal $aclocalinclude ..."
86      aclocal $aclocalinclude
87      if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
88	echo "Running autoheader..."
89	autoheader
90      fi
91      echo "Running automake --gnu $am_opt ..."
92      automake --add-missing --gnu $am_opt
93      echo "Running autoconf ..."
94      autoconf
95    )
96  fi
97done
98
99conf_flags="--enable-maintainer-mode --enable-compile-warnings --enable-debug --enable-memwatch" #--enable-iso-c
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 $PKG_NAME
105else
106  echo Skipping configure process.
107fi
108