]> code.delx.au - gnu-emacs/commitdiff
Fix subtle problem with redirection in nt/configure.bat.
authorEli Zaretskii <eliz@gnu.org>
Mon, 28 May 2012 16:17:35 +0000 (19:17 +0300)
committerEli Zaretskii <eliz@gnu.org>
Mon, 28 May 2012 16:17:35 +0000 (19:17 +0300)
 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.

nt/ChangeLog
nt/configure.bat

index 15516c891cdb540054a41f188a6399287735caa4..245f6b578f1c5eb4f5de2052f5516e3024db6128 100644 (file)
@@ -1,3 +1,12 @@
+2012-05-28  Eli Zaretskii  <eliz@gnu.org>
+
+       * 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.
+
 2012-05-18  Eli Zaretskii  <eliz@gnu.org>
 
        * configure.bat: Ensure a space between %var% expansion and
index caee800bacf0eebd5edd97dc8db57d774aa19204..91c5c3fa0bbf15313a80ebec84c44b823d3e8eec 100755 (executable)
@@ -721,29 +721,36 @@ if %COMPILER% == gcc set MAKECMD=gmake
 if %COMPILER% == cl set MAKECMD=nmake\r
 \r
 rem   Pass on chosen settings to makefiles.\r
-rem   NB. Be very careful to not have a space before redirection symbols\r
-rem   except when there is a preceding digit, when a space is required.\r
 rem\r
+rem   The weird place we put the redirection is to make sure no extra\r
+rem   whitespace winds up at the end of the Make variables, since some\r
+rem   variables, e.g. INSTALL_DIR, cannot stand that.  Yes, echo will\r
+rem   write the blanks between the end of command arguments and the\r
+rem   redirection symbol to the file.  OTOH, we cannot put the\r
+rem   redirection immediately after the last character of the command,\r
+rem   because environment variable expansion can yield a digit there,\r
+rem   which will then be misinterpreted as the file descriptor to\r
+rem   redirect...\r
 echo # Start of settings from configure.bat >config.settings\r
-echo COMPILER=%COMPILER% >>config.settings\r
-if not "(%mf%)" == "()" echo MCPU_FLAG=%mf% >>config.settings\r
-if not "(%dbginfo%)" == "()" echo DEBUG_INFO=%dbginfo% >>config.settings\r
-if (%nodebug%) == (Y) echo NODEBUG=1 >>config.settings\r
-if (%noopt%) == (Y) echo NOOPT=1 >>config.settings\r
-if (%enablechecking%) == (Y) echo ENABLECHECKS=1 >>config.settings\r
-if (%profile%) == (Y) echo PROFILE=1 >>config.settings\r
-if (%nocygwin%) == (Y) echo NOCYGWIN=1 >>config.settings\r
-if not "(%prefix%)" == "()" echo INSTALL_DIR=%prefix% >>config.settings\r
-if not "(%distfiles%)" == "()" echo DIST_FILES=%distfiles% >>config.settings\r
+>>config.settings echo COMPILER=%COMPILER%\r
+if not "(%mf%)" == "()" >>config.settings echo MCPU_FLAG=%mf%\r
+if not "(%dbginfo%)" == "()" >>config.settings echo DEBUG_INFO=%dbginfo%\r
+if (%nodebug%) == (Y) >>config.settings echo NODEBUG=1\r
+if (%noopt%) == (Y) >>config.settings echo NOOPT=1\r
+if (%enablechecking%) == (Y) >>config.settings echo ENABLECHECKS=1\r
+if (%profile%) == (Y) >>config.settings echo PROFILE=1\r
+if (%nocygwin%) == (Y) >>config.settings echo NOCYGWIN=1\r
+if not "(%prefix%)" == "()" >>config.settings echo INSTALL_DIR=%prefix%\r
+if not "(%distfiles%)" == "()" >>config.settings echo DIST_FILES=%distfiles%\r
 rem We go thru docflags because usercflags could be "-DFOO=bar" -something\r
 rem and the if command cannot cope with this\r
 for %%v in (%usercflags%) do if not (%%v)==() set docflags=Y\r
-if (%docflags%)==(Y) echo USER_CFLAGS=%usercflags% >>config.settings\r
-if (%docflags%)==(Y) echo ESC_USER_CFLAGS=%escusercflags% >>config.settings\r
+if (%docflags%)==(Y) >>config.settings echo USER_CFLAGS=%usercflags%\r
+if (%docflags%)==(Y) >>config.settings echo ESC_USER_CFLAGS=%escusercflags%\r
 for %%v in (%userldflags%) do if not (%%v)==() set doldflags=Y\r
-if (%doldflags%)==(Y) echo USER_LDFLAGS=%userldflags% >>config.settings\r
+if (%doldflags%)==(Y) >>config.settings echo USER_LDFLAGS=%userldflags%\r
 for %%v in (%extrauserlibs%) do if not (%%v)==() set doextralibs=Y\r
-if (%doextralibs%)==(Y) echo USER_LIBS=%extrauserlibs% >>config.settings\r
+if (%doextralibs%)==(Y) >>config.settings echo USER_LIBS=%extrauserlibs%\r
 echo # End of settings from configure.bat>>config.settings\r
 echo. >>config.settings\r
 \r