#!/bin/sh

TTYPE="identifier";
IDENTIFIER="";
DESCRIPTION="";
LINK_IN="no";
LINK_OBJS="";
DEFAULT="";
CFALLDEPEND='$CONFIG_KGI_WD';
CFDEPEND=$CFALLDEPEND;
CHECKLIST='dialog --title " Select chipset driver options " --checklist "  Please choose the chipsets/features the driver shall support " 21 60 10 '
NEW_CFGIN='
# Do not edit this -- edit .configure and automatically generate by 
# running "make Config.h"
';

for TOKEN in \
o "PVGA1A" "Western Digital/Paradise/AST VGA Plus" on \
o "WD90C00" "Western Digital PVGA1B (wd90c00)" on \
o "WD90C1X" "Western Digital wd90c1x Series" on \
o "WD90C2X" "Western Digital wd90c2x (LCD) Series" on \
o + "WD90C2X_LCD" "wd90c2x LCD Support" on \
- \
o "WD90C3X" "Western Digital wd90c3x Series" on 
do 
if [ $TTYPE = "default" ] ; then 
    TTYPE=loopskip ;
    DEFAULT="$TOKEN" ;
    if [ -f .options ] ; then 
	grep -q -v \"$IDENTIFIER\" .options && DEFAULT=off ;
    fi;
    if [ -f .options ] ; then 
	grep -q \"$IDENTIFIER\" .options && DEFAULT=on ;
    fi;
    CHECKLIST="$CHECKLIST\"$IDENTIFIER\" \"$DESCRIPTION\" $DEFAULT " ;
    NEW_CFGIN="$NEW_CFGIN dep_tristate \"$DESCRIPTION\" CONFIG_KGI_$IDENTIFIER $CFDEPEND; " ;
fi ; 
if [ "$TTYPE" = "description" ] ; then 
    TTYPE="default" ; 
    DESCRIPTION="$TOKEN";
fi ; 
if [ "$TTYPE" = "identifier" ] ; then 
    if [ "$TOKEN" = 'o' ] ; then LINK_IN=yes ; 
    elif [ "$TOKEN" = '+' ] ; then 
	CFDEPEND="\$CONFIG_KGI_$IDENTIFIER" ;
	NEW_CFGIN="$NEW_CFGIN if [ \$CONFIG_KGI_$IDENTIFIER = "y" ]  ; then "; 
    elif [ "$TOKEN" = '-' ] ; then 
	NEW_CFGIN="$NEW_CFGIN fi ; "; 
    else 
	TTYPE="description" ; 
        IDENTIFIER="$TOKEN";
	if [ "$LINK_IN" = "yes" ] ; then 
	    LINK_IN="no";
	    LINK_OBJS="$LINK_OBJS $IDENTIFIER";
	fi;
    fi;
fi ; 
if [ "$TTYPE" = "loopskip" ] ; then 
    TTYPE="identifier" ; 
    echo -n ; 
fi ; 

done

# Uncomment to give a chance to read errors
# read

# This builds a configuration section for the Linux kernel configuration
echo "$NEW_CFGIN" > Config.in;

if [ ! "$1" = "NEW_CFGIN_ONLY" ] ; then 
    mv .options .options.bak ;
    eval $CHECKLIST 2> .options || cp .options.bak .options;
    echo "$LINK_OBJS" > .objects ;
fi


