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
23gtkdocize || exit 1
24
25(autoconf --version) < /dev/null > /dev/null 2>&1 || {
26  echo
27  echo "**Error**: You must have \`autoconf' installed."
28  echo "Download the appropriate package for your distribution,"
29  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
30  DIE=1
31}
32
33(grep "^AC_PROG_INTLTOOL" $srcdir/configure.in >/dev/null) && {
34  (intltoolize --version) < /dev/null > /dev/null 2>&1 || {
35    echo
36    echo "**Error**: You must have \`intltool' installed."
37    echo "You can get it from:"
38    echo "  ftp://ftp.gnome.org/pub/GNOME/"
39    DIE=1
40  }
41}
42
43(grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.in >/dev/null) && {
44  (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || {
45    echo
46    echo "**Error**: You must have \`xml-i18n-toolize' installed."
47    echo "You can get it from:"
48    echo "  ftp://ftp.gnome.org/pub/GNOME/"
49    DIE=1
50  }
51}
52
53(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
54  (libtool --version) < /dev/null > /dev/null 2>&1 || {
55    echo
56    echo "**Error**: You must have \`libtool' installed."
57    echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
58    DIE=1
59  }
60}
61
62(grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.in >/dev/null) && {
63  (grep "sed.*POTFILES" $srcdir/configure.in) > /dev/null || \
64  (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || {
65    echo
66    echo "**Error**: You must have \`glib' installed."
67    echo "You can get it from: ftp://ftp.gtk.org/pub/gtk"
68    DIE=1
69  }
70}
71
72(automake --version) < /dev/null > /dev/null 2>&1 || {
73  echo
74  echo "**Error**: You must have \`automake' installed."
75  echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/"
76  DIE=1
77  NO_AUTOMAKE=yes
78}
79
80
81# if no automake, don't bother testing for aclocal
82test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
83  echo
84  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
85  echo "installed doesn't appear recent enough."
86  echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/"
87  DIE=1
88}
89
90if test "$DIE" -eq 1; then
91  exit 1
92fi
93
94if test -z "$*"; then
95  echo "**Warning**: I am going to run \`configure' with no arguments."
96  echo "If you wish to pass any to it, please specify them on the"
97  echo \`$0\'" command line."
98  echo
99fi
100
101case $CC in
102xlc )
103  am_opt=--include-deps;;
104esac
105
106for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.in -print`
107do
108  dr=`dirname $coin`
109  if test -f $dr/NO-AUTO-GEN; then
110    echo skipping $dr -- flagged as no auto-gen
111  else
112    echo processing $dr
113    ( cd $dr
114
115      aclocalinclude="$ACLOCAL_FLAGS"
116
117      if grep "^AM_GLIB_GNU_GETTEXT" configure.in >/dev/null; then
118	echo "Creating $dr/aclocal.m4 ..."
119	test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
120	echo "Running glib-gettextize...  Ignore non-fatal messages."
121	echo "no" | glib-gettextize --force --copy
122	echo "Making $dr/aclocal.m4 writable ..."
123	test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
124      fi
125      if grep "^AC_PROG_INTLTOOL" configure.in >/dev/null; then
126        echo "Running intltoolize..."
127	intltoolize --copy --force --automake
128      fi
129      if grep "^AM_PROG_XML_I18N_TOOLS" configure.in >/dev/null; then
130        echo "Running xml-i18n-toolize..."
131	xml-i18n-toolize --copy --force --automake
132      fi
133      if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
134	if test -z "$NO_LIBTOOLIZE" ; then
135	  echo "Running libtoolize..."
136	  libtoolize --force --copy
137	fi
138      fi
139      echo "Running aclocal $aclocalinclude ..."
140      aclocal $aclocalinclude
141      if grep "^A[CM]_CONFIG_HEADER" configure.in >/dev/null; then
142	echo "Running autoheader..."
143	autoheader
144      fi
145      echo "Running automake --gnu $am_opt ..."
146      automake --add-missing --gnu $am_opt
147      echo "Running autoconf ..."
148      autoconf
149    )
150  fi
151done
152
153conf_flags="--enable-maintainer-mode"
154
155if test x$NOCONFIGURE = x; then
156  echo Running $srcdir/configure $conf_flags "$@" ...
157  $srcdir/configure $conf_flags "$@" \
158  && echo Now type \`make\' to compile. || exit 1
159else
160  echo Skipping configure process.
161fi
162