Which *nix ? BSD : System V
Arnold Robbins
arnold at gatech.UUCP
Tue Feb 19 08:06:24 AEST 1985
...!rtech!daveb suggests checking for BSD or System V by including
<fcntl.h> and then seeing if FNDELAY is or isn't defined. This probably
works just fine. I posted a more elaborate solution a couple months
back to net.sources, and will duplicate here (it's short).
Its main advantage is that it differentiates between 4.1, 4.2, and System V
(we have all three around here...)
It is used by saying
CFLAGS=-O `where`
in a makefile
------
#! /bin/sh
# where --- shell file to determine what kind of environment we are in
if test -r /bin/universe # on a pyramid
then
OPATH=$PATH
PATH=/bin
case `universe` in # universe is dumb, looking only at argv[0]
att) echo "-DUSG -UBSD -UBSD4_2"
;;
ucb) echo "-UUSG -DBSD -DBSD4_2"
;;
*) echo unknown operating system! 1>&2
echo "-UUSG -UBSD -UBSD4_2" # undefine them all
;;
esac
PATH=$OPATH
else # on something that is not a pyrmaid
if grep SIGTSTP /usr/include/signal.h > /dev/null
then # berkeley unix
if test -r /usr/include/whoami.h # 4.1
then
echo "-UUSG -DBSD -UBSD4_2"
else # 4.2
echo "-UUSG -DBSD -DBSD4_2"
fi
else # ATT unix
echo "-DUSG -UBSD -UBSD4_2"
fi
fi
--
Arnold Robbins
CSNET: arnold at gatech ARPA: arnold%gatech.csnet at csnet-relay.arpa
UUCP: { akgua, allegra, hplabs, ihnp4, seismo, ut-sally }!gatech!arnold
Help advance the state of Computer Science: Nuke a PR1ME today!
More information about the Comp.unix.wizards
mailing list