From 4a1a6b5b7d2208cf504cf38e548d3c562f6cfbb3 Mon Sep 17 00:00:00 2001 From: Ben Key Date: Fri, 15 Apr 2011 17:48:00 -0500 Subject: [PATCH] Modified the code that parses the --cflags and --ldflags options to support parameters that include the = character as long as they are enclosed in quotes. --- nt/ChangeLog | 14 ++++++++++++++ nt/INSTALL | 24 +++++++++++++++++------- nt/configure.bat | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 7 deletions(-) diff --git a/nt/ChangeLog b/nt/ChangeLog index 155ee41d9da..19f71ba0af3 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,17 @@ +2011-04-15 Ben Key + + * configure.bat: Modified the code that parses the --cflags and + --ldflags options to support parameters that include the = + character as long as they are enclosed in quotes. This + functionality depends on command extensions. Configure.bat now + attempts to enable command extensions and displays a warning + message if they could not be enabled. If configure.bat could + not enable command extensions the old parsing code is used that + does not support parameters that include the = character. + + * INSTALL: Updated the file to describe the new functionality + using text provided by Eli Zaretskii. + 2011-04-06 Eli Zaretskii * config.nt (NO_INLINE, ATTRIBUTE_FORMAT) diff --git a/nt/INSTALL b/nt/INSTALL index a0ca4a1ebb5..dfcfa8a205a 100644 --- a/nt/INSTALL +++ b/nt/INSTALL @@ -220,13 +220,23 @@ absolutely sure the produced binaries will never need to be run under a debugger. - Because of limitations of the stock Windows command shell, certain - characters (quotes, backslashes and equal signs) can be problematic - and should not be used in arguments to configure. That means that - forward slashes must be used in paths passed to the compiler and - linker via the --cflags and --ldflags options, and that it is - currently not possible to pass a macro like -DFOO=BAR (though -DFOO - is perfectly valid). + Because of limitations of the stock Windows command shells, special + care is needed to pass some characters in the arguments of the + --cflags and --ldflags options. Backslashes should not be used in + file names passed to the compiler and linker via these options. Use + forward slashes instead. If the arguments to these two options + include the `=' character, like when passing a -DFOO=bar preprocessor + option, the argument with the `=' character should be enclosed in + quotes, like this: + + configure --cflags "-DFOO=bar" + + Support for options that include the `=' character require "command + extensions" to be enabled. (They are enabled by default, but your + system administrator could have changed that. See "cmd /?" for + details.) If command extensions are disabled, a warning message might + be displayed informing you that "using parameters that include the = + character by enclosing them in quotes will not be supported." N.B. It is normal to see a few error messages output while configure is running, when gcc support is being tested. These cannot be diff --git a/nt/configure.bat b/nt/configure.bat index 1450650304d..699a33bc2eb 100755 --- a/nt/configure.bat +++ b/nt/configure.bat @@ -74,6 +74,19 @@ echo You must run configure from the nt subdirectory. goto end :start +rem ---------------------------------------------------------------------- +rem Attempt to enable command extensions. Set use_extensions to 1 if +rem they are available and 0 if they are not available. +set use_extensions=1 +setlocal ENABLEEXTENSIONS +if "%CMDEXTVERSION%" == "" set use_extensions=0 +if "%use_extensions%" == "1" goto afterext + +echo. Command extensions are not available. Using parameters that include the = +echo. character by enclosing them in quotes will not be supported. + +:afterext + rem ---------------------------------------------------------------------- rem Default settings. set prefix= @@ -136,6 +149,20 @@ echo. --without-tiff do not use TIFF library even if it is installed echo. --without-xpm do not use XPM library even if it is installed echo. --with-svg use the RSVG library (experimental) echo. --distfiles path to files for make dist, e.g. libXpm.dll +if "%use_extensions%" == "0" goto end +echo. +echo. The cflags and ldflags arguments support parameters that include the = +echo. character. However, since the = character is normally treated as a +echo. separator character you will need to enclose any parameter that includes +echo. the = character in quotes. For example, to include +echo. -DSITELOAD_PURESIZE_EXTRA=100000 as one of the cflags you would run +echo. configure.bat as follows: +echo. configure.bat --cflags "-DSITELOAD_PURESIZE_EXTRA=100000" +echo. +echo. Note that this capability of processing parameters that include the = +echo. character depends on command extensions. This batch file attempts to +echo. enable command extensions. If command extensions cannot be enabled, a +echo. warning message will be displayed. goto end rem ---------------------------------------------------------------------- @@ -198,6 +225,17 @@ goto again rem ---------------------------------------------------------------------- :usercflags +if "%use_extensions%" == "1" goto ucflagex +goto ucflagne + +:ucflagex +shift +set usercflags=%usercflags%%sep1%%~1 +set sep1= %nothing% +shift +goto again + +:ucflagne shift set usercflags=%usercflags%%sep1%%1 set sep1= %nothing% @@ -207,6 +245,17 @@ goto again rem ---------------------------------------------------------------------- :userldflags +if "%use_extensions%" == "1" goto ulflagex +goto ulflagne + +:ulflagex +shift +set userldflags=%userldflags%%sep2%%~1 +set sep2= %nothing% +shift +goto again + +:ulflagne shift set userldflags=%userldflags%%sep2%%1 set sep2= %nothing% -- 2.39.2