Index: /trunk/configure.cmd
===================================================================
--- /trunk/configure.cmd	(revision 988)
+++ /trunk/configure.cmd	(revision 989)
@@ -425,4 +425,30 @@
     --------------------------------------------------------------------------*/
 
+    /* a no-op to keep the help message close to the parsing code;
+     * it will be displayed via "signal ShowHelp" when needed */
+    if (0) then do
+    ShowHelp:
+        call SaySay,
+G.EOL||,
+"Usage: " filespec('N', G.ScriptFile) "[-h] [-release] [-debug] [-debug-and-release]"G.EOL||,
+"        [-developer-build]"G.EOL||,
+G.EOL||G.EOL||,
+"Configure options:"G.EOL||,
+G.EOL||,
+" The defaults (*) are usually acceptable. A plus (+) denotes a default value"G.EOL||,
+" that needs to be evaluated. If the evaluation succeeds, the feature is"G.EOL||,
+" included. Here is a short explanation of each option:"G.EOL||,
+G.EOL||,
+" *  -release ........... Compile and link Qt with debugging turned off."G.EOL||,
+"    -debug ............. Compile and link Qt with debugging turned on."G.EOL||,
+"    -debug-and-release . Compile and link two versions of Qt, with and without"G.EOL||,
+"                         debugging turned on (default in non-shadow builds)."G.EOL||,
+G.EOL||,
+"    -developer-build ... Compile and link Qt with Qt developer options"G.EOL||,
+"                         (including auto-tests exporting), implies -debug."G.EOL||,
+""
+        call Done 1
+    end
+
     if (aArgs \= "") then do
         call TokenizeString aArgs, 'G.Args'
@@ -431,43 +457,62 @@
             a = G.Args.i
             if (StartsWith(a, '-')) then do
-                a = strip(a, 'L', '-')
                 opt = ''
-                typ = 'P' /* path */
+                typ = ''
                 select
-                    when (a == "prefix") then
-                        opt = 'G.QT_INSTALL_PREFIX'
-                    when (a == "datadir") then
-                        opt = 'G.QT_INSTALL_DATA'
-                    when (a == "libdir") then
-                        opt = 'G.QT_INSTALL_LIBS'
-                    when (a == "headerdir") then
-                        opt = 'G.QT_INSTALL_HEADERS'
-                    when (a == "bindir") then
-                        opt = 'G.QT_INSTALL_BINS'
-                    when (a == "plugindir") then
-                        opt = 'G.QT_INSTALL_PLUGINS'
-                    when (a == "importdir") then
-                        opt = 'G.QT_INSTALL_IMPORTS'
-                    when (a == "demosdir") then
-                        opt = 'G.QT_INSTALL_DEMOS'
-                    when (a == "examplesdir") then
-                        opt = 'G.QT_INSTALL_EXAMPLES'
-                    when (a == "docdir") then
-                        opt = 'G.QT_INSTALL_DOCS'
-                    when (a == "translationdir") then
-                        opt = 'G.QT_INSTALL_TRANSLATIONS'
-                    when (a == "sysconfdir" | a == "settingsdir") then
-                        opt = 'G.QT_INSTALL_SETTINGS'
-                    when (a == "sysconffile") then
-                        opt = 'G.QT_INSTALL_SYSCONFFILE'
-                    otherwise typ = ''
+                    when (a == "-h" | a == "-help" | a == "--help") then
+                        opt = 'F G.OPT_HELP'
+
+                    when (a == "-release") then
+                        opt = 'F~ G.CFG_DEBUG'
+                    when (a == "-debug") then
+                        opt = 'F G.CFG_DEBUG'
+                    when (a == "-debug-and-release") then
+                        opt = 'F G.CFG_DEBUG_RELEASE'
+                    when (a == "-developer-build") then
+                        opt = 'F G.CFG_DEV'
+
+                    when (a == "-prefix") then
+                        opt = 'P G.QT_INSTALL_PREFIX'
+                    when (a == "-bindir") then
+                        opt = 'P G.QT_INSTALL_BINS'
+                    when (a == "-libdir") then
+                        opt = 'P G.QT_INSTALL_LIBS'
+                    when (a == "-docdir") then
+                        opt = 'P G.QT_INSTALL_DOCS'
+                    when (a == "-headerdir") then
+                        opt = 'P G.QT_INSTALL_HEADERS'
+                    when (a == "-plugindir") then
+                        opt = 'P G.QT_INSTALL_PLUGINS'
+                    when (a == "-importdir") then
+                        opt = 'P G.QT_INSTALL_IMPORTS'
+                    when (a == "-datadir") then
+                        opt = 'P G.QT_INSTALL_DATA'
+                    when (a == "-translationdir") then
+                        opt = 'P G.QT_INSTALL_TRANSLATIONS'
+                    when (a == "-sysconfdir" | a == "settingsdir") then
+                        opt = 'P G.QT_INSTALL_SETTINGS'
+                    when (a == "-examplesdir") then
+                        opt = 'P G.QT_INSTALL_EXAMPLES'
+                    when (a == "-demosdir") then
+                        opt = 'P G.QT_INSTALL_DEMOS'
+                    when (a == "-sysconffile") then
+                        opt = 'P G.QT_INSTALL_SYSCONFFILE'
+
+                    otherwise nop
                 end
-                if (typ == '') then do
+                parse var opt typ opt
+                if (opt == '' | typ == '') then do
                     call SayErr "ERROR: Invalid option '"G.Args.i"'."
                     call Done 1
                 end
+                if (StartsWith(typ, 'F')) then do
+                    /* option is a flag */
+                    if (EndsWith(typ, '~')) then call value opt, 'no'
+                    else call value opt, 'yes'
+                end
                 if (typ == 'P') then do
+                    /* argument is a path */
                     if (i == G.Args.0) then do
-                        call SayErr "ERROR: Option '"G.Args.i"' needs a path value."
+                        call SayErr "ERROR: Option '"G.Args.i"' needs a path."
                         call Done 1
                     end
@@ -626,15 +671,4 @@
             call CopyDir G.RelPath"\mkspecs\modules", G.OutPath"\mkspecs\modules"
             call DeleteDir G.OutPath"\mkspecs\default"
-
-/*@todo
-            # symlink the doc directory
-            rm -rf "$outpath/doc"
-            ln -s "$relpath/doc" "$outpath/doc"
-
-            # make sure q3porting.xml can be found
-            mkdir -p "$outpath/tools/porting/src"
-            rm -f "$outpath/tools/porting/src/q3porting.xml"
-            ln -s "$relpath/tools/porting/src/q3porting.xml" "$outpath/tools/porting/src"
-*/
         end
 
@@ -873,8 +907,7 @@
     --------------------------------------------------------------------------*/
 
-    /* next, emit a usage message if something failed. */
+    /* next, emit a usage message if requested. */
     if (G.OPT_HELP == "yes") then do
-        /* @todo */
-        call SayLog "TODO: Help message"
+        signal ShowHelp
     end
 
@@ -2550,5 +2583,5 @@
 SayVerbose: procedure expose (Globals)
     parse arg str, noeol
-    if (G.Verbose) then call SayLog str, noeol
+    if (G.Verbose & G.OPT_HELP \== "yes") then call SayLog str, noeol
     return
 
