:	'(c) Copyright	Empress Software Inc.	1983, 2003'

USAGE="*** Usage ***  $0"

if test "$EMPRESSPATH" = "" 
then
	echo "EMPRESSPATH not set"
	exit 1

elif test ! -d $EMPRESSPATH
then
	echo "invalid EMPRESSPATH"
	exit 1
fi

MSTMPFILE=`$EMPRESSPATH/common/sys_bin/tmpdir`/temp$$

. $EMPRESSPATH/config/options

LOCAL=
EMPLIB=lib

while :
do
	case $# in
	  0)	break ;;
	esac

	case $1 in
	 -LOCAL)	LOCAL=-LOCAL
			EMPLIB=src_lib
			;;
	 -xtarget)
			shift
			MS_XTARGET=$1
			;;
	 *)		break ;;
	esac
	shift
done

if test "$MS_XTARGET" != ""
then
	if test ! -f $EMPRESSPATH/config/xcfg/$MS_XTARGET
	then
		echo "\$EMPRESSPATH/config/xcfg/$MS_XTARGET not found"
		exit 1
	fi

	. $EMPRESSPATH/config/xcfg/$MS_XTARGET
	export MS_XTARGET
	TDIR=xtarget/$MS_XTARGET
else
	TDIR=.
fi

case $MSFEATURE_SHLIB in
  "" | "no") 	exit 0 ;;
esac

SHLIB=$EMPRESSPATH/$TDIR/shlib
EMPLIB=$EMPRESSPATH/$TDIR/rdbms/$EMPLIB

test -d $SHLIB || mkdir $SHLIB

cd $SHLIB

case "$MSFEATURE_SHLIB" in
   sgi)	
	cp /usr/lib/so_locations .
	chmod +w so_locations
	;;
   alpha)
	cp /usr/shlib/so_locations .
	chmod +w so_locations
	;;
esac

$EMPRESSPATH/rdbms/conf_bin/mklibsh.ms $LOCAL
$EMPRESSPATH/rdbms/conf_bin/mklibsh.mscfg $LOCAL

# If you need to run empezsql, empin1, then you should not
# check the options. Both of these executables should ALWAYS be 
# available, and they may require that gui shared libraries be built.

case ${MSINST_GUIDEV}${MSINST_GUIRT} in
 yes* | *yes)
	if test "$MSFEATURE_GUI" = "yes" && test -d $EMPRESSPATH/rdbms/gui
	then
		$EMPRESSPATH/rdbms/conf_bin/mklibsh.gui $LOCAL
	fi
	;;
 *)	# no GUI option, but perhaps there is empezsql, empin1 instead.
	if test -f $EMPLIB/empin1.a -o -f $EMPLIB/ezsql.a
	then
		$EMPRESSPATH/rdbms/conf_bin/mklibsh.gui $LOCAL
	fi
	;;
esac

test "$MSFEATURE_MULTI_THREAD" = "yes" && $EMPRESSPATH/rdbms/conf_bin/mklibsh.api_r $LOCAL
