Index: tools/build
===================================================================
--- tools/build	(revision 090e7ea1fe8a56e570814939a40c95420d986405)
+++ tools/build	(revision 9371c301116efcd366e21f4bc55ae2528b3fbbec)
@@ -3,46 +3,11 @@
 function syntax {
 	echo "Syntax:"
-	echo " build.<arch> [-compiler <compiler>] [-cpu <cpu>] [-machine <machine>]"
-	echo
-	echo "<arch>     ... amd64, ia32, ia64, mips32, ppc32, sparc64"
-	echo "<compiler> ... native, *cross"
-	echo "<cpu>      ... for ia32: athlon-xp, athlon-mp, pentium3, *pentium4, prescott"
-	echo "<machine>  ... for mips32: *msim, msim4kc, simics, lgxemul, bgxemul, indy"
+	echo " build "
 	echo
 }
-
-ARCH="`basename "$0" | awk -F. '{ if (NF > 1) print \$NF }'`"
-if [ -z "$ARCH" ]; then
-	syntax
-	exit 1
-fi
 
 ARGS=""
 while [ "$#" -gt 0 ]; do
 	case "$1" in
-		-compiler)
-			if [ -z "$2" ]; then
-				syntax
-				exit 1
-			fi
-			ARGS="$ARGS COMPILER=$2"
-			shift
-			;;
-		-cpu)
-			if [ -z "$2" ]; then
-				syntax
-				exit 1
-			fi
-			ARGS="$ARGS CPU=$2"
-			shift
-			;;
-		-machine)
-			if [ -z "$2" ]; then
-				syntax
-				exit 1
-			fi
-			ARGS="$ARGS MACHINE=$2"
-			shift
-			;;
 		*)
 			syntax
@@ -61,4 +26,4 @@
 fi
 
-tools/config.py $ARCH default
-make all "ARCH=$ARCH" "TAG=$TAG" $ARGS
+tools/config.py default
+make all "TAG=$TAG" $ARGS
Index: tools/config.py
===================================================================
--- tools/config.py	(revision 090e7ea1fe8a56e570814939a40c95420d986405)
+++ tools/config.py	(revision 9371c301116efcd366e21f4bc55ae2528b3fbbec)
@@ -187,16 +187,34 @@
 
 def check_condition(text, defaults):
-    "Check that the condition specified on input line is True"
-    result = False
+    result = True
+    conds = text.split('&')
+    for cond in conds:
+        if cond.startswith('(') and cond.endswith(')'):
+            cond = cond[1:-1]
+        if not check_dnf(cond, defaults):
+            return False
+    return True
+
+def check_dnf(text, defaults):
+    """
+    Check that the condition specified on input line is True
+
+    only CNF is supported
+    """
     conds = text.split('|')
     for cond in conds:
-        condname,condval = cond.split('=')
+        res = re.match(r'^(.*?)(!?=)(.*)$', cond)
+        if not res:
+            raise RuntimeError("Invalid condition: %s" % cond)
+        condname = res.group(1)
+        oper = res.group(2)
+        condval = res.group(3)
         if not defaults.has_key(condname):
             raise RuntimeError("Condition var %s does not exist: %s" % \
-                               (condname,line))
-        # None means wildcard
-        if defaults[condname] is None:
+                               (condname,text))
+
+        if oper=='=' and  condval == defaults[condname]:
             return True
-        if  condval == defaults[condname]:
+        if oper == '!=' and condval != defaults[condname]:
             return True
     return False
@@ -214,5 +232,26 @@
     default = None
     choices = []
-    for line in f:        
+    for line in f:
+        if line.startswith('%'):
+            res = re.match(r'^%\s*(?:\[(.*?)\])?\s*(.*)$', line)
+            if not res:
+                raise RuntimeError('Invalid command: %s' % line)
+            if res.group(1):
+                if not check_condition(res.group(1), defaults):
+                    continue
+            args = res.group(2).strip().split(' ')
+            cmd = args[0].lower()
+            args = args[1:]
+            if cmd == 'askdefault':
+                if isinstance(dlg, DefaultDialog):
+                    continue
+                res = dlg.noyes('Change kernel configuration')
+                if res == 'n':
+                    dlg = DefaultDialog(dlg)
+            elif cmd == 'saveas':
+                outf.write('%s = %s\n' % (args[1],defaults[args[0]]))
+                
+            continue
+            
         if line.startswith('!'):
             # Ask a question
@@ -229,4 +268,8 @@
                     if default is not None:
                         outf.write('#!# %s = %s\n' % (varname, default))
+                    # Clear cumulated values
+                    comment = ''
+                    default = None
+                    choices = []
                     continue
 
@@ -278,5 +321,5 @@
 
 def main():
-    defaults = {'ARCH':None}
+    defaults = {}
     try:
         dlg = Dialog()
@@ -286,7 +329,5 @@
     # Default run will update the configuration file
     # with newest options
-    if len(sys.argv) >= 2:
-        defaults['ARCH'] = sys.argv[1]
-    if len(sys.argv) == 3 and sys.argv[2]=='default':
+    if len(sys.argv) == 2 and sys.argv[1]=='default':
         dlg = DefaultDialog(dlg)
 
