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