1#!/bin/sh
2# Run this to generate all the initial makefiles, etc.
3
4srcdir=`dirname $0`
5test -z "$srcdir" && srcdir=.
6DIE=0
7PKG_NAME="VDK"
8
9(autoconf --version) < /dev/null > /dev/null 2>&1 || {
10  echo
11  echo "**Error**: You must have \`autoconf' installed to compile VDKLIB."
12  echo "Download the appropriate package for your distribution,"
13  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
14  DIE=1
15}
16
17(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
18  (libtool --version) < /dev/null > /dev/null 2>&1 || {
19    echo
20    echo "**Error**: You must have \`libtool' installed to compile VDKLIB."
21    echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2.tar.gz"
22    echo "(or a newer version if it is available)"
23    DIE=1
24  }
25}
26
27(automake --version) < /dev/null > /dev/null 2>&1 || {
28  echo
29  echo "**Error**: You must have \`automake' installed to compile VDKLIB."
30  echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
31  echo "(or a newer version if it is available)"
32  DIE=1
33  NO_AUTOMAKE=yes
34}
35
36
37# if no automake, don't bother testing for aclocal
38test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
39  echo
40  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
41  echo "installed doesn't appear recent enough."
42  echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
43  echo "(or a newer version if it is available)"
44  DIE=1
45}
46
47if test "$DIE" -eq 1; then
48  exit 1
49fi
50
51if test -z "$*"; then
52  echo "**Warning**: I am going to run \`configure' with no arguments."
53  echo "If you wish to pass any to it, please specify them on the"
54  echo \`$0\'" command line."
55  echo
56fi
57
58case $CC in
59xlc )
60  am_opt=--include-deps;;
61esac
62
63for coin in `find $srcdir -name configure.ac -print`
64do
65  dr=`dirname $coin`
66  if test -f $dr/NO-AUTO-GEN; then
67    echo skipping $dr -- flagged as no auto-gen
68  else
69    echo processing $dr
70    macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
71    ( cd $dr
72      aclocalinclude="$ACLOCAL_FLAGS"
73      for k in $macrodirs; do
74  	if test -d $k; then
75          aclocalinclude="$aclocalinclude -I $k"
76  	##else
77	##  echo "**Warning**: No such directory \`$k'.  Ignored."
78        fi
79      done
80      if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
81	echo "Running libtoolize..."
82	libtoolize --force --copy
83      fi
84      echo "Running aclocal $aclocalinclude ..."
85      aclocal $aclocalinclude
86      if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then
87	echo "Running autoheader..."
88	autoheader
89      fi
90      echo "Running automake --gnu $am_opt ..."
91      automake --add-missing --gnu $am_opt
92      echo "Running autoconf ..."
93      autoconf
94    )
95  fi
96done
97
98conf_flags="--enable-maintainer-mode --enable-compile-warnings"
99
100if test x$NOCONFIGURE = x; then
101  echo Running $srcdir/configure $conf_flags "$@" ...
102  $srcdir/configure $conf_flags "$@" \
103  && echo Now type \`make\' to compile $PKG_NAME
104else
105  echo Skipping configure process.
106fi
107