#!/bin/bash

# directories needing configure files
DIRS=". wcs filter fitsy util"

# is autoconf installed?
hash autoconf 1>/dev/null 2>&1
if [ $? = 0 ]; then
  echo "autoconf installed ... generating configure files ..."
  HAS_AUTOCONF=true
else
  echo "autoconf not installed ... copying failsafe configure files ..."
  HAS_AUTOCONF=false
fi

# recreate configure files
for d in $DIRS; do
    if [ x${HAS_AUTOCONF} = xtrue ]; then
      (cd $d && autoconf)
    else
      (cd $d && cp -p configure-failsafe configure)
    fi
done
