#!/bin/sh
#
# Configure 1.93 1999/02/16 01:33:29
#
# 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 sanity
if /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 1
fi
if [ ! -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."
    exit 1
fi

if [ -r config.out ] ; then
    . ./config.out 2>/dev/null
else
    if [ ! -r config.in ] ; then
	echo "config.in does not exist!"
	exit 1
    fi
    . ./config.in
fi

#=======================================================================

PROMPT=y

arg () {
    eval $1=`echo $2 | sed -e 's/^--[a-zA-Z_]*=//'`
}

usage () {
    echo "usage: $0 [-n|--noprompt] [--kernel=src-dir] [--target=dir]"
    echo "    [--moddir=dir] [--cc=path] [--ld=path] [--debug=debug-flags]"
    echo "    [--{no}trust] [--{no}cardbus] [--current] [--srctree] [--manual]"
    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 CC $1		;;
    --ld=*)		arg LD $1		;;
    --debug=*)		arg PCDEBUG $1		;;
    --trust)		UNSAFE_TOOLS=y		;;
    --notrust)		UNSAFE_TOOLS=n		;;
    --cardbus)		CONFIG_CARDBUS=y	;;
    --nocardbus)	CONFIG_CARDBUS=n	;;
    --current)		CONF_SRC=1		;;
    --srctree)		CONF_SRC=2		;;
    --manual)		CONF_SRC=3		;;
    *)			usage			;;
    esac
    shift
done

#=======================================================================

CONFIG=config.new
CONFIG_H=include/pcmcia/config.h
CONFIG_MK=config.mk
MODVER=include/linux/modversions.h
rm -f .prereq.ok $CONFIG $CONFIG_H $CONFIG_MK $MODVER

cat << 'EOF' > $CONFIG
#
# Automatically generated by 'make config' -- don't edit!
#
EOF

cat << 'EOF' > $CONFIG_H
/*
  Automatically generated by 'make config' -- don't edit!
*/
#ifndef _PCMCIA_CONFIG_H
#define _PCMCIA_CONFIG_H

#define AUTOCONF_INCLUDED

EOF

write_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_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 "$1 [$2]: \c"
	read tmp
	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" "$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 source directory" LINUX

if [ ! -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."
    exit 1
fi

# 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`
done
SRC_RELEASE=$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION
VERSION_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."
    exit 1
fi
CUR_RELEASE=`uname -r`
if [ "$SRC_RELEASE" != "$CUR_RELEASE" ] ; then
    echo "WARNING: the current kernel is actually version $CUR_RELEASE."
fi

# Check for consistent kernel build dates

CUR_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."
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]* //;s/SMP //'`
    SRC_D=`echo $SRC_D | sed -e 's/\(:[0-9][0-9]\) .* \([12][90]\)/\1 \2/'`
    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
    fi
fi
echo ""

ask_str "Alternate target install directory" PREFIX
if [ -d /lib/modules/preferred ] ; then
    MODDIR=$PREFIX/lib/modules/preferred
else
    MODDIR=$PREFIX/lib/modules/$SRC_RELEASE
fi
ask_str "  Module install directory" MODDIR

ask_str "C compiler name" CC
ask_str "Linker name" LD
ask_str "Compiler flags for debugging" PCDEBUG

ask_bool "Build 'trusting' versions of card utilities" UNSAFE_TOOLS
ask_bool "Include 32-bit (CardBus) card support" CONFIG_CARDBUS

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"
echo "    3 - Set each option by hand (experts only!)"

ans=""
while [ "$ans" != 1 -a "$ans" != 2 -a "$ans" != 3 ] ; do
    prompt "Enter option (1-3)" "$CONF_SRC" ans
done
CONF_SRC=$ans
echo "CONF_SRC=$CONF_SRC" >> $CONFIG
echo ""

#=======================================================================

symcheck () {
    if $KSYMS | grep -q "$1" ; then
	eval "$2=y"
    else
	eval "$2=n"
    fi
}

modcheck () {
    if [ "$2" = "y" ] ; then return ; fi
    /sbin/insmod $1 > /dev/null 2>&1
    if /sbin/lsmod | grep -q "^$1 " ; then
	eval "$2=y"
	INSTALL_DEPMOD=y
    fi
}

configcheck () {
    if grep -q "^$1=y" $AUTOCONF ; then
	eval "$1=y"
    elif grep -q "^$1=m" $AUTOCONF ; then
	eval "$1=y"
	INSTALL_DEPMOD=y
    else
	eval "$1=n"
    fi
}

printflag() {
    value=`eval echo '$'$2`
    /bin/echo "    $1 is \c"
    if [ "$value" = "y" ] ; then
	echo "enabled."
    else
	echo "disabled."
    fi
    write_bool $2
}

printconfig () {
    echo "Kernel configuration options:"
    printflag "Symmetric multiprocessing support" CONFIG_SMP
    printflag "PCI BIOS support" CONFIG_PCI
    if [ $VERSION_CODE -ge `version 2 2 0` ] ; then
	if [ $CONFIG_SMP = "y" ] ; then
	    CONFIG_X86_LOCAL_APIC=y
	    write_bool CONFIG_X86_LOCAL_APIC
	fi
	if [ $CONFIG_PCI = "y" ] ; then
	    CONFIG_PCI_QUIRKS=y
	    write_bool CONFIG_PCI_QUIRKS
	fi
    fi
    printflag "Advanced Power Management (APM) support" CONFIG_APM
    printflag "SCSI support" CONFIG_SCSI
    printflag "Networking support" CONFIG_INET
    #printflag " IPv6 support" CONFIG_IPV6
    printflag " Radio network interface support" CONFIG_NET_RADIO
    printflag " Token Ring device support" CONFIG_TR
    printflag "Module version checking" CONFIG_MODVERSIONS
    if [ $VERSION_CODE -lt `version 2 1 7` ] ; then
	printflag "PCMCIA IDE device support" CONFIG_BLK_DEV_IDE_PCMCIA
    fi
    printflag "DEC Alpha UDB target platform" CONFIG_ALPHA_LCA
    printflag "/proc filesystem support" CONFIG_PROC_FS
}

echo "" >> $CONFIG
echo "" >> $CONFIG_MK
echo "" >> $CONFIG_H

case $CONF_SRC in
    1)
	if [ -x /sbin/ksyms ] ; 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 "/* Options from current kernel */" >> $CONFIG_H
	echo "CHECK=\"/proc/version\"" >> $CONFIG
	echo "CKSUM=\"`cksum < /proc/version`\"" >> $CONFIG
	symcheck smp_invalidate_needed CONFIG_SMP
	symcheck pcibios CONFIG_PCI
	symcheck apm_register_callback CONFIG_APM
	symcheck scsi_register CONFIG_SCSI
	modcheck scsi_mod CONFIG_SCSI
	modcheck serial CONFIG_SERIAL
	symcheck register_netdev CONFIG_INET
	#cc -o /tmp/has_ipv6 cardmgr/has_ipv6.c
	#if /tmp/has_ipv6 ; then
	#    CONFIG_IPV6=y
	#else
	#    CONFIG_IPV6=n
	#fi
	#rm /tmp/has_ipv6
	#symcheck inet_proto_ops CONFIG_IPV6_MODULE
	if [ -r /proc/net/wireless ] ; then
	    CONFIG_NET_RADIO=y
	else
	    CONFIG_NET_RADIO=n
	fi
	symcheck printk_R CONFIG_MODVERSIONS
	if [ $VERSION_CODE -lt `version 2 1 7` ] ; then
	    symcheck ide_register CONFIG_BLK_DEV_IDE_PCMCIA
	fi
	symcheck tr_setup CONFIG_TR
	symcheck hwrpb CONFIG_ALPHA_LCA
	symcheck proc_root CONFIG_PROC_FS
	echo "Extracting kernel symbol versions..."
	echo "#ifndef __LINUX_MODVERSIONS_H" > $MODVER
	echo "#define __LINUX_MODVERSIONS_H" >> $MODVER
	$KSYMS | sed -ne 's/.* \(.*\)_R\([0-9a-f]*\)/\1 \2/p' | \
	    awk '{ printf "#define %s\t%s_R%s\n", $1, $1, $2 }' \
	    >> $MODVER
	echo "#endif" >> $MODVER
	printconfig
	;;
    2)
	AUTOCONF=$LINUX/.config
	if [ ! -r $AUTOCONF ] ; then
	    echo "Config file $AUTOCONF not present!"
	    echo "    To fix, run 'make config' in $LINUX."
	    exit 1
	fi
	echo "# Options from $AUTOCONF" >> $CONFIG
	echo "# Options from $AUTOCONF" >> $CONFIG_MK
	echo "/* Options from $AUTOCONF */" >> $CONFIG_H
	echo "CHECK=\"$AUTOCONF\"" >> $CONFIG
	echo "CKSUM=\"`cksum < $AUTOCONF`\"" >> $CONFIG
	if grep -q "^ *SMP *= *1" $LINUX/Makefile ; then
	    CONFIG_SMP=y
	else
	    configcheck CONFIG_SMP
	fi
	if [ $VERSION_CODE -lt `version 2 1 7` ] ; then
	    configcheck CONFIG_BLK_DEV_IDE_PCMCIA
	fi
	for C in CONFIG_PCI CONFIG_APM CONFIG_SCSI \
	    CONFIG_INET CONFIG_NET_RADIO CONFIG_TR \
	    CONFIG_MODVERSIONS CONFIG_ALPHA_LCA CONFIG_PROC_FS \
	    CONFIG_SERIAL ; do
	    configcheck $C
	done
	printconfig
	;;
    3)
	echo "# Configured manually" >> $CONFIG
	echo "# Configured manually" >> $CONFIG_MK
	echo "/* Configured manually */" >> $CONFIG_H
	ask_bool "Symmetric multiprocessing support" CONFIG_SMP
	ask_bool "PCI BIOS support" CONFIG_PCI
	ask_bool "Advanced Power Management (APM) support" CONFIG_APM
	ask_bool "SCSI support" CONFIG_SCSI
	ask_bool "TCP/IP networking" CONFIG_INET
	#ask_bool " IPv6 protocol support" CONFIG_IPV6
	ask_bool " Radio network interface support" CONFIG_NET_RADIO
	ask_bool " Token Ring device support" CONFIG_TR
	ask_bool "Set version information for module symbols" \
	    CONFIG_MODVERSIONS
	if [ $VERSION_CODE -lt `version 2 1 7` ] ; then
	    ask_bool "Include PCMCIA IDE device support" \
		CONFIG_BLK_DEV_IDE_PCMCIA
	fi
	ask_bool "DEC Alpha UDB target platform" CONFIG_ALPHA_LCA
	ask_bool "/proc filesystem support" CONFIG_PROC_FS
	;;
esac

if [ "$CONFIG_PCI" != "y" -a "$CONFIG_CARDBUS" = "y" ] ; then
    echo "Cardbus support requires kernel PCI BIOS support!"
    echo "    To fix, re-run 'make config' and disable Cardbus support."
    exit 1
fi

ARCH=`uname -m`
AFLAGS=
if [ $ARCH = "ppc" ] ; then
    AFLAGS="-fno-builtin -msoft-float"
    if [ $VERSION_CODE -ge `version 2 1 26` ] ; then
	AFLAGS="$AFLAGS -ffixed-r2"
    fi
elif [ $ARCH = "alpha" ] ; then
    AFLAGS="-mno-fp-regs"
    if [ $VERSION_CODE -ge `version 2 1 26` ] ; then
	AFLAGS="$AFLAGS -ffixed-8"
    fi
fi
echo "ARCH=$ARCH" >> $CONFIG_MK
echo "AFLAGS=$AFLAGS" >> $CONFIG_MK

if [ $ARCH = "ppc" ] ; then CONFIG_ISA=n ; else CONFIG_ISA=y ; fi
write_bool CONFIG_ISA

if [ $CONF_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
    fi
else
    MODVER="../$MODVER"
fi

if [ ! -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 1
fi

if [ "$CONFIG_SMP" = "y" ] ; then
    echo "#define __SMP__ 1" >> $CONFIG_H
fi

echo "" >> $CONFIG
echo "" >> $CONFIG_MK
echo "" >> $CONFIG_H

#=======================================================================

if [ $CONF_SRC -eq 1 ] ; then UTS_VERSION=`uname -v` ; fi

HAS_PROC_BUS=n
NEW_QLOGIC=n
echo "MFLAG=-DMODVERSIONS -include $MODVER" >> $CONFIG_MK

if [ $VERSION_CODE -ge `version 2 0 6` ] ; then
    NEW_QLOGIC=y
fi
if [ $VERSION_CODE -ge `version 2 1 31` -a \
     $VERSION_CODE -le `version 2 1 34` ] ; then
    echo "Kernel versions 2.1.31-33 are broken.  Upgrade to 2.1.34."
    exit 1
fi
if [ "$CONFIG_CARDBUS" = "y" -a \
     $VERSION_CODE -ge `version 2 1 90` ] ; then
    if [ $VERSION_CODE -lt `version 2 1 125` -o \
	 $VERSION_CODE -ge `version 2 1 132` ] ; then
	DO_APA1480=y
    fi
fi
if [ $VERSION_CODE -gt `version 2 1 104` ] ; then
    HAS_PROC_BUS=$CONFIG_PROC_FS
fi

UTS_RELEASE=$SRC_RELEASE
write_str UTS_RELEASE
write_str UTS_VERSION
echo "LINUX_VERSION_CODE=$VERSION_CODE" >> $CONFIG
echo "LINUX_VERSION_CODE=$VERSION_CODE" >> $CONFIG_MK
echo "#define LINUX_VERSION_CODE $VERSION_CODE" >> $CONFIG_H

echo "" >> $CONFIG
echo "" >> $CONFIG_MK
echo "" >> $CONFIG_H
echo ""

write_bool NEW_QLOGIC
write_bool HAS_PROC_BUS

if [ $VERSION_CODE -ge `version 2 1 7` -o \
     "$CONFIG_BLK_DEV_IDE_PCMCIA" = "y" ] ; then
    echo "DO_IDE=y" >> $CONFIG_MK
fi

if [ "$CONFIG_NET_RADIO" = "y" -a \
      -r ${LINUX}/include/linux/wireless.h ] ; then
    echo "#define HAS_WIRELESS_EXTENSIONS 1" >> $CONFIG_H
else
    echo "#undef  HAS_WIRELESS_EXTENSIONS" >> $CONFIG_H
fi

if [ "$CONFIG_SCSI" = "y" ] ; then
    if grep -q "define MODULE" ${LINUX}/drivers/scsi/aha152x.c ; then
	echo "# FIX_AHA152X is not defined" >> $CONFIG_MK
    else
	echo "FIX_AHA152X=y" >> $CONFIG_MK
    fi
    if [ "$DO_APA1480" = "y" ] ; then
	echo "DO_APA1480=y" >> $CONFIG_MK
	if grep -q ADAPTEC_1480A ${LINUX}/drivers/scsi/aic7xxx.c ; then
	    echo "# FIX_AIC7XXX is not defined" >> $CONFIG_MK
	else
	    echo "FIX_AIC7XXX=y" >> $CONFIG_MK
	fi
    fi
fi

if [ "$CONFIG_CARDBUS" = "y" ] ; then
    if grep -q CARDBUS ${LINUX}/drivers/net/tulip.c ; then
	echo DO_TULIP_CB=y >> $CONFIG_MK
    fi
    if grep -q CARDBUS ${LINUX}/drivers/net/epic100.c ; then
	echo DO_EPIC_CB=y >> $CONFIG_MK
    fi
fi

#=======================================================================

# Check out the module stuff

if [ ! -x /sbin/insmod -o ! -x /sbin/rmmod -o ! -x /sbin/lsmod ] ; 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 1
fi

MOD_RELEASE=`/sbin/insmod -V 2>&1 | \
    sed -n -e 's/.*[Vv]ersion \([0-9][0-9.]*\)/\1/p'`
echo "Your module utilities are version $MOD_RELEASE."
X=`echo $MOD_RELEASE | sed -e 's/\./ /g'`
MOD_CODE=`version $X`
if [ $VERSION_CODE -ge `version 2 1 85` ] ; then
    NEED=`version 2 1 85`
elif [ $VERSION_CODE -ge `version 2 1 18` ] ; then
    NEED=`version 2 1 23`
else
    NEED=`version 2 0 0`
fi

if [ $NEED -gt $MOD_CODE ] ; then
    echo "Your module utilities are too old for this kernel!"
    echo "    To fix, upgrade to at least version $NEED."
    exit 1
fi

#=======================================================================

# Is the boot setup OK?

if [ "$PREFIX" = "" ] ; then
    if [ -f /etc/lilo.conf -a -f /boot/map ] ; then
	if [ /vmlinuz -nt /boot/map ] ; then
	    echo "Your boot map file is older than /vmlinuz. "\
		 "If you installed /vmlinuz"
	    echo "by hand, please run 'lilo' to update your boot"\
		 "data, and then reboot."
#	else
#	    echo "Your 'lilo' installation appears to be OK."
	fi
    else
	echo "It doesn't look like you are using 'lilo'."
    fi
fi

#=======================================================================

# How should the startup scripts be configured?

echo ""

if [ "$PREFIX" = "" ] ; then
    if [ -d /etc/rc.d/init.d -o -d /etc/init.d -o -d /sbin/init.d ] ; then
	echo "It looks like you have a System V init file setup."
	SYSV_INIT=y
	if [ -d /etc/rc.d/init.d ] ; then
	    echo "RC_DIR=/etc/rc.d" >> $CONFIG
	    echo "RC_DIR=/etc/rc.d" >> $CONFIG_MK
	elif [ -d /sbin/init.d ] ; then
	    echo "RC_DIR=/sbin" >> $CONFIG
	    echo "RC_DIR=/sbin" >> $CONFIG_MK
	else
	    echo "RC_DIR=/etc" >> $CONFIG
	    echo "RC_DIR=/etc" >> $CONFIG_MK
	fi
    else
	echo "It looks like you have a BSD-ish init file setup."
	if ! grep -q rc.pcmcia /etc/rc.d/rc.S ; then
	    echo "    You'll need to edit /etc/rc.d/rc.S to invoke" \
		 "/etc/rc.d/rc.pcmcia"
	    echo "    so that PCMCIA services will start at boot time."
	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
write_bool INSTALL_DEPMOD

echo ""

#=======================================================================

# Optional stuff

HAS_FORMS=n
if [ -r /usr/include/X11/Xlib.h -o \
     -r /usr/X11R6/include/X11/Xlib.h ] ; then
    echo "X Windows include files found."
    for f in /usr/{X11/,X11R6/,local/,}lib/libforms.{so,a} ; do
	if [ -r $f ] ; then break ; fi
    done
    if [ -r $f ] ; then
	echo "$f found."
	HAS_FORMS=y
    else
	echo "Forms library not installed."
    fi
else
    echo "X Windows include files not installed."
fi

if [ "$HAS_FORMS" != "y" ] ; then
    echo "    If you want to build the 'cardinfo' PCMCIA control" \
         "panel, you need"
    echo "    to install the Forms Library, as well as the X Windows" \
	 "include files."
    echo "    See the HOWTO for details."
    HAS_FORMS=n
fi
write_bool HAS_FORMS

#=======================================================================

if [ ! -d /var/run ] ; then
    echo "WARNING: /var/run not found."
    echo "    To fix, do 'mkdir /var/run'."
fi

#=======================================================================

echo "" >> $CONFIG_H
echo "#endif /* _PCMCIA_CONFIG_H */" >> $CONFIG_H

mv $CONFIG config.out

touch .prereq.ok
