Hello,
I am working on a patch that will configure.bat support --cflags and --ldflags options that include quotes. For example this patch makes it possible to configure Emacs as follows
configure.bat --without-png --without-jpeg --without-gif --without-tiff
--without-xpm --prefix=C:\emacs-24-test
--cflags=-I"C:/Program Files/GnuTLS-2.10.1/include"
--ldflags=-L"C:/Program Files/GnuTLS-2.10.1/lib" --lib gnutls --lib gcrypt
to build Emacs with GnuTLS support when the GnuTLS files are installed in ""C:/Program Files/GnuTLS-2.10.1."
This patch makes use of some more command extensions magic, as documented at http://stackoverflow.com/questions/562038/escaping-double-quotes-in-batch-script. I made the changes in such a way that configure.bat falls back to the old behavior if command extensions are not available.
The patch is as follows (it is also attached to this message).
<patch>
=== modified file 'nt/configure.bat'
--- nt/configure.bat 2011-04-25 01:29:31 +0000
+++ nt/configure.bat 2011-04-28 23:31:18 +0000
@@ -97,8 +97,10 @@
set nocygwin=N
set COMPILER=
set usercflags=
+set fusercflags=
set docflags=
set userldflags=
+set fuserldflags=
set extrauserlibs=
set doldflags=
set doextralibs=
@@ -238,6 +240,7 @@
:ucflagex
shift
set usercflags=%usercflags%%sep1%%~1
+set fusercflags=%usercflags:"=\"%
set sep1= %nothing%
shift
goto again
@@ -245,6 +248,7 @@
:ucflagne
shift
set usercflags=%usercflags%%sep1%%1
+set fusercflags=%usercflags%
set sep1= %nothing%
shift
goto again
@@ -266,6 +270,7 @@
:ulflagex
shift
set userldflags=%userldflags%%sep2%%~1
+set fuserldflags=%userldflags:"=\"%
set sep2= %nothing%
shift
goto again
@@ -273,6 +278,7 @@
:ulflagne
shift
set userldflags=%userldflags%%sep2%%1
+set fuserldflags=%userldflags%
set sep2= %nothing%
shift
goto again
@@ -437,7 +443,7 @@
:chkuser
rm -f junk.o
echo int main (int argc, char *argv[]) {>junk.c
-echo char *usercflags = "%usercflags%";>>junk.c
+echo char *usercflags = "%fusercflags%";>>junk.c
echo }>>junk.c
echo gcc -Werror -c junk.c >>config.log
gcc -Werror -c junk.c >>config.log 2>&1
@@ -745,8 +751,8 @@
echo /* Start of settings from configure.bat. */ >>config.tmp
rem We write USER_CFLAGS and USER_LDFLAGS starting with a space to simplify
rem processing of compiler options in w32.c:get_emacs_configuration_options
-if (%docflags%) == (Y) echo #define USER_CFLAGS " %usercflags%">>config.tmp
-if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %userldflags%">>config.tmp
+if (%docflags%) == (Y) echo #define USER_CFLAGS " %fusercflags%">>config.tmp
+if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %fuserldflags%">>config.tmp
if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp
if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp
if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp
</patch>
This patch is just a logical extension of an earlier change I made to allow support for --cflags and --ldflags options in the form of -DFOO=BAR as long as they are enclosed in quotes.
I will commit this patch, along with an appropriate update to nt/INSTALL in the next day or so unless someone objects.