summaryrefslogtreecommitdiff
path: root/nt/configure.bat
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2012-05-28 19:17:35 +0300
committerEli Zaretskii <eliz@gnu.org>2012-05-28 19:17:35 +0300
commite383e32d7a00bf286db1dc6b05b6219f0eaab8dc (patch)
tree6fa3e4d1e1be554159b0819687701b7e27a9dfd5 /nt/configure.bat
parent5221ccb96e8dde4c0c3164f9517aa7b54e539d0d (diff)
downloademacs-e383e32d7a00bf286db1dc6b05b6219f0eaab8dc.tar.gz
Fix subtle problem with redirection in nt/configure.bat.
nt/configure.bat (genmakefiles): Move the redirection away from the end of the command, to avoid excess whitespace at the end of Make variables created at configure time, and also avoid things like "FOO1>>config.settings", where "1" gets interpreted as the file descriptor and eaten up. This fixes breakage introduced by the last change, without reintroducing the bug fixed by that change.
Diffstat (limited to 'nt/configure.bat')
-rwxr-xr-xnt/configure.bat39
1 files changed, 23 insertions, 16 deletions
diff --git a/nt/configure.bat b/nt/configure.bat
index caee800bacf..91c5c3fa0bb 100755
--- a/nt/configure.bat
+++ b/nt/configure.bat
@@ -721,29 +721,36 @@ if %COMPILER% == gcc set MAKECMD=gmake
if %COMPILER% == cl set MAKECMD=nmake
rem Pass on chosen settings to makefiles.
-rem NB. Be very careful to not have a space before redirection symbols
-rem except when there is a preceding digit, when a space is required.
rem
+rem The weird place we put the redirection is to make sure no extra
+rem whitespace winds up at the end of the Make variables, since some
+rem variables, e.g. INSTALL_DIR, cannot stand that. Yes, echo will
+rem write the blanks between the end of command arguments and the
+rem redirection symbol to the file. OTOH, we cannot put the
+rem redirection immediately after the last character of the command,
+rem because environment variable expansion can yield a digit there,
+rem which will then be misinterpreted as the file descriptor to
+rem redirect...
echo # Start of settings from configure.bat >config.settings
-echo COMPILER=%COMPILER% >>config.settings
-if not "(%mf%)" == "()" echo MCPU_FLAG=%mf% >>config.settings
-if not "(%dbginfo%)" == "()" echo DEBUG_INFO=%dbginfo% >>config.settings
-if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings
-if (%noopt%) == (Y) echo NOOPT=1 >>config.settings
-if (%enablechecking%) == (Y) echo ENABLECHECKS=1 >>config.settings
-if (%profile%) == (Y) echo PROFILE=1 >>config.settings
-if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings
-if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix% >>config.settings
-if not "(%distfiles%)" == "()" echo DIST_FILES=%distfiles% >>config.settings
+>>config.settings echo COMPILER=%COMPILER%
+if not "(%mf%)" == "()" >>config.settings echo MCPU_FLAG=%mf%
+if not "(%dbginfo%)" == "()" >>config.settings echo DEBUG_INFO=%dbginfo%
+if (%nodebug%) == (Y) >>config.settings echo NODEBUG=1
+if (%noopt%) == (Y) >>config.settings echo NOOPT=1
+if (%enablechecking%) == (Y) >>config.settings echo ENABLECHECKS=1
+if (%profile%) == (Y) >>config.settings echo PROFILE=1
+if (%nocygwin%) == (Y) >>config.settings echo NOCYGWIN=1
+if not "(%prefix%)" == "()" >>config.settings echo INSTALL_DIR=%prefix%
+if not "(%distfiles%)" == "()" >>config.settings echo DIST_FILES=%distfiles%
rem We go thru docflags because usercflags could be "-DFOO=bar" -something
rem and the if command cannot cope with this
for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y
-if (%docflags%)==(Y) echo USER_CFLAGS=%usercflags% >>config.settings
-if (%docflags%)==(Y) echo ESC_USER_CFLAGS=%escusercflags% >>config.settings
+if (%docflags%)==(Y) >>config.settings echo USER_CFLAGS=%usercflags%
+if (%docflags%)==(Y) >>config.settings echo ESC_USER_CFLAGS=%escusercflags%
for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y
-if (%doldflags%)==(Y) echo USER_LDFLAGS=%userldflags% >>config.settings
+if (%doldflags%)==(Y) >>config.settings echo USER_LDFLAGS=%userldflags%
for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y
-if (%doextralibs%)==(Y) echo USER_LIBS=%extrauserlibs% >>config.settings
+if (%doextralibs%)==(Y) >>config.settings echo USER_LIBS=%extrauserlibs%
echo # End of settings from configure.bat>>config.settings
echo. >>config.settings