:
#
#
# gennfgt generates nnfgt.o
# usage: gennfgt
# Looks for the existence of the libraries and builds the table file.
# generates .s file for SunOS 5, AIXRIOS, SVR4_386, NCR 
#           .c file for all others
#

if [ "$ORACLE_TRACE" ]; then
  set -x
fi

if [ -z "$TMPDIR" ] ; 
then
  TMPDIR=/tmp
fi

if [ "x$1" = "x-32" ] ; then
        LIB=lib32
else
        LIB=lib
fi

USAGE="usage: $0"

LIBHOME=$ORACLE_HOME/$LIB
TNSLIB=libntns11.a
NISLIB=libnnis11.a
CDSLIB=libncds11.a
LDAPLIB=libnldap11.a
HOSTLIB=libnhost11.a

NATIVELIBS="NISLIB|CDSLIB|LDAPLIB|TNSLIB|HOSTLIB"
  
# Check the existence of each library
for lib in `echo $NATIVELIBS | sed 's/|/ /g'`
do
	eval libname=$`echo $lib`

	eval NNFGUSE$lib=false
	if [ -f $LIBHOME/$libname ]
	then
           eval NNFGUSE$lib=true
	fi           
done

#
# Now begins the big divide between SunOS 5 and the rest of the world...
#

#
# Now begins the big divide between AIXRIOS and the rest of the world...
#

ALWORD=".llong"

echo '#'
echo '# This File Is GENERATED By gennfgt on AIXRIOS.'
echo '#'
echo ''
echo '	.rename	H.12.NO_SYMBOL{RO},""'
echo ''
echo '	.lglobl	H.12.NO_SYMBOL{RO}      '
echo '	.globl	nnfgtable{RW}'

if [ "$NNFGUSETNSLIB" = "true" ]
then
echo '	.extern nnftboot{DS}'
fi
if [ "$NNFGUSEHOSTLIB" = "true" ]
then
echo '	.extern nnfhboot{DS}'
fi
if [ "$NNFGUSELDAPLIB" = "true" ]
then
echo '	.extern	nnflboot{DS}'
fi
if [ "$NNFGUSECDSLIB" = "true" ]
then
echo '	.extern nnfdboot{DS}'
fi
if [ "$NNFGUSENISLIB" = "true" ]
then
echo '	.extern nnfyboot{DS}'
fi
echo '	.globl	nnfgtent{RO}            '
echo ''
echo ''
count=0
tns_f="false"
host_f="false"
ldap_f="false"
cds_f="false"
nis_f="false"
echo '	.csect  nnfgtable{RW}, 3         '
if [ "$NNFGUSECDSLIB" = "true" ]
then
echo "	$ALWORD	dce1"
echo "	$ALWORD	nnfdboot{DS}"
echo "	$ALWORD	dce2"
echo "	$ALWORD	dce3"
echo "	$ALWORD	cde1"
echo "	$ALWORD	nnfdboot{DS}"
echo "	$ALWORD	cde2"
echo "	$ALWORD	cde3"
count=`expr $count + 2`
cds_f="true"
fi
if [ "$NNFGUSENISLIB" = "true" ]
then
echo "	$ALWORD	n1"
echo "	$ALWORD	nnfyboot{DS}"
echo "	$ALWORD	n2"
echo "	$ALWORD	n3"
count=`expr $count + 1`
nis_f="true"
fi
if [ "$NNFGUSETNSLIB" = "true" ]
then
echo "	$ALWORD	t1"
echo "	$ALWORD	nnftboot{DS}"
echo "	$ALWORD	t2"
echo "	$ALWORD	t3"
count=`expr $count + 1`
tns_f="true"
fi
if [ "$NNFGUSEHOSTLIB" = "true" ]
then
echo "	$ALWORD	h1"
echo "	$ALWORD	nnfhboot{DS}"
echo "	$ALWORD	h2"
echo "	$ALWORD	h3"
count=`expr $count + 1`
echo "	$ALWORD	z1"
echo "	$ALWORD	nnfhboot{DS}"
echo "	$ALWORD	z2"
echo "	$ALWORD	z3"
count=`expr $count + 1`
host_f="true"
fi
if [ "$NNFGUSELDAPLIB" = "true" ]
then
echo "	$ALWORD	l1"
echo "	$ALWORD	nnflboot{DS}"
echo "	$ALWORD	l2"
echo "	$ALWORD	l3"
count=`expr $count + 1`
ldap_f="true"
fi

echo "	$ALWORD	0x00000000"
echo "	$ALWORD	0x00000000"
echo "	$ALWORD	0x00000000"
echo "	$ALWORD	0x00000000"
echo '# End	csect   nnfgtable{RW}'
echo ''
echo '	.csect	nnfgtent{RO}            '
echo "	.long	$count"
echo '# End	csect	nnfgtent{RO}'
echo ''
echo ''
echo '	.csect  H.12.NO_SYMBOL{RO}, 3'

if [ "$cds_f" = "true" ]
then
echo 'dce1:	.string "DCE"'
echo 'dce2:	.string "_nnfdboot"'
echo 'dce3:	.string "nnfd"'
echo 'cde1:	.string "CDS"'
echo 'cde2:	.string "_nnfdboot"'
echo 'cde3:	.string "nnfd"'
fi
if [ "$nis_f" = "true" ]
then
echo 'n1:	.string "NIS"'
echo 'n2:	.string "_nnfyboot"'
echo 'n3:	.string "nnis"'
fi
if [ "$tns_f" = "true" ]
then
echo 't1:	.string "TNSNAMES"'
echo 't2:	.string "_nnftboot"'
echo 't3:	.string "nnft"'
fi
if [ "$host_f" = "true" ]
then
echo 'h1:	.string "HOSTNAME"'
echo 'h2:	.string "_nnfhboot"'
echo 'h3:	.string "nnfh"'
echo 'z1:	.string "EZCONNECT"'
echo 'z2:	.string "_nnfhboot"'
echo 'z3:	.string "nnfh"'
fi
if [ "$ldap_f" = "true" ]
then
echo 'l1:	.string	"LDAP"'
echo 'l2:	.string	"_nnflboot"'
echo 'l3:	.string	"nnfl"'
echo ''
fi
