1: next.i386 cc wrapper for unix message and exit code semantics : 1995-05-09 :
2
3HOSTTYPE=next.i386
4
5case " $* " in
6*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
7esac
8
9# 1995-05-09	-lposix termios.o waitpid.o setpgid.o *do* work
10# 1994-11-04	-posix has old redirection hole bug
11#		-D_POSIX_SOURCE requires <sys/dirent.h> manual fixes
12#		libexpr/exeval.c bombs -O, no -O ok
13
14command=cc
15cc="/bin/cc -D_POSIX_SOURCE"
16nooptimize="exeval"
17
18# first check $INSTALLROOT/botch
19
20case $INSTALLROOT in
21"")	echo "$command: INSTALLROOT: must be defined and exported" >&2; exit 1 ;;
22esac
23if	test ! -d $INSTALLROOT/botch -a -dryrun != "$1"
24then	if	mkdir $INSTALLROOT/botch
25	then	: ok to initialize
26	else	echo "$command: $INSTALLROOT/botch must be initialized by the owner of $INSTALLROOT" 2>&1
27		exit 1
28	fi
29	(
30		cd $INSTALLROOT/botch
31		dir=.
32		for i in lib . include sys
33		do	case $i in
34			.)	dir=.
35				;;
36			*)	case $i in
37				/*)	dir=$i ;;
38				*)	dir=$dir/$i ;;
39				esac
40				test -d $dir || mkdir $dir
41				;;
42			esac
43		done
44		if	test ! -f include/sys/dirent.h
45		then	echo "#include <dirent.h>" > tmp.c
46			header=`$cc -E tmp.c | sed -e '/^#[ 	]*1[ 	].*\/sys\/dirent\.h"/!d' -e 's/.*"\(.*\)".*/\1/'`
47			sed -e 's/[ 	]off_t[ 	][ 	]*d_off[ 	]*;//' $header > include/sys/dirent.h
48		fi
49		if	test ! -f lib/libbotch.a
50		then	lipo /usr/lib/libposix.a -thin i386 -output tmp.a
51			ar x tmp.a termios.o waitpid.o setpgid.o
52			ar cr lib/libbotch.a *.o
53			ranlib lib/libbotch.a
54		fi
55		rm -f *.[aco]
56	)
57fi
58
59# now slip in our args
60
61case $nooptimize in
62"")	nooptimize=.
63	;;
64*)	optimize=
65	for arg in $nooptimize
66	do	case $optimize in
67		?*)	optimize="$optimize|" ;;
68		esac
69		optimize="$optimize$arg.[ci]|*/$arg.[ci]"
70	done
71	nooptimize=$optimize
72	;;
73esac
74set . "$@" .
75noexec=
76library=
77local=
78optimize=
79verbose=
80while	:
81do	shift
82	arg=$1
83	shift
84	case $arg in
85	.)	break
86		;;
87	-[cES])	library=1
88		;;
89	-O)	optimize=1
90		;;
91	-v)	verbose=1
92		;;
93	-dryrun)noexec=1
94		verbose=1
95		;;
96	-I-)	case $local in
97		"")	local=1
98			set . "$@" -I$INSTALLROOT/botch/include -I- -I$INSTALLROOT/botch/include
99			;;
100		*)	set . "$@" -I- -I$INSTALLROOT/botch/include
101			;;
102		esac
103		continue
104		;;
105	-I*|*.[cChHiI]|*.[cChHiI][pPxX][pPxX])
106		case $optimize in
107		1)	eval	"
108				case \$arg in
109				$nooptimize)
110					optimize=0
111					;;
112				esac
113			"
114			;;
115		esac
116		case $local in
117		"")	local=1
118			set . "$@" -I$INSTALLROOT/botch/include "$arg"
119			continue
120			;;
121		esac
122		;;
123	-last|*/libast.a)
124		case $library in
125		"")	library=1
126			set . "$@" $INSTALLROOT/botch/lib/libbotch.a "$arg" $INSTALLROOT/botch/lib/libbotch.a
127			continue
128			;;
129		esac
130		;;
131	esac
132	set . "$@" "$arg"
133done
134case $library in
135"")	set . "$@" $INSTALLROOT/botch/lib/libbotch.a
136	shift
137	;;
138esac
139case $optimize in
1400)	set . "$@" .
141	while	:
142	do	shift
143		arg=$1
144		shift
145		case $arg in
146		.)	break ;;
147		-O)	set . "$@" ;;
148		*)	set . "$@" "$arg" ;;
149		esac
150	done
151	;;
152esac
153case $verbose in
154?*)	echo $cc "$@" ;;
155esac
156case $noexec in
157"")	$cc "$@" ;;
158esac
159