all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Patch make configure.bat support --cflags and --ldflags options that include quotes
@ 2011-04-29  0:00 Ben Key
  2011-04-29  7:30 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Key @ 2011-04-29  0:00 UTC (permalink / raw)
  To: Emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 3192 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 4009 bytes --]

[-- Attachment #2: configure.bat.patch --]
[-- Type: application/octet-stream, Size: 2030 bytes --]

=== 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-29 17:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-29  0:00 Patch make configure.bat support --cflags and --ldflags options that include quotes Ben Key
2011-04-29  7:30 ` Eli Zaretskii
2011-04-29 15:11   ` Ben Key
2011-04-29 17:11     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.