📄 configure
字号:
#!/bin/sh## Configure 1.74 1998/07/03 17:47:57## 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.##=======================================================================# Minimal requirements for sanityif /bin/echo --version | grep -q -- -version ; then echo "Ack! Your shell utilities are too old for this script!" echo " Upgrade to GNU shell utilities version 1.16 or later." exit 1fi#if [ ! -f include/linux/udf.h ] ; then# echo "Ack! The UDF distribution is incomplete/damaged!"# echo " Unpack again."# exit 1#fiif [ -r config.out ] ; then . ./config.out 2>/dev/nullelse if [ ! -r config.in ] ; then echo "config.in does not exist!" exit 1 fi . ./config.infiCONFIG=config.new# CONFIG_H=linux/udf_config.hCONFIG_MK=config.mkCONFIG_MAKEFILE=config.makefileMODVER=include/linux/modversions.hrm -f .prereq.ok $CONFIG $CONFIG_H $CONFIG_MK $CONFIG_MAKEFILE $MODVERtouch $CONFIG_MKcat << 'EOF' > $CONFIG## Automatically generated by 'make config' -- don't edit!#EOFwrite_bool() { value=`eval echo '$'$1` if [ "$value" = "y" ] ; then echo "$1=y" >> $CONFIG echo "$1=y" >> $CONFIG_MK else echo "# $1 is not defined" >> $CONFIG echo "# $1 is not defined" >> $CONFIG_MK fi}write_str () { value=`eval echo '$'$1` echo "$1"=\"$value\" >> $CONFIG echo "$1=$value" >> $CONFIG_MK}write_num () { value=`eval echo '$'$1` if [ "$value" ] ; then echo "$1=$value" >> $CONFIG echo "$1=$value" >> $CONFIG_MK else echo "# $1 is not defined" >> $CONFIG echo "# $1 is not defined" >> $CONFIG_MK fi}ask_bool () { default=`eval echo '$'$2` if [ "$default" = "" ] ; then default=n ; fi answer="" while [ "$answer" != n -a "$answer" != y ] ; do /bin/echo -e "$1 (y/n) [$default]: \c" read answer if [ -z "$answer" ] ; then answer="$default" ; fi done eval "$2=$answer" write_bool $2}ask_str () { default=`eval echo '$'$2` answer="" /bin/echo -e "$1 [$default]: \c" read answer if [ -z "$answer" ] ; then answer="$default" ; fi if [ "$answer" = "none" ] ; then answer="" ; fi eval "$2"=\"$answer\" write_str $2}ask_num () { default=`eval echo '$'$2` answer="" /bin/echo -e "$1 [$default]: \c" read answer if [ -z "$answer" ] ; then answer="$default" ; fi eval "$2"=\"$answer\" write_num $2}#=======================================================================echo ""echo "Linux UDF Configuration Script"echo ""echo "The default responses for each question are correct for most users."echo ""ask_str "Linux source directory" LINUXif [ ! -f $LINUX/Makefile ] ; then echo "Linux source tree $LINUX does not exist!" echo " See the HOWTO for a list of FTP sites for current" \ "kernel sources." echo " I will try to make a best guess." echo "" has_makefile=0else has_makefile=1fiARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/`if [ -f $LINUX/arch/$ARCH/Makefile ] ; then echo "srctree=$LINUX" > $CONFIG_MAKEFILE echo "include $LINUX/arch/$ARCH/Makefile" >> $CONFIG_MAKEFILE echo 'udftest:' >> $CONFIG_MAKEFILE echo ' echo $(LD)' >> $CONFIG_MAKEFILE KERNEL_LD=`make -s -f $CONFIG_MAKEFILE udftest` rm -f $CONFIG_MAKEFILE if [ "$KERNEL_LD" ] ; then LD=$KERNEL_LD fifiask_str "Alternate target install directory" PREFIXask_str "C compiler name" CCask_str "Linker name" LDask_str "Compiler flags for debugging" PCDEBUGecho ""if [ $has_makefile -eq 1 ] ; then echo "The UDF driver needs to be compiled to match the kernel it" echo "will be used with, or it may fail to load." echo "If you are not sure what to do, please consult the UDF manual." 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" src="" while [ "$src" != 1 -a "$src" != 2 ] ; do /bin/echo -e "Enter option (1-2) [1]: \c" read src if [ -z "$src" ] ; then src=1 ; fi done echo ""else src=1fi#=======================================================================symcheck () { if $KSYMS | grep -q "$1" ; then eval "$2=y" else eval "$2=n" fi}modcheck () { if [ "$2" = "y" ] ; then return ; fi insmod $1 > /dev/null 2>&1 if lsmod | grep -q "^$1 " ; then eval "$2=y" INSTALL_DEPMOD=y fi}configcheck () { value=`eval echo '$'$1` if [ "$value" = "m" ] ; then eval "$1=y" INSTALL_DEPMOD=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}printnum() { value=`eval echo '$'$2` /bin/echo -e " $1 is $value" write_num $2}printconfig () { echo "Kernel configuration options:" printflag "Symmetric multiprocessing support" CONFIG_SMP printnum "Max physical memory in MB" CONFIG_MAX_MEMSIZE printflag "Advanced Power Management (APM) support" CONFIG_APM printflag "Networking support" CONFIG_INET printflag "Module version checking" CONFIG_MODVERSIONS}echo "" >> $CONFIGecho "" >> $CONFIG_MKcase $src in 1) if /sbin/ksyms -a | grep -q printk ; then KSYMS="/sbin/ksyms -a" else echo "Hmmm... /sbin/ksyms is broken. Using /proc/ksyms..." KSYMS="cat /proc/ksyms" fi echo "# Options from current kernel" >> $CONFIG echo "# Options from current kernel" >> $CONFIG_MK echo "CHECK=\"/proc/version\"" >> $CONFIG echo "CKSUM=\"`cksum < /proc/version`\"" >> $CONFIG symcheck smp_invalidate_needed CONFIG_SMP # No way to probe for this at the moment... CONFIG_MAX_MEMSIZE=1024 symcheck apm_register_callback CONFIG_APM symcheck register_netdev CONFIG_INET symcheck inet_proto_ops CONFIG_IPV6_MODULE symcheck printk_R CONFIG_MODVERSIONS echo "Extracting kernel symbol versions..." $KSYMS | sed -ne 's/.* \(.*\)_R\([0-9a-f]*\)/\1 \2/p' | \ awk '{ printf "#define %s\t%s_R%s\n", $1, $1, $2 }' \ > $MODVER printconfig ;; 2) AUTOCONF=$LINUX/.config if [ ! -r $AUTOCONF ] ; then echo "**********************************" echo "Config file $AUTOCONF not present!" echo "To fix, run:" echo " cd $LINUX" echo " make menuconfig" echo " make dep" echo " " exit 1 fi echo "# Options from $AUTOCONF" >> $CONFIG echo "# Options from $AUTOCONF" >> $CONFIG_MK echo "CHECK=\"$AUTOCONF\"" >> $CONFIG echo "CKSUM=\"`cksum < $AUTOCONF`\"" >> $CONFIG . $AUTOCONF printconfig ;;esacecho "ARCH=$ARCH" >> $CONFIG_MKif [ $src != "1" -a "$CONFIG_MODVERSIONS" = "y" ] ; then MODVER="$LINUX/$MODVER" if [ ! -r $MODVER ] ; then echo "$MODVER does not exist!" echo " To fix, run 'make dep' in $LINUX."# exit 1 fielse MODVER="../$MODVER"fiif [ ! -r $LINUX/include/asm ] ; then echo "$LINUX/include/asm does not exist!" echo " To fix, do 'ln -s asm-i386 asm' in $LINUX/include." exit 1fiif [ "$CONFIG_SMP" = "y" ] ; then echo "SMPFLAG=-D__SMP__" >> $CONFIG_MKfiecho "" >> $CONFIGecho "" >> $CONFIG_MK#=======================================================================# What kernel are we compiling for?echo ""if [ $has_makefile -eq 1 ] ; then VERSION=`sed -n -e 's/^VERSION = \(.*\)/\1/p' $LINUX/Makefile` PATCHLEVEL=`sed -n -e 's/^PATCHLEVEL = \(.*\)/\1/p' $LINUX/Makefile` SUBLEVEL=`sed -n -e 's/^SUBLEVEL = \(.*\)/\1/p' $LINUX/Makefile` EXTRAVERSION=`sed -n -e 's/^EXTRAVERSION = \(.*\)/\1/p' $LINUX/Makefile` SRC_RELEASE=$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION VERSION_CODE=`expr $VERSION \* 65536 + $PATCHLEVEL \* 256 + $SUBLEVEL` echo "The kernel source tree is version $SRC_RELEASE." CUR_RELEASE=`uname -r` if [ "$SRC_RELEASE" != "$CUR_RELEASE" ] ; then echo "WARNING: the current kernel is actually version $CUR_RELEASE." fielse SRC_RELEASE=`uname -r` VERSION=`echo $SRC_RELEASE | sed -n -e 's/^\([0-9]*\).*/\1/p'` PATCHLEVEL=`echo $SRC_RELEASE | sed -n -e 's/.*\.\([0-9]*\)\..*/\1/p'` SUBLEVEL=`echo $SRC_RELEASE | sed -n -e 's/.*\.\([0-9]*\)$/\1/p'` CUR_RELEASE=$SRC_RELEASE echo "The kernel source tree is version $SRC_RELEASE."fi# Check for consistent kernel build datesCUR_D=`uname -v | sed -e 's/^#[0-9]* \(SMP\)\?//'`echo "The current kernel build date is $CUR_D."UTS_VERSION="unknown";if [ -f $LINUX/include/linux/compile.h ] ; then UTS_VERSION=`grep UTS_VERSION $LINUX/include/linux/compile.h | sed -e 's/.*"\(.*\)"/\1/'` SRC_D=`echo $UTS_VERSION | sed -e 's/^#[0-9]* \(SMP\)\?//'` if [ $SRC_RELEASE = $CUR_RELEASE -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 fifiif [ $src -eq 1 ] ; then UTS_VERSION=`uname -r` ; fiUTS_RELEASE=`grep UTS_RELEASE $LINUX/include/linux/version.h | grep -v BOOT | awk '{print $3}' | sed 's/"//g'`if [ "`echo $UTS_RELEASE | wc -w | sed 's/ //g'`" != "1" -o "$UTS_RELEASE" == "" ] ; then echo "Cannot determine version from version.h. Using Makefile." UTS_RELEASE=$CUR_RELEASEfiUTS_SHORT=`echo $UTS_RELEASE | sed 's/[^0-9\.].*//' | sed 's/.[0-9]*$//'`case "$VERSION.$PATCHLEVEL" in2.2|2.4) BUILD_PATH=module BUILD_SUBDIRS=`pwd`/module if [ "$CONFIG_MODVERSIONS" = "y" ] ; then echo "MFLAG=-DMODVERSIONS -include $MODVER" >> $CONFIG_MK fi ;;2.5|2.6) BUILD_PATH=$PREFIX/lib/modules/$UTS_RELEASE/build BUILD_SUBDIRS=`pwd`/linux-2.6 ;;*) echo "This package requires a 2.2/2.4/2.5 series kernel." exit 1 ;;esacif [ ! "`grep "DQUOT_ALLOC_INODE(struct inode \*inode)" $LINUX/include/linux/quotaops.h`" ] ; then echo "ACFLAG=-DOLD_QUOTA" >> $CONFIG_MKfiwrite_str UTS_RELEASEwrite_str UTS_SHORTwrite_str UTS_VERSIONwrite_str BUILD_PATHwrite_str BUILD_SUBDIRSecho "LINUX_VERSION_CODE=$VERSION_CODE" >> $CONFIGecho "LINUX_VERSION_CODE=$VERSION_CODE" >> $CONFIG_MKecho "" >> $CONFIGecho "" >> $CONFIG_MKecho ""#=======================================================================# make symlink for src and patch directoriesif [ -L src ]; then rm srcfiif [ -d src ]; then rm -rf srcfiif [ -d linux-$UTS_SHORT ]; then ln -s linux-$UTS_SHORT srcelse echo "Linux version $UTS_SHORT not supported."fiif [ -L patch ]; then rm patchfiif [ -d patch ]; then rm -rf patchfiif [ -d patch-$UTS_SHORT ]; then ln -s patch-$UTS_SHORT patchelse echo No patch for Linux version $UTS_SHORT.fi#=======================================================================# Check out the module stuffif [ ! -x /sbin/insmod -o ! -x /sbin/rmmod ] ; then echo "Your module utilities (insmod, rmmod) are missing from /sbin!" echo " To fix, you should build and install the latest set" \ "of module tools," echo " available from FTP sites listed in the HOWTO." exit 1fiMOD_RELEASE=`/sbin/modprobe -V 2>&1 | \ sed -n -e 's/.*[Vv]ersion \([0-9][0-9.]*\)/\1/p'`echo "Your module utilities are version $MOD_RELEASE."case "$VERSION.$PATCHLEVEL" in2.0) NEED=2.0.0 ;;2.1) if [ $SUBLEVEL -lt 18 ] ; then NEED=2.0.0 elif [ $SUBLEVEL -lt 85 ] ; then NEED=2.1.23 else NEED=2.1.85 fi ;;esacMIN=`/bin/echo -e "$MOD_RELEASE\n$NEED" | sort -t. +0n -1 +1n -2 +2n | head -1`if [ "$MIN" != "$NEED" ] ; then echo "Your module utilities are too old for this kernel!" echo " To fix, upgrade to at least version $NEED." exit 1fimv $CONFIG config.outtouch .prereq.ok
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -