Reduce amount of macro magic. Use the same special characters as nroff
[netbsd-mini2440.git] / dist / dhcp / configure
blobeeb62ac0ee3ca3e4fe0a80b163c986204c19f86c
1 #!/bin/sh
3 #sysname=$1
5 while [ $# != 0 ]; do
6 if [ x$1 = x--with-nsupdate ]; then
7 echo "nsupdate is always built now."
8 elif [ x$1 = x--print-sysname ]; then
9 print_sysname=yes
10 elif [ x$1 = x--work-dir ]; then
11 workname=$2
12 shift
13 elif [ x$1 = x--dirs ]; then
14 dirs=$2
15 shift
16 elif [ x$1 = x--no-links ]; then
17 nolinks=YES
18 elif [ x$1 = x--copts ]; then
19 copts=$2
20 shift
21 elif [ x$sysname = x ]; then
22 sysname=$1
23 else
24 echo "Unexpected argument: $1"
26 shift
27 done
29 uname=`uname -s`
30 machine=`uname -m`
32 if [ "$sysname" = "" ]; then
33 case $uname in
34 SCO_SV)
35 IFS=":"
36 for foo in $PATH; do
37 if [ x$gcc_path = x ] && [ -x $foo/gcc ]; then
38 gcc_path=$foo/gcc
39 fi
40 done
41 IFS=" "
42 if [ x$gcc_path = x ]; then
43 sysname=sco-cc
44 sysname_print=sco
45 else
46 sysname=sco-gcc
47 sysname_print=sco
50 AIX)
51 sysname=aix;;
52 Darwin)
53 sysname=darwin;;
54 Rhapsody)
55 sysname=rhapsody;;
56 ULTRIX)
57 sysname=ultrix;;
58 BSD/OS)
59 release=`uname -r`
60 minor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'`
61 major=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
63 case $major in
64 [123]) sysname=bsdos ;;
65 *) case $minor in
66 0) sysname=bsdos ;;
67 *) sysname=bsdos-4.1 ;;
68 esac;;
69 esac;;
70 OSF1)
71 if [ $machine = 'alpha' ]; then
72 sysname=alphaosf
73 # OSF1 has libc snprintf/vsnprintf support as of 4.0F. There is
74 # no v4 & v5 portable compile-time way of knowing the system's
75 # version (we can #include a version-identing file, but it is only
76 # present in v5).
78 # So we rely on a system command, 'sizer', and default to
79 # no-snprintf if we can't find it.
80 if [ -x /usr/sbin/sizer ] ; then
81 release=`/usr/sbin/sizer -v | cut -d ' ' -f 4 | cut -c 2-`
82 major=`echo $release | cut -d . -f 1`
83 minor=`echo $release | cut -d . -f 2`
84 incr=`echo $minor | sed 's/[0-9]//g' | tr '[A-Z]' '[0-9]'`
85 minor=`echo $minor | sed 's/[A-Z]//g'`
87 if [ $major -gt 4 -o \
88 $major -eq 4 -a $minor -gt 0 -o \
89 $major -eq 4 -a $minor -eq 0 -a $incr -gt 5 ]; then
90 copts="$copts -DHAVE_SNPRINTF"
93 fi;;
94 Linux)
95 release=`uname -r`
96 minor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'`
97 major=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
99 case $major in
100 1) sysname=linux-1 ;;
101 2) case $minor in
102 0) sysname=linux-2.0 ;;
103 1) sysname=linux-2.1 ;;
104 2) sysname=linux-2.2 ;;
105 *) sysname=linux-2.2 ;;
106 esac;;
107 esac;;
108 SunOS)
109 release=`uname -r`
110 minor=`echo $release |sed -e 's/.*[0-9]*\.\([0-9][0-9]*\).*$/\1/'`
111 major=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
112 IFS=":"
113 for foo in $PATH; do
114 if [ x$gcc_path = x ] && [ -x $foo/gcc ]; then
115 gcc_path=$foo/gcc
117 done
118 IFS=" "
120 case $major in
122 if [ x$gcc_path = x ]; then
123 echo SunOS 4 build will not work without the GNU C Compiler.
124 exit 1
126 sysname=sunos4;;
128 if [ x$gcc_path = x ]; then
129 sysname=sunos5-cc
130 sysname_print=sunos5
131 else
132 sysname=sunos5-gcc
133 sysname_print=sunos5
134 fi;;
135 esac;;
136 NetBSD)
137 sysname=netbsd;;
138 OpenBSD)
139 sysname=openbsd;;
140 FreeBSD)
141 sysname=freebsd;;
142 hpux)
143 IFS=":"
144 for foo in $PATH; do
145 if [ x$gcc_path = x ] && [ -x $foo/gcc ]; then
146 gcc_path=$foo/gcc
148 done
149 IFS=" "
151 if [ x$gcc_path = x ]; then
152 sysname=hpux-cc
153 sysname_print=hpux
154 else
155 sysname=hpux-gcc
156 sysname_print=hpux
157 fi;;
158 HP-UX)
159 IFS=":"
160 for foo in $PATH; do
161 if [ x$gcc_path = x ] && [ -x $foo/gcc ]; then
162 gcc_path=$foo/gcc
164 done
165 IFS=" "
167 if [ x$gcc_path = x ]; then
168 sysname=hpux-cc
169 sysname_print=hpux
170 else
171 sysname=hpux-gcc
172 sysname_print=hpux
173 fi;;
174 QNX)
175 release=`uname -r`
176 major=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
177 case $major in
179 sysname=qnxnto;;
181 sysname=qnx;;
182 esac;;
183 NEXTSTEP)
184 sysname=nextstep;;
185 UnixWare)
186 sysname=uw7;;
187 esac
190 if [ "$sysname" = "" ]; then
191 if [ x$print_sysname = xyes ]; then
192 echo "unknown"
193 else
194 echo "UNIX name: $uname machine: $machine"
195 echo
196 echo "Unknown system. If this is an SCO system running ODT 3.0 or"
197 echo "higher, type \`\`./configure sco''. Otherwise, this is a"
198 echo "configuration that isn't supported or hasn't been tested."
199 echo
200 echo "Supported configurations are:"
201 echo " aix AIX 4.1.5.0"
202 echo " ultrix ULTRIX 4.2A or higher"
203 echo " bsdos BSDI BSD/OS 2.1"
204 echo " alphaosf DEC Alpha OSF/1"
205 echo " linux Linux"
206 echo " sunos4 Sunos 4.1.4 (earlier releases may work)"
207 echo " sunos5-cc Solaris 2.4 or higher with Sun cc"
208 echo " sunos5-gcc Solaris 2.4 or higher with gcc"
209 echo " netbsd NetBSD 1.1 or higher"
210 echo " freebsd FreeBSD"
211 echo " openbsd OpenBSD (i386/alpha)"
212 echo " hpux HP-UX"
213 echo " qnx QNX 4.2 or higher"
214 echo " NEXTSTEP NeXTSTEP"
215 echo " sco SCO Open Server"
216 exit 1;
220 if [ x$print_sysname = xyes ]; then
221 if [ x$sysname_print != x ]; then
222 echo $sysname_print
223 else
224 echo $sysname
226 exit 0
229 if [ x$workname = x ]; then
230 if [ x$sysname_print != x ]; then
231 workname=work.${sysname_print}
232 else
233 workname=work.${sysname}
237 echo "System Type: $sysname"
239 if [ x$major != x ] && [ x$minor != x ]; then
240 majversubst="-e /^##--majver--/,/^##--majver--/s/MajorVersion/$major/"
241 minversubst="-e /^##--minver--/,/^##--minver--/s/MinorVersion/$minor/"
244 if [ ! -d $workname ]; then
245 mkdir $workname
248 if [ x"$dirs" = x ]; then
249 dirs=". client server relay common omapip dhcpctl minires dst"
252 for foo in $dirs; do
253 bar=`basename $foo`
254 if [ ! -d ${workname}/$bar ]; then
255 mkdir ${workname}/$bar
257 (sed $majversubst $minversubst \
258 -e "/^##--${sysname}--/,/^##--${sysname}--/s/^#//" \
259 <Makefile.conf; \
260 cat site.conf; \
261 echo "TOP = `pwd`"; \
262 echo CC_OPTIONS = $copts; \
263 cat $foo/Makefile.dist) \
264 >${workname}/$bar/Makefile
265 done
267 # Make the link tree in which to actually build.
268 if [ x$nolinks = x ]; then
269 make links
272 exit 0