#!/bin/sh

# Bootstrap script

need_to_make_depend=no


find . -type d -print|egrep -v '/(CVS)|(RCS)$'| while read dir; do
  if [ -f $dir/acconfig.h -a $dir/configure.in ]; then
    echo "Running autoheader in $dir"
    ( cd $dir ; autoheader && echo foo >stamp-h.in )
  fi

  if [ -f $dir/configure.in ]; then
    if grep AC_INIT $dir/configure.in >/dev/null; then
      echo "Running autoconf in $dir"
      ( cd $dir ; autoconf )
    else
      echo "$dir seems to use Cygnus-configure."
    fi
  fi

  if [ -f $dir/Makefile.in -a ! -f $dir/dependencies ] && egrep @dependencies@ $dir/Makefile.in >/dev/null; then
    touch $dir/dependencies
    need_to_make_depend=yes
  fi
done

if test "x$need_to_make_depend" = "xyes" ; then
  echo You need to run \"make depend\" after \"configure\", and then \"configure\" again.
fi

exit 0
