#!/usr/bin/sh
#
#
# (c) Copyright 1994 Hewlett-Packard Co., All Rights Reserved.
#
# @(#) /usr/bin/xpg4/cc: $Revision: 76.3 $
#
# Remove the /usr/xpg4 from path
#
   PATH=$(echo $PATH | /usr/bin/sed 's;/usr/bin/xpg4/*:;;g')
#
#  Determine command typed
#
command=$(basename $0)
#
# Is the command in path?
   cc_compiler=$(whence $command)
#
# Test if a compiler has been found
#
   if [ $cc_compiler"" = "" ]; then

      if [ -f /opt/ansic/bin/$command ]; then
	cc_compiler=/opt/ansic/bin/$command
      elif [ -f /usr/ccs/bin/$command ]; then
	cc_compiler=/usr/ccs/bin/$command
      elif [ -f /usr/bin/$command ]; then
	cc_compiler=/usr/bin/$command
      else
	echo "The '$command' compiler cannot be found"
	exit
      fi
   fi
#
#  A compiler has been found.
#  And now if the UNIX95 flag has been set then 
#  compile and ld with the UNIX95 options otherwise
#  execute a normal compile.
#
   if [ ${UNIX95+"true"}"" = "true" ]; then 
      LDOPTS=" /usr/lib/.unix95/context.o /usr/lib/.unix95/makecontext.o $LDOPTS"
      export LDOPTS
      $cc_compiler -D_XOPEN_UNIX=1 $@
   else
      $cc_compiler $@
   fi
