1#!/bin/sh
2# $Id: configure,v 1.1.1.1 2008/10/15 03:30:13 james26_jang Exp $
3
4#  if [ -d /NextApps ]; then
5#    system="NeXTStep"
6#  else
7  system=`uname -s`
8  release=`uname -r`
9  machine=`uname -p`
10  arch=`uname -m`
11#  fi
12state="unknown"
13
14case $system in
15  Linux)
16    makext="linux";
17    ksrc="linux";
18    state="known";;
19  SunOS)
20    case $release in
21#      [0-3]*)	state="ancient";;
22#      4*)	state="known"; ksrc="sunos4"; makext="sunos4";;
23      5.[7-9]*|5.[1-9][0-9])	state="known"; ksrc="solaris"; makext="sol2";
24              case "`/usr/bin/isainfo -k`" in
25		sparcv9)	archvariant='-64';;
26		*)	;;
27	      esac;;
28      5.[1-6]*)	state="known"; ksrc="solaris"; makext="sol2";;
29    esac
30    if [ -x /opt/SUNWspro/bin/cc ] &&
31       /opt/SUNWspro/bin/cc -flags >/dev/null 2>&1; then
32      : # use Sun WorkShop compiler
33    elif gcc --version >/dev/null 2>&1; then
34      archvariant=gcc$archvariant
35      compiletype=.gcc
36      if [ "$archvariant" = "gcc-64" ]; then
37        ( cd /tmp; touch ppp$$.c
38	  gcc -c -m64 ppp$$.c >/dev/null 2>&1 || (
39	    echo "gcc is unable to make 64 bit modules, and your $arch system needs them."
40	    echo "consider upgrading gcc on this machine, or switching to Sun WorkShop."
41	    rm -f ppp$$.c
42	    exit 1
43	  ) || exit 1
44	  rm -f ppp$$.c ppp$$.o
45        ) || exit 1
46      fi
47    else
48      echo "C compiler not found; hoping for the best."
49    fi;;
50  NetBSD|FreeBSD|ULTRIX|OSF1|NeXTStep|SINIX-?|UNIX_SV|UNIX_System_V)
51    state="notincluded";;
52#    NetBSD)
53#      makext="bsd";
54#      case $release in
55#        0.*)	state="ancient";;
56#        1.0*)	state="ancient";;
57#        1.1*)	state="known"; ksrc="netbsd-1.1";;
58#        1.2*)	state="known"; ksrc="netbsd-1.2"; makext="netbsd-1.2";;
59#        1.[3-9]*|[2-9]*)
60#  		state="late"; ksrc="netbsd-1.2";;
61#      esac;;
62#    ULTRIX)
63#      makext="ultrix";
64#      case $release in
65#        [0-3]*)	state="ancient";;
66#        4.[01]*)	state="early"; ksrc="ultrix";;
67#        4.[234])	state="known"; ksrc="ultrix";;
68#      esac;;
69#    OSF1)
70#      makext="osf";
71#      case $release in
72#        V1.*)   state="neolithic"; ksrc="osf1";;
73#        V[23].*)	state="neolithic"; ksrc="osf1";;
74#        V4.*)	state="known"; ksrc="osf1";;
75#        V[5-9]*) state="late"; ksrc="osf1";;
76#      esac;;
77#    FreeBSD)
78#      makext="bsd";
79#      case $release in
80#        1.*)	state="known"; ksrc="freebsd-old";;
81#        2.[01]*)	state="known"; ksrc="freebsd-2.0";;
82#        2.2.[2-7]*) state="late"; ksrc="freebsd-2.0";;
83#        2.2.8*)   state="known"; ksrc="freebsd-2.2.8";;
84#        3.[0-1]*)	state="known"; ksrc="freebsd-3.0";;
85#      esac;;
86#    NeXTStep)
87#      makext="NeXT";
88#      ksrc="NeXT";
89#      state="known";;
90#    SINIX-?)
91#      case $release in
92#        5.4[01]) state=known; ksrc=svr4; makext=svr4;;
93#        5.4[2-9]) state=late; ksrc=svr4; makext=svr4;;
94#      esac;;
95#    # Intel SVR4 systems come with a bug in the uname program.  Unless
96#    # your provider fixed the bug, or you get a fix for it, uname -S will
97#    # overwrite the system name with the node name!
98#    UNIX_SV|UNIX_System_V|`uname -n`)
99#      case $release in
100#        4.0) state=known; ksrc=svr4; makext=svr4;;
101#        4.2) state=late; ksrc=svr4; makext=svr4;;
102#      esac;;
103esac
104
105if [ -d "$ksrc" ]; then :; else
106  state="notincluded"
107  unset ksrc
108fi
109
110case $state in
111  neolithic) 
112    echo "This is a newer release on an outdated OS ($system)."
113    echo " This software may or may not work on this OS."
114    echo " You may want to download an older version of PPP for this OS.";;
115  ancient)
116    echo "This is an old release of a supported OS ($system)."
117    echo "This software cannot be used as-is on this system,"
118    echo "but you may be able to port it.  Good luck!"
119    exit;;
120  early)
121    echo "This is an old release of a supported OS ($system)."
122    echo "This software should install and run on this system,"
123    echo "but it hasn't been tested.";;
124  late)
125    echo "This is a newer release of $system than is supported by"
126    echo "this software.  It may or may not work.";;
127  unknown)
128    echo "This software has not been ported to $system.  Sorry.";;
129  notincluded)
130    echo "Support for $system has not been included"
131    echo "in this distribution.  Sorry.";;
132  known)
133    echo "Configuring for $system";;
134esac
135
136if [ -d "$ksrc" ]; then
137  echo "Creating links to Makefiles."
138  rm -f Makefile
139  ln -s $ksrc/Makefile.top Makefile
140  echo "  Makefile -> $ksrc/Makefile.top"
141  rm -f Makedefs.com
142  ln -s $ksrc/Makedefs$compiletype Makedefs.com
143  echo "  $ksrc/Makedefs$compiletype -> Makedefs.com"
144  for dir in pppd pppstats chat pppdump pppd/plugins pppd/plugins/rp-pppoe pppd/plugins/radius; do
145    rm -f $dir/Makefile
146    if [ -f $dir/Makefile.$makext ]; then
147      ln -s Makefile.$makext $dir/Makefile
148      echo "  $dir/Makefile -> Makefile.$makext"
149    fi
150  done
151  if [ "$archvariant" ]; then
152    makext=$makext$archvariant
153    rm -f $ksrc/Makefile
154    ln -s Makefile.$makext $ksrc/Makefile
155    echo "  $ksrc/Makefile -> Makefile.$makext"
156  fi
157else
158  echo "Unable to locate kernel source $ksrc"
159  exit 1
160fi
161