]> git.ozlabs.org Git - ppp.git/blob - configure
pppd: Fix SIGSEGV in EAP-TLS code when TLS verify method is not specified
[ppp.git] / configure
1 #!/bin/sh
2 # $Id: configure,v 1.38 2008/06/15 07:08:49 paulus Exp $
3
4 # Where to install stuff by default
5 DESTDIR=/usr/local
6 SYSCONF=/etc
7
8 # Compile defaults
9 CROSS_COMPILE=
10 CC=cc
11 CFLAGS=
12
13 system=`uname -s`
14 release=`uname -r`
15 arch=`uname -m`
16 state="unknown"
17
18 case $system in
19   Linux)
20     makext="linux";
21     ksrc="linux";
22     state="known";
23     CFLAGS="-O2 -g -pipe";;
24   SunOS)
25     karch=`/usr/bin/isainfo -k`
26     case $release in
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
38     fi
39     if [ "$1" = 32 ]; then
40         shift
41         archvariant=
42     fi
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 -m64 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
55       fi
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
69       fi
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 esac
76
77 if [ -d "$ksrc" ]; then :; else
78   state="notincluded"
79   unset ksrc
80 fi
81
82 case $state in
83   unknown)
84     echo "This software has not been ported to $system.  Sorry.";;
85   notincluded)
86     echo "Support for $system has not been included"
87     echo "in this distribution.  Sorry.";;
88   known)
89     echo "Configuring for $system";;
90 esac
91
92 # Parse arguments
93 while [ $# -gt 0 ]; do
94     arg=$1
95     val=
96     shift
97     case $arg in
98         *=*)
99             val=`expr "x$arg" : 'x[^=]*=\(.*\)'`
100             arg=`expr "x$arg" : 'x\([^=]*\)=.*'`
101             ;;
102         --prefix|--sysconf)
103             if [ $# -eq 0 ]; then
104                 echo "error: the $arg argument requires a value" 1>&2
105                 exit 1
106             fi
107             val=$1
108             shift
109             ;;
110     esac
111     case $arg in
112         --prefix)        DESTDIR=$val ;;
113         --sysconfdir)    SYSCONF=$val ;;
114         --cross_compile) CROSS_COMPILE=$val ;;
115         --cc)            CC=$val ;;
116         --cflags)        CFLAGS=$val ;;
117     esac
118 done
119
120 mkmkf() {
121     rm -f $2
122     if [ -f $1 ]; then
123         echo "  $2 <= $1"
124         sed -e "s,@DESTDIR@,$DESTDIR,g" -e "s,@SYSCONF@,$SYSCONF,g" \
125             -e "s,@CROSS_COMPILE@,$CROSS_COMPILE,g" -e "s,@CC@,$CC,g" \
126             -e "s|@CFLAGS@|$CFLAGS|g" $1 >$2
127     fi
128 }
129
130 if [ -d "$ksrc" ]; then
131     echo "Creating Makefiles."
132     mkmkf $ksrc/Makefile.top Makefile
133     mkmkf $ksrc/Makedefs$compiletype Makedefs.com
134     for dir in pppd pppstats chat pppdump pppd/plugins pppd/plugins/pppoe \
135                pppd/plugins/radius pppd/plugins/pppoatm \
136                pppd/plugins/pppol2tp; do
137         mkmkf $dir/Makefile.$makext $dir/Makefile
138     done
139     if [ -f $ksrc/Makefile.$makext$archvariant ]; then
140         mkmkf $ksrc/Makefile.$makext$archvariant $ksrc/Makefile
141     fi
142 else
143   echo "Unable to locate kernel source $ksrc"
144   exit 1
145 fi