#!/bin/sh
########################################################
#   cc_X11           Hans Groschwitz       16.08.96    #
#                                                      #
#   This workarounds the missing GNU configure.        #
#   See file util/PORTING for hints.                   #
########################################################

uname=`uname`

if [ $uname = Linux ]; then
   cc="gcc -O4"
   opts="-I/usr/include/X11"
   optx=""
elif [ $uname = SunOS ]; then
   cc="gcc -O4"
   opts="-I/usr/include/X11"
   optx=""
elif [ $uname = IRIX ]; then
   cc="gcc -O4"
   opts="-I/usr/include/X11"
#   see /usr/include/time.h and /usr/include/sys/types.h and man nanosleep!
#   Yes, I know, its upgly!!
   optx="-Dusleep(x)={struct{long s,ns;}p;p.s=0;p.ns=((x)*1000);nanosleep(&p,NULL);}"
elif [ $uname = AIX ]; then
   cc="cc -O"
   opts="-I/usr/include/X11"
   optx=""
elif [ $uname = HP-UX ]; then
   cc="gcc -O4"
   opts="-I/usr/include/X11"
   optx="-Dusleep(x)={struct{long s,ns;}p;p.s=0;p.ns=((x)*1000);nanosleep(&p,NULL);}"
else
   echo "$uname is currently unsupported!"
   exit 1
fi

echo "$uname: $cc $opts $optx $*"

## WARNING: Because of the "" in exec:
## If optx is empty, an empty argv[n] is produced, which irritates the ld

if [ -z "$optx" ]; then
   exec $cc $opts $*
fi
exec $cc $opts "$optx" $*

### eof
