#!/bin/sh
#
# This script calls the appropriate C compiler, with whatever flags are needed.

args="`buildarg docc-extra`"

for i in $* 
do
case "$i" in
	-motif-ld) args="$args `buildarg docc-motif-ld`" ;;
	-motif-cc) args="$args `buildarg docc-motif-cc`" ;;
	-src) 	   args="$args `buildarg docc-src`" ;;
	*) 	   args="$args $i" ;;
esac
done

case "$MACHINE" in
rt)	     krcc cc -a -DYYMAXDEPTH=500 -Nn5000 -Nd5000 -Np6000 -Nt5000 $args -lm ;;
rsgcc*)	     gcc -Wall -Wno-format $args ;;
rsxlc)	     xlc $args ;;
rs4*)	     cc -D_POSIX_SOURCE $args ;;
rs*)	     xlc  -D_POSIX_SOURCE $args ;;
sun4os4c*)    krcc -va __builtin_va_alist cc -fsingle $args ;;
sun4os4g*)    gcc $args ;;
sun4uos56c)  cc -D__USE_CC $args ;;
sun4os55c*)   cc -D__USE_CC $args ;;
sun4os55g64)  gcc -m64 -Wall $args ;;
sun4os55g*)   gcc -Wall $args ;;
sun4os57c*)   cc -D__USE_CC $args ;;
sun4os57g*)   gcc -Wall $args ;;
linux*)      gcc -Wall -pipe $args ;;
win32cygwin) cc -Wall -pipe $args ;;
win32gcc)    cc -mno-cygwin -Wall -pipe $args ;;
irixgcc*)    gcc -Wall -Wno-format $args ;; 
irixmips3*)  cc -n32 -mips3 -woff all -OPT:IEEE_arithmetic=1 -OPT:IEEE_comparisons=ON -OPT:Olimit=0 "-Wl,-woff 84" $args;;
irixmips4*)  cc -64  -mips4 -woff all -OPT:IEEE_arithmetic=1 -OPT:IEEE_comparisons=ON -OPT:Olimit=0 "-Wl,-woff 84" $args;;
irixmips1*)  cc -mips1 $args;;
hpuxgcc*)    gcc -Wall -Wno-format $args ;;
hpux*)	     cc -Wl,+vnocompatwarnings -D_HPUX_SOURCE -Ae -z +Onolimit $args ;;
axposf1v4*)  cc -w0 -assume noaligned_objects -std1 -Olimit 1200 -ieee -ieee_with_inexact -fprm d $args ;;
axposf1*)    cc -std -Olimit 1200 -ieee_with_no_inexact $args ;;
*)	echo "no machine given, using cc."; cc $args ;;
esac
