#!/bin/sh -
#
# @(#)$Id: 6be90061bd4ed71f9cc22b4f06a9ceced2368dc4 $
#
# Create an empty "mkconfig.tmp" file, and run ./mkconfig.
# The user must run this ./configure script manually.
#
# Exit w/ a status of 0 on success.
# Exit w/ a status of 1 on error.
# --
# Jeffrey Allen Neitzel
#

#
# usage: ./configure [-h | osh_binary_name sh6_binary_name]
#
# In the case of `./configure', it defaults to:
#
#        osh_binary_name == etsh
#        sh6_binary_name == tsh
#

trap '' HUP INT QUIT TERM
shell=/bin/sh
tmp=mkconfig.tmp
touch $tmp    || exit 1
. ./config.rc || exit 1

if test \
    X"$0" != X./configure -o \
    \( $# -eq 1 -a X"$1" = X-h \) -o \
    \( $# -eq 2 -a \( X"$1" = X-h -o X"$2" = X-h \) \) -o \
    \( $# -ne 2 -a $# -ne 0 \) ; then
	echo "usage: ./configure [-h | osh_binary_name sh6_binary_name]" >&2
	echo >&2
	echo "In the case of \`./configure', it defaults to:" >&2
	echo >&2
	echo "       osh_binary_name == $osh_binary_name" >&2
	echo "       sh6_binary_name == $sh6_binary_name" >&2
	exit 1
fi

if test $# -eq 2 -a X"$1" != X -a X"$2" != X ; then
	$shell ./mkconfig "$1" "$2" ; status=$?
else
	# Otherwise, default to the names specified in config.rc.
	$shell ./mkconfig "$osh_binary_name" "$sh6_binary_name" ; status=$?
fi

exit $status
