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
9if [ -n "$GNOME2_DIR" ]; then
10	ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS"
11	LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH"
12	PATH="$GNOME2_DIR/bin:$PATH"
13	export PATH
14	export LD_LIBRARY_PATH
15fi
16
17(test -f $srcdir/configure.in) || {
18    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
19    echo " top-level package directory"
20    exit 1
21}
22
23(autoconf --version) < /dev/null > /dev/null 2>&1 || {
24  echo
25  echo "**Error**: You must have \`autoconf' installed."
26  echo "Download the appropriate package for your distribution,"
27  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
28  DIE=1
29}
30
31(grep "^AC_PROG_INTLTOOL" $srcdir/configure.in >/dev/null) && {
32  (intltoolize --version) < /dev/null > /dev/null 2>&1 || {
33    echo
34    echo "**Error**: You must have \`intltool' installed."
35    echo "You can get it from:"
36    echo "  ftp://ftp.gnome.org/pub/GNOME/stable/sources/intltool/"
37    DIE=1
38  }
39}
40
41(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
42  (libtool --version) < /dev/null > /dev/null 2>&1 || {
43    echo
44    echo "**Error**: You must have \`libtool' installed."
45    echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
46    DIE=1
47  }
48}
49
50grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
51  grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
52  (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
53    echo
54    echo "**Error**: You must have \`glib' installed."
55    echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
56    DIE=1
57  }
58}
59
60(automake --version) < /dev/null > /dev/null 2>&1 || {
61  echo
62  echo "**Error**: You must have \`automake' installed."
63  echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
64  DIE=1
65  NO_AUTOMAKE=yes
66}
67
68
69# if no automake, don't bother testing for aclocal
70test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
71  echo
72  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
73  echo "installed doesn't appear recent enough."
74  echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
75  DIE=1
76}
77
78if test "$DIE" -eq 1; then
79  exit 1
80fi
81
82if test -z "$*"; then
83  echo "**Warning**: I am going to run \`configure' with no arguments."
84  echo "If you wish to pass any to it, please specify them on the"
85  echo \`$0\'" command line."
86  echo
87fi
88
89case $CC in
90xlc )
91  am_opt=--include-deps;;
92esac
93
94for coin in `find $srcdir -name configure.in -print`
95do
96  dr=`dirname $coin`
97  if test -f $dr/NO-AUTO-GEN; then
98    echo skipping $dr -- flagged as no auto-gen
99  else
100    echo processing $dr
101    ( cd $dr
102
103      aclocalinclude="$ACLOCAL_FLAGS"
104
105      if grep "^AM_GLIB_GNU_GETTEXT" configure.in >/dev/null; then
106	echo "Creating $dr/aclocal.m4 ..."
107	test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
108	echo "Running glib-gettextize...  Ignore non-fatal messages."
109	echo "no" | glib-gettextize --force --copy
110	echo "Making $dr/aclocal.m4 writable ..."
111	test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
112      fi
113      if grep "^AC_PROG_INTLTOOL" configure.in >/dev/null; then
114        echo "Running intltoolize..."
115	intltoolize --copy --force --automake
116      fi
117      if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
118	if test -z "$NO_LIBTOOLIZE" ; then
119	  echo "Running libtoolize..."
120	  libtoolize --force --copy
121	fi
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
135done
136
137conf_flags="--enable-maintainer-mode"
138
139if test x$NOCONFIGURE = x; then
140  echo Running $srcdir/configure $conf_flags "$@" ...
141  $srcdir/configure $conf_flags "$@" \
142  && echo Now type \`make\' to compile. || exit 1
143else
144  echo Skipping configure process.
145fi
146