Update for 2.4.4 release
[mpls-ppp.git] / configure
blob2a658dbf6d936547ee10db6ef9b0a9f9570f80e4
1 #!/bin/sh
2 # $Id: configure,v 1.37 2005/06/26 23:53:17 carlsonj Exp $
4 # Where to install stuff by default
5 DESTDIR=/usr/local
6 SYSCONF=/etc
8 # if [ -d /NextApps ]; then
9 # system="NeXTStep"
10 # else
11 system=`uname -s`
12 release=`uname -r`
13 arch=`uname -m`
14 # fi
15 state="unknown"
17 case $system in
18 Linux)
19 makext="linux";
20 ksrc="linux";
21 state="known";;
22 SunOS)
23 karch=`/usr/bin/isainfo -k`
24 case $release in
25 # [0-3]*) state="ancient";;
26 # 4*) state="known"; ksrc="sunos4"; makext="sunos4";;
27 5.[7-9]*|5.[1-9][0-9]*) state="known"; ksrc="solaris"; makext="sol2";
28 case "$karch" in
29 amd64) archvariant='-64x';;
30 sparcv9) archvariant='-64';;
31 *) ;;
32 esac;;
33 5.[1-6]*) state="known"; ksrc="solaris"; makext="sol2";;
34 esac
35 if [ "$1" = gcc ]; then
36 shift
37 usegcc=gcc
39 if [ "$1" = 32 ]; then
40 shift
41 archvariant=
43 if [ -x /opt/SUNWspro/bin/cc -a "$usegcc" != gcc ] &&
44 /opt/SUNWspro/bin/cc -flags >/dev/null 2>&1; then
45 if [ "$archvariant" = "-64x" ]; then
46 ( cd /tmp; echo "int x;" > ppp$$.c
47 /opt/SUNWspro/bin/cc -c -errwarn -xchip=opteron -xarch=amd64 ppp$$.c >/dev/null 2>&1 || (
48 echo "WorkShop C is unable to make 64 bit modules, and your $karch system needs"
49 echo "them. Consider upgrading cc on this machine."
50 rm -f ppp$$.c
51 exit 1
52 ) || exit 1
53 rm -f ppp$$.c ppp$$.o
54 ) || exit 1
56 elif gcc --version >/dev/null 2>&1; then
57 archvariant=gcc$archvariant
58 compiletype=.gcc
59 if [ "$archvariant" = "gcc-64" -o"$archvariant" = "gcc-64x" ]; then
60 ( cd /tmp; touch ppp$$.c
61 gcc -c -m64 ppp$$.c >/dev/null 2>&1 || (
62 echo "gcc is unable to make 64 bit modules, and your $karch system needs them."
63 echo "Consider upgrading gcc on this machine, or switching to Sun WorkShop."
64 rm -f ppp$$.c
65 exit 1
66 ) || exit 1
67 rm -f ppp$$.c ppp$$.o
68 ) || exit 1
70 else
71 echo "C compiler not found; hoping for the best."
72 fi;;
73 NetBSD|FreeBSD|ULTRIX|OSF1|NeXTStep|SINIX-?|UNIX_SV|UNIX_System_V)
74 state="notincluded";;
75 # NetBSD)
76 # makext="bsd";
77 # case $release in
78 # 0.*) state="ancient";;
79 # 1.0*) state="ancient";;
80 # 1.1*) state="known"; ksrc="netbsd-1.1";;
81 # 1.2*) state="known"; ksrc="netbsd-1.2"; makext="netbsd-1.2";;
82 # 1.[3-9]*|[2-9]*)
83 # state="late"; ksrc="netbsd-1.2";;
84 # esac;;
85 # ULTRIX)
86 # makext="ultrix";
87 # case $release in
88 # [0-3]*) state="ancient";;
89 # 4.[01]*) state="early"; ksrc="ultrix";;
90 # 4.[234]) state="known"; ksrc="ultrix";;
91 # esac;;
92 # OSF1)
93 # makext="osf";
94 # case $release in
95 # V1.*) state="neolithic"; ksrc="osf1";;
96 # V[23].*) state="neolithic"; ksrc="osf1";;
97 # V4.*) state="known"; ksrc="osf1";;
98 # V[5-9]*) state="late"; ksrc="osf1";;
99 # esac;;
100 # FreeBSD)
101 # makext="bsd";
102 # case $release in
103 # 1.*) state="known"; ksrc="freebsd-old";;
104 # 2.[01]*) state="known"; ksrc="freebsd-2.0";;
105 # 2.2.[2-7]*) state="late"; ksrc="freebsd-2.0";;
106 # 2.2.8*) state="known"; ksrc="freebsd-2.2.8";;
107 # 3.[0-1]*) state="known"; ksrc="freebsd-3.0";;
108 # esac;;
109 # NeXTStep)
110 # makext="NeXT";
111 # ksrc="NeXT";
112 # state="known";;
113 # SINIX-?)
114 # case $release in
115 # 5.4[01]) state=known; ksrc=svr4; makext=svr4;;
116 # 5.4[2-9]) state=late; ksrc=svr4; makext=svr4;;
117 # esac;;
118 # # Intel SVR4 systems come with a bug in the uname program. Unless
119 # # your provider fixed the bug, or you get a fix for it, uname -S will
120 # # overwrite the system name with the node name!
121 # UNIX_SV|UNIX_System_V|`uname -n`)
122 # case $release in
123 # 4.0) state=known; ksrc=svr4; makext=svr4;;
124 # 4.2) state=late; ksrc=svr4; makext=svr4;;
125 # esac;;
126 esac
128 if [ -d "$ksrc" ]; then :; else
129 state="notincluded"
130 unset ksrc
133 case $state in
134 neolithic)
135 echo "This is a newer release on an outdated OS ($system)."
136 echo " This software may or may not work on this OS."
137 echo " You may want to download an older version of PPP for this OS.";;
138 ancient)
139 echo "This is an old release of a supported OS ($system)."
140 echo "This software cannot be used as-is on this system,"
141 echo "but you may be able to port it. Good luck!"
142 exit;;
143 early)
144 echo "This is an old release of a supported OS ($system)."
145 echo "This software should install and run on this system,"
146 echo "but it hasn't been tested.";;
147 late)
148 echo "This is a newer release of $system than is supported by"
149 echo "this software. It may or may not work.";;
150 unknown)
151 echo "This software has not been ported to $system. Sorry.";;
152 notincluded)
153 echo "Support for $system has not been included"
154 echo "in this distribution. Sorry.";;
155 known)
156 echo "Configuring for $system";;
157 esac
159 # Parse arguments
160 while [ $# -gt 0 ]; do
161 arg=$1
162 val=
163 shift
164 case $arg in
165 *=*)
166 val=`expr "x$arg" : 'x[^=]*=\(.*\)'`
167 arg=`expr "x$arg" : 'x\([^=]*\)=.*'`
169 --prefix|--sysconf)
170 if [ $# -eq 0 ]; then
171 echo "error: the $arg argument requires a value" 1>&2
172 exit 1
174 val=$1
175 shift
177 esac
178 case $arg in
179 --prefix) DESTDIR=$val ;;
180 --sysconfdir) SYSCONF=$val ;;
181 esac
182 done
184 mkmkf() {
185 rm -f $2
186 if [ -f $1 ]; then
187 echo " $2 <= $1"
188 sed -e "s,@DESTDIR@,$DESTDIR,g" -e "s,@SYSCONF@,$SYSCONF,g" $1 >$2
192 if [ -d "$ksrc" ]; then
193 echo "Creating Makefiles."
194 mkmkf $ksrc/Makefile.top Makefile
195 mkmkf $ksrc/Makedefs$compiletype Makedefs.com
196 for dir in pppd pppstats chat pppdump pppd/plugins pppd/plugins/rp-pppoe \
197 pppd/plugins/radius pppd/plugins/pppoatm; do
198 mkmkf $dir/Makefile.$makext $dir/Makefile
199 done
200 if [ -f $ksrc/Makefile.$makext$archvariant ]; then
201 mkmkf $ksrc/Makefile.$makext$archvariant $ksrc/Makefile
203 else
204 echo "Unable to locate kernel source $ksrc"
205 exit 1