2 if [ ! -f netinet/done ] ; then
3 echo "Do NOT run this script directly, do 'make solaris'!"
8 rev=`uname -r | sed -e 's/^\([^\.]*\)\..*/\1/'`
9 if [ -d /usr/ccs/bin ] ; then
10 PATH=/usr/ccs/bin:${PATH}
16 if echo '' | $1 -E - >/dev/null 2>&1 ; then
23 if [ -f /usr/include/sys/neti.h ] ; then
27 if [ $rev = 5 ] ; then
28 if [ ! -f /usr/include/sys/neti.h -a ! -d ../pfil ] ; then
30 pfil directory in .. missing, please download pfil package and extract that
31 into the parent directory.
33 See INSTALL.Sol2 for more instructions.
38 # /usr/ucb/cc will not work
40 PATH=`echo $PATH | sed -e s:/usr/ucb::g -e s/::/:/g`
44 cpudir=${cpu}-`uname -r`
45 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
46 if [ ! -d SunOS5/${cpudir} -a ! -h SunOS5/${cpudir} ] ; then
47 mkdir -p SunOS5/${cpudir}
49 /bin/rm -f SunOS5/${cpudir}/Makefile
50 /bin/rm -f SunOS5/${cpudir}/Makefile.ipsend
51 ln -s `pwd`/SunOS5/Makefile SunOS5/${cpudir}/Makefile
52 ln -s `pwd`/SunOS5/Makefile.ipsend SunOS5/${cpudir}/Makefile.ipsend
55 # Default C compiler is "cc", override on make commandline
57 if [ "x$CC" = "x" ] ; then
59 if [ $? -ne 0 ] ; then
61 if [ $? -ne 0 ] ; then
62 echo 'No working compiler found'
68 if [ $? -ne 0 ] ; then
71 echo 'No working compiler found'
76 if [ $? -ne 0 ] ; then
77 echo 'No working compiler found'
84 v=`echo '__GNUC__' 2>&1 | ${CC} -E - 2>&1 | sed -ne '/^[0-9]* *$/p'`
85 if [ x$v != x ] ; then
93 XARCH64_sparc="-m64 -mcmodel=medlow"
94 XARCH64_i386="-m64 -mcmodel=kernel -mno-red-zone -ffreestanding"
97 XARCH32_i386="-Xa -xildoff"
98 XARCH32_sparc="-Xa -xildoff -xarch=v8 -xmemalign=8s"
99 if [ `cc -xarch=amd64 -xarch=v9 2>&1 | grep -c deprec` -eq 1 ] ; then
100 XARCH64_sparc="-Xa -xildoff -m64 -xmemalign=8s"
101 XARCH64_i386="$XARCH32 -m64"
103 XARCH64_sparc="-Xa -xildoff -xarch=v9 -xchip=ultra -xmemalign=8s -xcode=abs32"
104 XARCH64_i386="$XARCH32 -xarch=amd64 -xcode=abs32"
108 XARCH32="`eval echo '$XARCH32_'$cpu`"
109 XARCH64="`eval echo '$XARCH64_'$cpu`"
119 OBJ32=`eval echo '$OBJ32_'$cpu`
120 OBJ64=`eval echo '$OBJ64_'$cpu`
122 ARCHINC64_sparc="-I/usr/include/v9"
124 ARCHINC64="`eval echo '$ARCHINC_'$cpu`"
126 if [ $solrev -ge 10 ] && /bin/optisa sparcv8plus amd64 > /dev/null
130 elif [ $solrev -ge 7 ] && /bin/optisa sparcv8plus > /dev/null
132 # We run Solaris 7+ on 64 bit capable hardware.
141 echo Testing compiler $CC for 64 bit object file generation.
143 trap 'rm -f $t 32.out 64.out; exit 1' 0 1 2 3 15
148 printf("%ld\n", (long) sizeof(long));
153 # Is it perhaps a 64 bit only compiler?
154 if $CC $XARCH32 $t -o 32.out >/dev/null 2>&1 &&
157 echo $CC $XARCH32 cannot create 32 bit executables. 1>&2
160 if $CC $XARCH64 $t -o 64.out >/dev/null 2>&1 &&
161 { out64=`./64.out 2>/dev/null` ;
162 [ "$out64" = 8 -o "`isainfo -b`" = 32 -a "$out64" = "" ]
165 echo "found 32/64 bit compiler" 1>&2
170 rm -f $t 32.out 64.out
174 # If we're running 64 bit, we *must* build 64 bit.
175 if ([ "`isainfo -b`" = 64 ]) 2>/dev/null ; then
176 if $CC64 ; then :; else
177 echo "No 64 bit capable compiler was found" 1>&2
181 elif $BUILDBOTH && $CC64
189 cpudir=${cpu}-`uname -r`
192 # Default $MAKE to make
195 if [ $cpu = i386 -a $solrev -lt 10 ] ; then
196 if [ -n "$BPFILTER" ] ; then
197 BPF="BPFILTER=./$BPFILTER"
199 $MAKE $MAKEFLAGS ${1+"$@"} sunos5 SOLARIS2="-DSOLARIS2=$solrev" CPU= CPUDIR=${cpudir} CC="$CC $XARCH32" XARCH="$XARCH32" ARCHINC="$ARCHINC32" BITS=32 OBJ=. $BPF
202 if [ x$solrev = x ] ; then
203 make ${1+"$@"} sunos$rev "TOP=.." "ARCH=`uname -m`"
208 echo build $b bit binaries.
209 for v in OBJ ARCHINC XARCH
213 eval B=\"\$OBJ${b}_`uname -p`\"
214 if [ -n "$BPFILTER" ] ; then
215 BPF="BPFILTER=$OBJ/$BPFILTER"
217 $MAKE $MAKEFLAGS ${1+"$@"} sunos$rev SOLARIS2="-DSOLARIS2=$solrev" CPU= CPUDIR=${cpudir} CC="$CC $XARCH" XARCH="$XARCH" INSTANCE="$INST" ARCHINC="$ARCHINC" BITS=$b OBJ=$B $BPF || exit $?