📄 configure
字号:
#!/bin/sh## Configure 1.208 2002/05/26 17:36:37## The contents of this file are subject to the Mozilla Public License# Version 1.1 (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@pcmcia.sourceforge.org>. Portions created by David A. Hinds# are Copyright (C) 1999 David A. Hinds. All Rights Reserved.## Alternatively, the contents of this file may be used under the terms# of the GNU General Public License version 2 (the "GPL"), in which case# the provisions of the GPL are applicable instead of the above. If you# wish to allow the use of your version of this file only under the# terms of the GPL and not to allow others to use your version of this# file under the MPL, indicate your decision by deleting the provisions# above and replace them with the notice and other provisions required# by the GPL. If you do not delete the provisions above, a recipient# may use your version of this file under either the MPL or the GPL.##=======================================================================fail (){ echo "" echo "Configuration failed." echo "" exit 1}# Minimal requirements for sanityif [ ! -L include/linux/config.h ] ; then echo "Ack! The PCMCIA distribution is incomplete/damaged!" echo " Unpack again -- and try using a Linux filesystem this time." failfiif ! make -v >/dev/null ; then echo "Ack! This system does not have a 'make' command!" echo " Install a normal set of Linux development tools and try again." failfiif ! gcc -v >/dev/null 2>&1 ; then echo "Ack! Your system does not have 'gcc' installed!" echo " Install a normal set of Linux development tools and try again." failfiif [ -r config.out ] ; then . ./config.out 2>/dev/nullelse if [ ! -r config.in ] ; then echo "config.in does not exist!" fail fi . ./config.infi#=======================================================================PROMPT=yarg () { VALUE="`echo X"$2" | sed -e 's/^X--[a-zA-Z_]*=//'`" eval $1=\"$VALUE\"}usage () { echo "usage: $0 [-n|--noprompt] [--kernel=src-dir] [--target=dir]" echo " [--moddir=dir] [--arch={i386|alpha|arm|ppc] [--ucc=path]" echo " [--kcc=path] [--ld=path] [--uflags=flags] [--kflags=flags]" echo " [--debug=flags] [--{no}trust] [--{no}cardbus] [--{no}pnp]" echo " [--{no}apm] [--force] [--current] [--srctree] [--sysv]" echo " [--bsd] [--rcdir=dir] [--extraver=ver]" echo "" echo " -n, --noprompt non-interactive mode: no prompting" echo " --kernel=DIR use kernel source tree at DIR" echo " --target=DIR install all files using DIR as root" echo " --moddir=DIR install modules under DIR" echo " --arch=ARCH select target architecture for build" echo " --ucc=PATH specify C compiler for user code" echo " --kcc=PATH specify C compiler for kernel code" echo " --ld=PATH use another linker" echo " --uflags=FLAGS set compiler flags for user-mode tools" echo " --kflags=FLAGS set compiler flags for kernel modules" echo " --debug=FLAGS set compiler flags for debugging" echo " --{no}trust disable or enable trusted user tools" echo " --{no}cardbus disable or enable CardBus card support" echo " --{no}pnp disable or enable PnP BIOS support" echo " --{no}apm disable or enable power management support" echo " --force ignore presence of 2.4 kernel drivers" echo " --current read configuration of current kernel" echo " --srctree read kernel configuration from source tree" echo " --sysv target has SysV init script layout" echo " --bsd target uses BSD init scripts" echo " --rcdir=DIR SysV init scripts are under DIR" echo " --extraver=VER overrides EXTRAVERSION in kernel Makefile" exit 1}while [ $# -gt 0 ] ; do case "$1" in -n|--noprompt) PROMPT=n ;; --kernel=*) arg LINUX $1 ;; --target=*) arg PREFIX $1 ;; --moddir=*) arg MODDIR $1 ;; --cc=*) arg UCC "$1" ;; --ucc=*) arg UCC "$1" ;; --kcc=*) arg KCC "$1" ;; --ld=*) arg LD "$1" ;; --debug=*) arg PCDEBUG "$1" ;; --kflags=*) arg KFLAGS "$1" ;; --uflags=*) arg UFLAGS "$1" ;; --arch=*) arg ARCH "$1" ;; --trust) UNSAFE_TOOLS=y ;; --notrust) UNSAFE_TOOLS=n ;; --cardbus) CONFIG_CARDBUS=y ;; --nocardbus) CONFIG_CARDBUS=n ;; --pnp) CONFIG_PNP_BIOS=y ;; --nopnp) CONFIG_PNP_BIOS=n ;; --apm) USE_PM=y ;; --noapm) USE_PM=n ;; --force) FORCE=y ;; --current) CONF_SRC=1 ;; --srctree) CONF_SRC=2 ;; --sysv) SYSV_INIT=y ;; --bsd) SYSV_INIT=n ;; --rcdir=*) arg RC_DIR "$1" ;; --extraver=*) arg EXTRAVER "$1" ;; *) usage ;; esac shiftdone#=======================================================================CONFIG=config.newCONFIG_H=include/pcmcia/config.hCONFIG_MK=config.mkMODVER=include/linux/modversions.hrm -f .prereq.ok $CONFIG $CONFIG_H $CONFIG_MK $MODVERcat << 'EOF' > $CONFIG## Automatically generated by 'make config' -- don't edit!#EOFcat << 'EOF' > $CONFIG_H/* Automatically generated by 'make config' -- don't edit!*/#ifndef _PCMCIA_CONFIG_H#define _PCMCIA_CONFIG_H#define AUTOCONF_INCLUDED#define __IN_PCMCIA_PACKAGE__EOFwrite_bool() { value=`eval echo '$'$1` if [ "$value" = "y" ] ; then echo "$1=y" >> $CONFIG echo "$1=y" >> $CONFIG_MK echo "#define $1 1" >> $CONFIG_H else echo "# $1 is not defined" >> $CONFIG echo "# $1 is not defined" >> $CONFIG_MK echo "#undef $1" >> $CONFIG_H fi}write_int () { value=`eval echo '$'$1` echo "$1"=$value >> $CONFIG echo "$1=$value" >> $CONFIG_MK echo "#define $1 $value" >> $CONFIG_H}write_str () { value=`eval echo '$'$1` echo "$1"=\"$value\" >> $CONFIG echo "$1=$value" >> $CONFIG_MK echo "#define $1 \"$value\"" >> $CONFIG_H}prompt () { eval $3=\"$2\" if [ "$PROMPT" = "y" ] ; then /bin/echo -e "$1 [$2]: \c" read tmp if [ ! -t 1 ] ; then echo $tmp ; fi if [ -n "$tmp" ] ; then eval $3=\"$tmp\" ; fi else /bin/echo "$1 [$2]" fi}ask_bool () { default=`eval echo '$'$2` 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 () { default=`eval echo '$'$2` prompt "$1" "`echo $default`" answer eval $2=\"$answer\" write_str $2}#=======================================================================echo ""echo " -------- Linux PCMCIA Configuration Script --------"echo ""echo "The default responses for each question are correct for most users."echo "Consult the PCMCIA-HOWTO for additional info about each option."echo ""ask_str "Linux kernel source directory" LINUXmatch () { case "$1" in $2) return 0; ;; *) return 1;; esac ; }if ! match "$LINUX" "/*" ; then echo "$LINUX is not an absolute path!" failfiif [ ! -f $LINUX/kernel/Makefile ] ; then echo "Linux source tree '$LINUX' is incomplete or missing!" if [ -d $LINUX/include/linux ] ; then echo " The kernel header files are present, but not " \ "the full source code." fi echo " See the HOWTO for a list of FTP sites for current" \ "kernel sources." failfi# What kernel are we compiling for?version () { expr $1 \* 65536 + $2 \* 256 + $3}echo ""for TAG in VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION ; do eval `sed -ne "/^$TAG/s/[ ]//gp" $LINUX/Makefile`doneif [ "$EXTRAVER" != "" ] ; then EXTRAVERSION=$EXTRAVER write_str EXTRAVERfiSRC_RELEASE=$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSIONSRC_BASE=$VERSION.$PATCHLEVEL.$SUBLEVELVERSION_CODE=`version $VERSION $PATCHLEVEL $SUBLEVEL`echo "The kernel source tree is version $SRC_RELEASE."if [ $VERSION_CODE -lt `version 2 0 0` ] ; then echo "This package requires at least a 2.0 series kernel." failfiHOST_ARCH=`uname -m | sed -e 's/i.86/i386/'`if [ ! "$ARCH" ] ; then ARCH=$HOST_ARCH ; fiCUR_RELEASE=`uname -r`CUR_VERSION=`uname -v`CUR_BASE=`uname -r | sed -e "s/^\([0-9]\.[0-9]\.[0-9]*\).*/\1/"`MATCH=0 # default: different releases and/or architecturesif [ $ARCH = $HOST_ARCH ] ; then if [ $CUR_RELEASE = $SRC_RELEASE ] ; then MATCH=1 # same release, perfect match elif [ $CUR_BASE = $SRC_BASE ] ; then MATCH=1 # well, maybe same source tree echo " WARNING: the current kernel is sublevel $CUR_RELEASE." else echo " WARNING: the current kernel is version $CUR_RELEASE." fifi# Check for consistent kernel build datesCUR_D=`uname -v | sed -e 's/^#[0-9]* //;s/SMP //'`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."SRC_VERSION="unknown";if [ -f $LINUX/include/linux/compile.h ] ; then SRC_VERSION=`grep UTS_VERSION $LINUX/include/linux/compile.h | sed -e 's/.*"\(.*\)"/\1/'` SRC_D=`echo $SRC_VERSION | sed -e 's/^#[0-9]* //;s/SMP //'` SRC_D=`echo $SRC_D | sed -e 's/\(:[0-9][0-9]\) .* \([12][90]\)/\1 \2/'` if [ $MATCH = 1 -a "$SRC_D" != "$CUR_D" ] ; then echo " WARNING: the source tree has a build date of $SRC_D." if [ `date -d "$SRC_D" +%s` -gt `date -d "$CUR_D" +%s` ] ; then echo " Did you forget to install your new kernel?" fi elif [ $MATCH = 1 ] ; then MATCH=2 # same release & date fifiecho ""if [ ! "$UCC" ] ; then UCC=cc ; fiif [ ! "$KCC" ] ; then if which kgcc >/dev/null 2>&1 ; then KCC=kgcc ; else KCC="$UCC" ; fififor x in PREFIX KCC UCC LD KFLAGS UFLAGS PCDEBUG ; do write_str $xdonewrite_bool USE_PMask_bool "Build 'trusting' versions of card utilities" UNSAFE_TOOLSask_bool "Include 32-bit (CardBus) card support" CONFIG_CARDBUSif [ $ARCH = "i386" -a $VERSION_CODE -gt `version 2 2 0` ] ; then ask_bool "Include PnP BIOS resource checking" CONFIG_PNP_BIOSelse CONFIG_PNP_BIOS=n write_bool CONFIG_PNP_BIOSfiif [ $MATCH = 0 ] ; then CONF_SRC=2 # Use source tree when required to do soelif [ $MATCH = 2 ] ; then CONF_SRC=3 # Use source tree when safe to do soelif [ $MATCH = 1 -a ! -r $LINUX/.config ] ; then CONF_SRC=1 # Use running kernel if tree is not configuredelse echo "" echo "The PCMCIA drivers need to be compiled to match the kernel they" echo "will be used with, or some or all of the modules may fail to load." echo "If you are not sure what to do, please consult the PCMCIA-HOWTO." echo "" echo "How would you like to set kernel-specific options?" echo " 1 - Read from the currently running kernel" echo " 2 - Read from the Linux source tree" ans="" while [ "$ans" != 1 -a "$ans" != 2 ] ; do prompt "Enter option (1-2)" "$CONF_SRC" ans done CONF_SRC=$ans echo ""fiecho "CONF_SRC=$CONF_SRC" >> $CONFIGif [ $CONF_SRC = 1 ] ; then UTS_VERSION=$CUR_VERSION ; UTS_RELEASE=$CUR_RELEASEelse UTS_VERSION=$SRC_VERSION ; UTS_RELEASE=$SRC_RELEASEfiif [ ! "$MODDIR" ] ; then if [ -d /lib/modules/preferred ] ; then MODDIR=/lib/modules/preferred else MODDIR=/lib/modules/$UTS_RELEASE fielse MODDIR=`echo $MODDIR | \ sed -e "s/[0-9]\.[0-9]\.[0-9]*.*/$UTS_RELEASE/"`fiask_str "Module install directory" MODDIRif ! match "$MODDIR" "/lib/modules/*" ; then if match "$MODDIR" "[yY]" ; then echo "Selected directory '$MODDIR' is bogus!" fail fi echo "WARNING: '$MODDIR' is an unusual target. Be careful!"fiecho ""#=======================================================================symcheck () { eval "CONFIG_$1=n" if $KSYMS | grep "$2" >/dev/null ; then eval "CONFIG_$1=y" ; fi if [ "$3" ] ; then /sbin/insmod $3 > /dev/null 2>&1 if $KSYMS | grep "$2" > /dev/null ; then eval "CONFIG_$1=y" fi fi}configcheck () { eval "CONFIG_$1=n" if grep "^CONFIG_$1=y" $AUTOCONF >/dev/null ; then eval "CONFIG_$1=y" elif grep "^CONFIG_$1=m" $AUTOCONF >/dev/null ; then eval "CONFIG_$1=y" fi}printflag() { value=`eval echo '$'$2` /bin/echo -e " $1 is \c" if [ "$value" = "y" ] ; then echo "enabled." else echo "disabled." fi write_bool $2}x86_config_tweak () { if [ $VERSION_CODE -ge `version 2 2 0` ] ; then if [ $CONFIG_SMP = "y" ] ; then CONFIG_X86_LOCAL_APIC=y CONFIG_X86_IO_APIC=y write_bool CONFIG_X86_LOCAL_APIC write_bool CONFIG_X86_IO_APIC fi if [ $CONFIG_PCI = "y" ] ; then CONFIG_PCI_QUIRKS=y write_bool CONFIG_PCI_QUIRKS fi fi}printconfig () { echo "Kernel configuration options:" if [ $VERSION_CODE -ge `version 2 3 18` ] ; then printflag "Kernel-tree PCMCIA support" CONFIG_PCMCIA fi printflag "Symmetric multiprocessing support" CONFIG_SMP printflag "PCI BIOS support" CONFIG_PCI x86_config_tweak printflag "Power management (APM) support" CONFIG_PM printflag "SCSI support" CONFIG_SCSI printflag "IEEE 1394 (FireWire) support" CONFIG_IEEE1394 printflag "Networking support" CONFIG_INET printflag " Radio network interface support" CONFIG_NET_PCMCIA_RADIO printflag " Token Ring device support" CONFIG_TR printflag " Fast switching" CONFIG_NET_FASTROUTE printflag " Frame Diverter" CONFIG_NET_DIVERT printflag "Module version checking" CONFIG_MODVERSIONS printflag "Kernel debugging support" CONFIG_DEBUG_KERNEL if [ "$CONFIG_DEBUG_KERNEL" = "y" ] ; then printflag " Memory leak detection support" CONFIG_MEMLEAK printflag " Spinlock debugging" CONFIG_DEBUG_SPINLOCK fi printflag "Preemptive kernel patch" CONFIG_PREEMPT if [ $VERSION_CODE -lt `version 2 1 7` ] ; then printflag "PCMCIA IDE device support" CONFIG_BLK_DEV_IDE_PCMCIA fi if [ $ARCH = "i386" ] ; then CONFIG_X86_L1_CACHE_BYTES=32 write_int CONFIG_X86_L1_CACHE_BYTES CONFIG_X86_L1_CACHE_SHIFT=5 write_int CONFIG_X86_L1_CACHE_SHIFT fi if [ $ARCH = "alpha" ] ; then if [ $VERSION_CODE -lt `version 2 2 0` ] ; then CONFIG_ALPHA_LCA=y write_bool CONFIG_ALPHA_LCA else CONFIG_ALPHA_GENERIC=y write_bool CONFIG_ALPHA_GENERIC fi fi if [ $ARCH = "arm" ] ; then printflag "Brutus architecture" CONFIG_ARCH_BRUTUS printflag "Itsy target platform" CONFIG_ITSY fi if [ $ARCH = "ppc" ] ; then printflag "MPC8xx architecture" CONFIG_8xx printflag "IBM 4xx processor" CONFIG_4xx printflag "Embedded Planet LITE platform" CONFIG_RPXLITE printflag "Embedded Planet CLASSIC platfom" CONFIG_RPXCLASSIC printflag "MPC823 processor" CONFIG_MPC823 printflag "MPC850 processor" CONFIG_MPC850 printflag "MPC860 processor" CONFIG_MPC860 printflag "MPC860T processor" CONFIG_MPC860T if [ $VERSION_CODE -gt `version 2 4 0` ] ; then CONFIG_ALL_PPC=y write_bool CONFIG_ALL_PPC fi fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -