~ubuntu-branches/debian/sid/acx100/sid

« back to all changes in this revision

Viewing changes to Configure

  • Committer: Bazaar Package Importer
  • Author(s): Miguel Gea Milvaques
  • Date: 2005-04-13 23:36:11 UTC
  • Revision ID: james.westby@ubuntu.com-20050413233611-5ec8mnua3b9k3t4u
Tags: upstream-0.2.0pre8+52
ImportĀ upstreamĀ versionĀ 0.2.0pre8+52

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# this script might require a bash compatible shell, but right now it
 
4
# also runs in ksh and ash, so let's set it to /bin/sh
 
5
 
 
6
# Added checks to see if the kernel configuration file exists and if so,
 
7
# check if all necessary options are enabled. By Vesa-Pekka Palmu <depili@sci.fi>
 
8
 
 
9
# some initial definitions
 
10
 
 
11
CONFIG_MK=config.mk
 
12
KERNEL_VER=`uname -r`
 
13
KERNEL_BUILD=/lib/modules/$KERNEL_VER/build
 
14
# If using 2.6 outputting to a seperate directory, make KERNEL_OUTPUT
 
15
# point to that directory
 
16
#KERNEL_OUTPUT=
 
17
ECHO="`which echo` -e"
 
18
WARNING_FLAG=0
 
19
 
 
20
# functions
 
21
 
 
22
# What kernel are we compiling for?
 
23
version() {
 
24
        expr $1 \* 65536 + $2 \* 256 + $3
 
25
}
 
26
 
 
27
write_bool() {
 
28
        value=`eval $ECHO '$'$1`
 
29
        if test "$value" = "y"
 
30
        then
 
31
                $ECHO "$1=y" >> $CONFIG_MK
 
32
        else
 
33
                $ECHO "# $1 is not defined" >> $CONFIG_MK
 
34
        fi
 
35
}
 
36
 
 
37
write_str() {
 
38
        value=`eval $ECHO '$'$1`
 
39
        $ECHO $1=$value >> $CONFIG_MK
 
40
}
 
41
 
 
42
qgrep() {
 
43
        grep $* >/dev/null 2>&1
 
44
}
 
45
 
 
46
configcheck() {
 
47
        eval "CONFIG_$1=n"
 
48
        if qgrep "^CONFIG_$1=y" "$KERNEL_OUTPUT/.config"
 
49
        then
 
50
                eval "CONFIG_$1=y"
 
51
        elif qgrep "^CONFIG_$1=m" "$KERNEL_OUTPUT/.config"
 
52
        then
 
53
                eval "CONFIG_$1=y"
 
54
        fi
 
55
}
 
56
 
 
57
printflag() {
 
58
        value=`eval echo '$'$2`
 
59
        $ECHO "    $1 is \c"
 
60
        if test "$value" = "y"
 
61
        then
 
62
                $ECHO "enabled."
 
63
        else
 
64
                $ECHO "DISABLED!"
 
65
        fi
 
66
}
 
67
 
 
68
is_unset() {
 
69
        value=`eval echo '$'$1`
 
70
        if test "$value" = "n"
 
71
        then
 
72
                return 0
 
73
        else
 
74
                return 1
 
75
        fi
 
76
}
 
77
 
 
78
fail() {
 
79
        $ECHO "Kernel configuration lacks needed options, please correct! ABORTING."
 
80
        exit 1
 
81
}
 
82
 
 
83
wireless_stats() {
 
84
        if [ ! -f $KERNEL_BUILD/include/linux/wireless.h ]; then
 
85
                $ECHO "$KERNEL_BUILD/include/linux/wireless.h header file doesn't exist!" 
 
86
                fail
 
87
        fi
 
88
        let WIRELESS_VERSION=`grep define.*WIRELESS_EXT $KERNEL_BUILD/include/linux/wireless.h|tr '\t' ' '|cut -f3 -d' '`
 
89
        echo Wireless header file is WIRELESS_EXT version $WIRELESS_VERSION.
 
90
        gcc -v 2>&1|grep ver
 
91
        echo Running linux $KERNEL_VER
 
92
        if [ $WIRELESS_VERSION -lt 13 ]; then
 
93
          echo "Compile info: will choose to use code infrastructure for OLDER wireless extension interface version (< 13)"
 
94
          echo "This support is not perfectly tested, please report any problems!"
 
95
          echo "Upgrading to relatively current Linux kernel package recommended (will also fix some security issues which older ones have)"
 
96
        else
 
97
          echo "Compile info: will choose to use code infrastructure for NEWER wireless extension interface version (>= 13)"
 
98
        fi
 
99
}
 
100
 
 
101
# ---------- main ----------
 
102
 
 
103
rm -f $CONFIG_MK
 
104
 
 
105
if [ -z "${KERNEL_OUTPUT}" ]
 
106
then
 
107
        KERNEL_OUTPUT=${KERNEL_BUILD}
 
108
fi
 
109
 
 
110
if [ ! -d ${KERNEL_OUTPUT} ]; then
 
111
  $ECHO
 
112
  $ECHO "WARNING: kernel build/output directory not found!"
 
113
  $ECHO "You probably need to install the kernel development/header file package! (which matches your currently running kernel)"
 
114
  $ECHO
 
115
  WARNING_FLAG=1
 
116
fi
 
117
  
 
118
$ECHO Kernel version file: $KERNEL_OUTPUT/include/linux/version.h
 
119
$ECHO Kernel configuration file: $KERNEL_OUTPUT/.config
 
120
$ECHO "Make damn sure these really match your currently running kernel!!"
 
121
$ECHO
 
122
 
 
123
VERSION_CODE=`grep LINUX_VERSION_CODE $KERNEL_OUTPUT/include/linux/version.h | \
 
124
        sed -e 's/[^0-9]//g'`
 
125
 
 
126
[ -z $VERSION_CODE ] && VERSION_CODE=0
 
127
 
 
128
if [ -e "$KERNEL_OUTPUT/.config" ]
 
129
then
 
130
        $ECHO "Kernel configuration found, performing sanity checks"
 
131
        configcheck MODULES
 
132
        configcheck NET_RADIO
 
133
        configcheck NET_WIRELESS
 
134
        configcheck PCMCIA
 
135
        configcheck CARDBUS
 
136
        configcheck USB
 
137
        configcheck PCI
 
138
        configcheck SMP
 
139
        $ECHO "All of the following items are required by the driver:"
 
140
        printflag "Loadable modules support" CONFIG_MODULES
 
141
        printflag "Wireless LAN (non-hamradio) support" CONFIG_NET_RADIO
 
142
        printflag "Wireless extensions support" CONFIG_NET_WIRELESS
 
143
        $ECHO "The following is needed for PCMCIA/CardBus cards:"
 
144
        printflag "PCMCIA support" CONFIG_PCMCIA
 
145
        printflag "CardBus support" CONFIG_CARDBUS
 
146
        $ECHO "The following is needed for USB card support:"
 
147
        printflag "USB support" CONFIG_USB
 
148
        $ECHO "The following is needed for PCI card support:"
 
149
        printflag "PCI support" CONFIG_PCI
 
150
        if is_unset CONFIG_MODULES
 
151
        then
 
152
                fail
 
153
        elif is_unset CONFIG_NET_RADIO
 
154
        then
 
155
                fail
 
156
        elif is_unset CONFIG_NET_WIRELESS
 
157
        then
 
158
                fail    
 
159
        else
 
160
                $ECHO "Kernel configuration satisfies the minimum requirements, continuing."
 
161
                wireless_stats
 
162
        fi
 
163
        if is_unset CONFIG_SMP
 
164
        then 
 
165
                $ECHO "Symmetric multiprocessing support (CONFIG_SMP) is disabled."
 
166
        else
 
167
                $ECHO "WARNING: Symmetric multiprocessing support (CONFIG_SMP) is enabled. If you"
 
168
                $ECHO "really have more than one cpu, be warned that this driver might still be not SMP safe."
 
169
                WARNING_FLAG=1
 
170
        fi
 
171
        if is_unset CONFIG_USB
 
172
        then 
 
173
                $ECHO "WARNING: USB support (CONFIG_USB) is disabled."
 
174
                $ECHO "This is not a terribly good idea in case your ACX100 card is USB-based."
 
175
                WARNING_FLAG=1
 
176
        fi
 
177
else
 
178
        $ECHO "WARNING: Unable to find kernel configuration file ($KERNEL_OUTPUT/.config) -> unable to perform sanity checks"
 
179
        $ECHO "Make sure your kernel has the required options enabled, see README"
 
180
        WARNING_FLAG=1
 
181
fi
 
182
 
 
183
if [ $VERSION_CODE -ge `version 2 5 0` ]
 
184
then
 
185
        KERN26="yes"
 
186
else
 
187
        KERN26=
 
188
fi
 
189
 
 
190
write_str KERNEL_BUILD
 
191
write_str KERNEL_OUTPUT
 
192
write_str VERSION_CODE
 
193
write_str KERN26
 
194
 
 
195
if [ "$WARNING_FLAG" = "1" ]; then
 
196
  $ECHO
 
197
  $ECHO "*** Potential problems found above, waiting 5 seconds to let you know about it. ***"
 
198
  sleep 5
 
199
fi