#!/bin/sh

# Run this to generate a new configure script

if [ -s "tables/a2s.h" ]; then
    echo "Good! Tables are generated so we don't need sox."
else
    if [ -z "`which sox 2>/dev/null`" ]; then
	echo "Please install sox to be able to build from CVS version." >&2
	exit 1
    fi
fi

ac="`which autoconf 2>/dev/null`"
[ -z "$ac" ] && ac=/usr/local/bin/autoconf-2.61
if [ ! -x "$ac" ]; then
    echo "Please install Gnu autoconf to build from CVS." >&2
    exit 1
fi
$ac

case "`uname`" in
    FreeBSD)
	CONFIGURE_ARGS=""
	echo "Now running bash ./configure ${CONFIGURE_ARGS} $@"
	. ./configure ${CONFIGURE_ARGS} "$@"
	;;
    *)	# Linux
	CONFIGURE_ARGS="--prefix=/usr"
	CONFIGURE_ARGS+=" --sysconfdir=/etc"
	echo "Now running ./configure ${CONFIGURE_ARGS} $@"
	. ./configure ${CONFIGURE_ARGS} "$@"
	;;
esac
