2000-01-13 09:44:20 -05:00
|
|
|
#!/bin/sh
|
2000-02-07 22:35:44 -05:00
|
|
|
#
|
|
|
|
# Adapted from the pcmcia-cs/Configure file, license statement below:
|
|
|
|
#
|
|
|
|
# Configure 1.110 1999/06/24 17:37:36
|
|
|
|
#
|
|
|
|
# The contents of this file are subject to the Mozilla Public License
|
|
|
|
# Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
# compliance with the License. You may obtain a copy of the License at
|
|
|
|
# http://www.mozilla.org/MPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS IS"
|
|
|
|
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
|
|
|
# the License for the specific language governing rights and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
# The initial developer of the original code is David A. Hinds
|
|
|
|
# <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
|
|
|
|
# are Copyright (C) 1998 David A. Hinds. All Rights Reserved.
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
# linux-wlan-ng/Configure
|
|
|
|
#
|
2000-01-13 09:44:20 -05:00
|
|
|
# TODO: Since we're dependent on configured pcmcia source, we should change
|
|
|
|
# this such that it will ask for the pcmcia source dir and then read
|
|
|
|
# all our stuff from pcmcia/config.mk. Would simplify alot of things.
|
|
|
|
#
|
|
|
|
|
2000-03-31 11:18:57 -05:00
|
|
|
ECHO="/bin/echo -e "
|
2000-01-13 09:44:20 -05:00
|
|
|
fail ()
|
|
|
|
{
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO ""
|
|
|
|
$ECHO "Configuration failed"
|
|
|
|
$ECHO ""
|
2000-01-13 09:44:20 -05:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if [ -r config.out ]; then
|
|
|
|
. ./config.out 2> /dev/null
|
|
|
|
else
|
|
|
|
if [ ! -r config.in ]; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "config.in does not exist!"
|
2000-01-13 09:44:20 -05:00
|
|
|
fail
|
|
|
|
fi
|
|
|
|
. ./config.in
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
PROMPT=y
|
|
|
|
|
|
|
|
arg () {
|
2000-03-31 11:18:57 -05:00
|
|
|
VALUE="`$ECHO X"$2" | sed -e 's/^X--[a-zA-Z_]*=//'`"
|
2000-01-13 09:44:20 -05:00
|
|
|
eval $1=\"$VALUE\"
|
|
|
|
}
|
|
|
|
|
|
|
|
usage () {
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "usage: $0 "
|
2000-01-13 09:44:20 -05:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
|
|
|
|
CONFIG=config.new
|
|
|
|
CONFIG_MK=config.mk
|
|
|
|
rm -f .prereq.ok $CONFIG $CONFIG_MK $MODVER
|
|
|
|
|
|
|
|
cat << 'EOF' > $CONFIG
|
|
|
|
#
|
|
|
|
# Automatically generated by 'make config' -- don't edit!
|
|
|
|
#
|
|
|
|
EOF
|
|
|
|
|
|
|
|
write_bool() {
|
2000-03-31 11:18:57 -05:00
|
|
|
value=`eval $ECHO '$'$1`
|
2000-01-13 09:44:20 -05:00
|
|
|
if [ "$value" = "y" ] ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "$1=y" >> $CONFIG
|
|
|
|
$ECHO "$1=y" >> $CONFIG_MK
|
2000-01-13 09:44:20 -05:00
|
|
|
else
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "# $1 is not defined" >> $CONFIG
|
|
|
|
$ECHO "# $1 is not defined" >> $CONFIG_MK
|
2000-01-13 09:44:20 -05:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
write_str () {
|
2000-03-31 11:18:57 -05:00
|
|
|
value=`eval $ECHO '$'$1`
|
|
|
|
$ECHO "$1"=\"$value\" >> $CONFIG
|
|
|
|
$ECHO "$1=$value" >> $CONFIG_MK
|
2000-01-13 09:44:20 -05:00
|
|
|
}
|
|
|
|
|
2000-04-26 13:40:31 -04:00
|
|
|
|
|
|
|
dump_str () {
|
|
|
|
$ECHO "$1" >> $CONFIG
|
|
|
|
$ECHO "$1" >> $CONFIG_MK
|
|
|
|
}
|
|
|
|
|
2000-01-13 09:44:20 -05:00
|
|
|
prompt () {
|
|
|
|
eval $3=\"$2\"
|
|
|
|
if [ "$PROMPT" = "y" ] ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "$1 [$2]: \c"
|
2000-01-13 09:44:20 -05:00
|
|
|
read tmp
|
|
|
|
if [ -n "$tmp" ] ; then eval $3=\"$tmp\" ; fi
|
|
|
|
else
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "$1 [$2]"
|
2000-01-13 09:44:20 -05:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
ask_bool () {
|
2000-03-31 11:18:57 -05:00
|
|
|
default=`eval $ECHO '$'$2`
|
2000-01-13 09:44:20 -05:00
|
|
|
if [ ! "$default" ] ; then default=n ; fi
|
|
|
|
answer=""
|
|
|
|
while [ "$answer" != "n" -a "$answer" != "y" ] ; do
|
|
|
|
prompt "$1 (y/n)" "$default" answer
|
|
|
|
done
|
|
|
|
eval "$2=$answer"
|
|
|
|
write_bool $2
|
|
|
|
}
|
|
|
|
|
|
|
|
ask_str () {
|
2000-03-31 11:18:57 -05:00
|
|
|
default=`eval $ECHO '$'$2`
|
|
|
|
prompt "$1" "`$ECHO $default`" answer
|
2000-01-13 09:44:20 -05:00
|
|
|
eval $2=\"$answer\"
|
|
|
|
write_str $2
|
|
|
|
}
|
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO ""
|
2000-05-01 13:11:47 -04:00
|
|
|
$ECHO "-------------- Linux WLAN Configuration Script -------------"
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO ""
|
|
|
|
$ECHO "The default responses are correct for most users."
|
|
|
|
$ECHO ""
|
2000-01-13 09:44:20 -05:00
|
|
|
|
|
|
|
# Collect the kernel source tree and test for sanity
|
|
|
|
|
|
|
|
ask_str "Linux source directory" LINUX_SRC
|
|
|
|
|
|
|
|
if [ ! -f $LINUX_SRC/Makefile ] ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "Linux source tree $LINUX_SRC is incomplete or missing!"
|
2000-01-13 09:44:20 -05:00
|
|
|
if [ -d $LINUX_SRC/include/linux ] ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO " The kernel header files are present, but not " \
|
2000-01-13 09:44:20 -05:00
|
|
|
"the full source code."
|
|
|
|
fi
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO " See the HOWTO for a list of FTP sites for current" \
|
2000-01-13 09:44:20 -05:00
|
|
|
"kernel sources."
|
|
|
|
fail
|
|
|
|
fi
|
|
|
|
|
|
|
|
# What kernel are we compiling for?
|
|
|
|
|
|
|
|
version () {
|
|
|
|
expr $1 \* 65536 + $2 \* 256 + $3
|
|
|
|
}
|
|
|
|
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO ""
|
2000-01-13 09:44:20 -05:00
|
|
|
for TAG in VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION ; do
|
|
|
|
eval `sed -ne "/^$TAG/s/[ ]//gp" $LINUX_SRC/Makefile`
|
|
|
|
done
|
|
|
|
SRC_RELEASE=$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION
|
|
|
|
VERSION_CODE=`version $VERSION $PATCHLEVEL $SUBLEVEL`
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "The kernel source tree is version $SRC_RELEASE."
|
2000-01-13 09:44:20 -05:00
|
|
|
if [ $VERSION_CODE -lt `version 2 0 0` ] ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "This package requires at least a 2.0 series kernel."
|
2000-01-13 09:44:20 -05:00
|
|
|
fail
|
|
|
|
fi
|
|
|
|
CUR_RELEASE=`uname -r`
|
|
|
|
if [ "$SRC_RELEASE" != "$CUR_RELEASE" ] ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "WARNING: the current kernel is actually version $CUR_RELEASE."
|
2000-01-13 09:44:20 -05:00
|
|
|
fi
|
2000-03-13 14:43:32 -05:00
|
|
|
|
2000-04-26 13:40:31 -04:00
|
|
|
if [ ! "$WLAN_TARGET_ARCH" ] ; then
|
|
|
|
BUILD_ARCH=`uname -m | sed -e 's/i.86/i386/'`
|
|
|
|
else
|
|
|
|
BUILD_ARCH=$WLAN_TARGET_ARCH
|
|
|
|
fi
|
2000-01-13 09:44:20 -05:00
|
|
|
|
|
|
|
# Check for consistent kernel build dates
|
|
|
|
|
|
|
|
CUR_D=`uname -v | sed -e 's/^#[0-9]* //;s/SMP //'`
|
2000-03-31 11:18:57 -05:00
|
|
|
CUR_D=`$ECHO $CUR_D | sed -e 's/\(:[0-9][0-9]\) .* \([12][90]\)/\1 \2/'`
|
|
|
|
$ECHO "The current kernel build date is $CUR_D."
|
2000-01-13 09:44:20 -05:00
|
|
|
UTS_VERSION="unknown";
|
|
|
|
if [ -f $LINUX_SRC/include/linux/compile.h ] ; then
|
|
|
|
UTS_VERSION=`grep UTS_VERSION $LINUX_SRC/include/linux/compile.h |
|
|
|
|
sed -e 's/.*"\(.*\)"/\1/'`
|
2000-03-31 11:18:57 -05:00
|
|
|
SRC_D=`$ECHO $UTS_VERSION | sed -e 's/^#[0-9]* //;s/SMP //'`
|
|
|
|
SRC_D=`$ECHO $SRC_D | sed -e 's/\(:[0-9][0-9]\) .* \([12][90]\)/\1 \2/'`
|
2000-01-13 09:44:20 -05:00
|
|
|
if [ $SRC_RELEASE = $CUR_RELEASE -a "$SRC_D" != "$CUR_D" ] ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "WARNING: the source tree has a build date of $SRC_D."
|
2000-01-13 09:44:20 -05:00
|
|
|
if [ `date -d "$SRC_D" +%s` -gt `date -d "$CUR_D" +%s` ] ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO " Did you forget to install your new kernel?!?"
|
2000-01-13 09:44:20 -05:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO ""
|
2000-01-13 09:44:20 -05:00
|
|
|
|
|
|
|
# PCMCIA Source dir
|
2000-04-26 13:40:31 -04:00
|
|
|
if [ ! "$PCMCIA_SRC" ] ; then
|
|
|
|
PCMCIA_SRC=`/sbin/cardctl -V 2>&1 | sed -e 's/cardctl version //'`
|
|
|
|
PCMCIA_SRC=/usr/src/pcmcia-cs-$PCMCIA_SRC
|
|
|
|
fi
|
2000-01-13 09:44:20 -05:00
|
|
|
ask_str "pcmcia-cs source dir" PCMCIA_SRC
|
|
|
|
|
2000-04-26 13:40:31 -04:00
|
|
|
# Alternate target install root dir - the value of this variable
|
|
|
|
# will prefix other variables, such as modules and pcmcia directories
|
|
|
|
ask_str "Alternate target install root directory on host" TARGET_ROOT_ON_HOST
|
2000-01-13 09:44:20 -05:00
|
|
|
|
|
|
|
# Start looking for the destination module dir
|
2000-04-26 13:40:31 -04:00
|
|
|
#MODDIR=$MODULES_DIR
|
|
|
|
#if [ ! "$MODDIR" ] ; then
|
|
|
|
# if [ -d /lib/modules/preferred ] ; then
|
|
|
|
# MODDIR=/lib/modules/preferred
|
|
|
|
# else
|
|
|
|
# MODDIR=/lib/modules/$SRC_RELEASE
|
|
|
|
# fi
|
|
|
|
#else
|
|
|
|
# MODDIR=`$ECHO $MODDIR | \
|
|
|
|
# sed -e "s/[0-9]\.[0-9]\.[0-9]*\(-[A-Za-z0-9]*\)*.*/$SRC_RELEASE/"`
|
|
|
|
#fi
|
|
|
|
|
|
|
|
MODDIR=/lib/modules/$SRC_RELEASE
|
2000-01-13 09:44:20 -05:00
|
|
|
ask_str " Module install directory" MODDIR
|
2000-04-26 13:40:31 -04:00
|
|
|
TARGET_MODDIR=$TARGET_ROOT_ON_HOST$MODDIR
|
|
|
|
write_str TARGET_MODDIR
|
2000-01-13 09:44:20 -05:00
|
|
|
|
|
|
|
# PCMCIA script dir
|
|
|
|
ask_str "PCMCIA script directory" PCMCIA_DIR
|
2000-04-26 13:40:31 -04:00
|
|
|
TARGET_PCMCIA_DIR=$TARGET_ROOT_ON_HOST$PCMCIA_DIR
|
|
|
|
write_str TARGET_PCMCIA_DIR
|
2000-01-13 09:44:20 -05:00
|
|
|
|
|
|
|
# Just write some out (we're not prompting right now)
|
|
|
|
write_str INST_EXEDIR
|
2000-04-26 13:40:31 -04:00
|
|
|
TARGET_INST_EXEDIR=$TARGET_ROOT_ON_HOST$INST_EXEDIR
|
|
|
|
write_str TARGET_INST_EXEDIR
|
2000-01-13 09:44:20 -05:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
|
|
|
|
# How should the startup scripts be configured?
|
|
|
|
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO ""
|
2000-01-13 09:44:20 -05:00
|
|
|
|
|
|
|
if [ "$PREFIX" = "" ] ; then
|
|
|
|
if [ -d /etc/rc.d/init.d -o -d /etc/init.d -o -d /sbin/init.d ] ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "It looks like you have a System V init file setup."
|
2000-01-13 09:44:20 -05:00
|
|
|
SYSV_INIT=y
|
|
|
|
if [ -d /etc/rc.d/init.d ] ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "RC_DIR=/etc/rc.d" >> $CONFIG
|
|
|
|
$ECHO "RC_DIR=/etc/rc.d" >> $CONFIG_MK
|
2000-01-13 09:44:20 -05:00
|
|
|
elif [ -d /sbin/init.d ] ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "RC_DIR=/sbin" >> $CONFIG
|
|
|
|
$ECHO "RC_DIR=/sbin" >> $CONFIG_MK
|
2000-01-13 09:44:20 -05:00
|
|
|
else
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "RC_DIR=/etc" >> $CONFIG
|
|
|
|
$ECHO "RC_DIR=/etc" >> $CONFIG_MK
|
2000-01-13 09:44:20 -05:00
|
|
|
fi
|
|
|
|
else
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO "It looks like you have a BSD-ish init file setup."
|
2000-01-13 09:44:20 -05:00
|
|
|
if ! grep rc.wlan /etc/rc.d/rc.S >/dev/null ; then
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO " You'll need to edit /etc/rc.d/rc.S to invoke" \
|
2000-01-13 09:44:20 -05:00
|
|
|
"/etc/rc.d/rc.wlan (for ISA/PCMCIA cards)"
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO " so that wlan cards will be started at boot time."
|
2000-01-13 09:44:20 -05:00
|
|
|
fi
|
|
|
|
SYSV_INIT=
|
|
|
|
fi
|
|
|
|
write_bool SYSV_INIT
|
|
|
|
else
|
|
|
|
ask_bool "System V init script layout" SYSV_INIT
|
|
|
|
if [ "$SYSV_INIT" = "y" ] ; then
|
|
|
|
ask_str "Top-level directory for RC scripts" RC_DIR
|
|
|
|
fi
|
|
|
|
fi
|
2000-04-26 13:40:31 -04:00
|
|
|
if [ ! -x $TARGET_ROOT_ON_HOST/sbin/depmod ] ; then INSTALL_DEPMOD=n ; fi
|
2000-01-13 09:44:20 -05:00
|
|
|
write_bool INSTALL_DEPMOD
|
|
|
|
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO ""
|
2000-03-13 14:43:32 -05:00
|
|
|
|
|
|
|
#=======================================================================
|
|
|
|
# Make sure our target architecture is the same as our build architecture.
|
|
|
|
|
2000-03-13 21:11:09 -05:00
|
|
|
WLAN_INSTALL_TYPE=sta
|
2000-05-02 15:15:44 -04:00
|
|
|
ask_str "Install drivers as station (sta) or access point (ap)?" WLAN_INSTALL_TYPE
|
2000-03-13 21:11:09 -05:00
|
|
|
|
|
|
|
#=======================================================================
|
2000-04-26 13:40:31 -04:00
|
|
|
# Make sure our target architecture is correct
|
2000-03-13 21:11:09 -05:00
|
|
|
|
2000-03-13 16:33:26 -05:00
|
|
|
WLAN_TARGET_ARCH=$BUILD_ARCH
|
2000-05-02 11:06:00 -04:00
|
|
|
ask_str "Target Architecture? (i386 or ppc)" WLAN_TARGET_ARCH
|
2000-01-13 09:44:20 -05:00
|
|
|
|
2000-04-26 13:40:31 -04:00
|
|
|
ask_str "Prefix for build host compiler? (rarely needed)" HOST_COMPILE
|
|
|
|
|
|
|
|
dump_str 'HOST_AS=$(HOST_COMPILE)as'
|
|
|
|
dump_str 'HOST_LD=$(HOST_COMPILE)ld'
|
|
|
|
dump_str 'HOST_CC=$(HOST_COMPILE)gcc'
|
|
|
|
dump_str 'HOST_CPP=$(HOST_CC) -E'
|
|
|
|
dump_str 'HOST_AR=$(HOST_COMPILE)ar'
|
|
|
|
dump_str 'HOST_NM=$(HOST_COMPILE)nm'
|
|
|
|
dump_str 'HOST_STRIP=$(HOST_COMPILE)strip'
|
|
|
|
dump_str 'HOST_OBJCOPY=$(HOST_COMPILE)objcopy'
|
|
|
|
dump_str 'HOST_OBJDUMP=$(HOST_COMPILE)objdump'
|
|
|
|
dump_str 'HOST_MAKE=make'
|
|
|
|
|
|
|
|
ask_str "Prefix for cross compiler? (change if cross-compiling)" CROSS_COMPILE
|
|
|
|
|
|
|
|
dump_str 'CROSS_AS=$(CROSS_COMPILE)as'
|
|
|
|
dump_str 'CROSS_LD=$(CROSS_COMPILE)ld'
|
|
|
|
dump_str 'CROSS_CC=$(CROSS_COMPILE)gcc'
|
|
|
|
dump_str 'CROSS_CPP=$(CROSS_CC) -E'
|
|
|
|
dump_str 'CROSS_AR=$(CROSS_COMPILE)ar'
|
|
|
|
dump_str 'CROSS_NM=$(CROSS_COMPILE)nm'
|
|
|
|
dump_str 'CROSS_STRIP=$(CROSS_COMPILE)strip'
|
|
|
|
dump_str 'CROSS_OBJCOPY=$(CROSS_COMPILE)objcopy'
|
|
|
|
dump_str 'CROSS_OBJDUMP=$(CROSS_COMPILE)objdump'
|
|
|
|
dump_str 'CROSS_MAKE=make'
|
|
|
|
|
|
|
|
|
2000-03-13 21:40:30 -05:00
|
|
|
#=======================================================================
|
2000-04-26 13:40:31 -04:00
|
|
|
# Should we build for debugging?
|
2000-03-13 21:40:30 -05:00
|
|
|
|
|
|
|
ask_bool "Build for debugging (see doc/config.debug)" WLAN_DEBUG
|
|
|
|
|
2000-01-13 09:44:20 -05:00
|
|
|
#=======================================================================
|
|
|
|
|
|
|
|
mv $CONFIG config.out
|
|
|
|
|
|
|
|
touch .prereq.ok
|
|
|
|
|
2000-03-31 11:18:57 -05:00
|
|
|
$ECHO ""
|
|
|
|
$ECHO "Configuration successful."
|
|
|
|
$ECHO ""
|
2000-04-26 13:40:31 -04:00
|
|
|
|
|
|
|
|