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