1#!/bin/sh
2# Run this to generate all the initial makefiles, etc.
3
4srcdir=`dirname $0`
5PKG_NAME="the package."
6
7DIE=0
8NOCONFIGURE=1
9
10(autoconf --version) < /dev/null > /dev/null 2>&1 || {
11  echo
12  echo "**Error**: You must have \`autoconf' installed to."
13  echo "Download the appropriate package for your distribution,"
14  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
15  DIE=1
16}
17
18(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
19  (libtool --version) < /dev/null > /dev/null 2>&1 || {
20    echo
21    echo "**Error**: You must have \`libtool' installed."
22    echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
23    echo "(or a newer version if it is available)"
24    DIE=1
25  }
26}
27
28grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
29  grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
30  (gettext --version) < /dev/null > /dev/null 2>&1 || {
31    echo
32    echo "**Error**: You must have \`gettext' installed."
33    echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
34    echo "(or a newer version if it is available)"
35    DIE=1
36  }
37}
38
39grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && {
40  grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
41  (gettext --version) < /dev/null > /dev/null 2>&1 || {
42    echo
43    echo "**Error**: You must have \`gettext' installed."
44    echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
45    echo "(or a newer version if it is available)"
46    DIE=1
47  }
48}
49
50(automake --version) < /dev/null > /dev/null 2>&1 || {
51  echo
52  echo "**Error**: You must have \`automake' installed."
53  echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
54  echo "(or a newer version if it is available)"
55  DIE=1
56  NO_AUTOMAKE=yes
57}
58
59
60# if no automake, don't bother testing for aclocal
61test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
62  echo
63  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
64  echo "installed doesn't appear recent enough."
65  echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
66  echo "(or a newer version if it is available)"
67  DIE=1
68}
69
70if test "$DIE" -eq 1; then
71  exit 1
72fi
73
74if test -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 -maxdepth 1 -name configure.in -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    macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
94    ( cd $dr
95      aclocalinclude="$ACLOCAL_FLAGS"
96      for k in $macrodirs; do
97  	if test -d $k; then
98          aclocalinclude="$aclocalinclude -I $k"
99  	##else
100	##  echo "**Warning**: No such directory \`$k'.  Ignored."
101        fi
102      done
103      if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
104	if grep "sed.*POTFILES" configure.in >/dev/null; then
105	  : do nothing -- we still have an old unmodified configure.in
106	else
107	  echo "Creating $dr/aclocal.m4 ..."
108	  test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
109	  echo "Running gettextize...  Ignore non-fatal messages."
110	  echo "no" | gettextize --force --copy
111	  echo "Making $dr/aclocal.m4 writable ..."
112	  test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
113        fi
114      fi
115      if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
116	echo "Creating $dr/aclocal.m4 ..."
117	test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
118	echo "Running gettextize...  Ignore non-fatal messages."
119	echo "no" | gettextize --force --copy
120	echo "Making $dr/aclocal.m4 writable ..."
121	test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
122      fi
123      if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
124	echo "Running libtoolize..."
125	libtoolize --force --copy
126      fi
127      echo "Running aclocal $aclocalinclude ..."
128      aclocal $aclocalinclude
129      if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
130	echo "Running autoheader..."
131	autoheader
132      fi
133      echo "Running automake --gnu $am_opt ..."
134      automake --add-missing --gnu $am_opt
135      echo "Running autoconf ..."
136      autoconf
137    )
138  fi
139done
140
141#conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
142
143if test x$NOCONFIGURE = x; then
144  echo Running $srcdir/configure $conf_flags "$@" ...
145  $srcdir/configure $conf_flags "$@" \
146  && echo Now type \`make\' to compile $PKG_NAME
147else
148  echo Skipping configure process.
149fi
150