#!/bin/sh

#---------------------------------------------------
#  This stuff introduced by SDB to enable --prefix
#  at configure time

# echo Input flag = $1
if test "x$1" != "x"; then
    # echo Found input parameter -- $1
    #  Now see if the parameter is --prefix=
    if test "x${1#--prefix=}" != "x$1"; then
	# echo "Found --prefix in input args.  Setting prefix directory."
	prefix=${1#--prefix=}
    else
	# echo "Found unrecognized parameter in input args."
	#  Just use the default prefix dir.
	prefix=/usr/local
    fi

else
    # echo "No input parameter found."
    #  Just use the default prefix dir
    prefix=/usr/local
fi

args="--prefix=$prefix"

echo "Configuring gnucap using $args"
#---------------------------------------------------
echo include
(cd include; ./configure $args)
echo lib
(cd lib; ./configure $args)
echo modelgen
(cd modelgen; ./configure $args)
echo main
(cd main; ./configure $args)
echo apps
(cd apps; ./configure $args)
echo done
exit 0
