From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ben Key Newsgroups: gmane.emacs.devel Subject: Patch make configure.bat support --cflags and --ldflags options that include quotes Date: Thu, 28 Apr 2011 19:00:51 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=0016e6db2e401d779904a2035f54 X-Trace: dough.gmane.org 1304035283 8223 80.91.229.12 (29 Apr 2011 00:01:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 29 Apr 2011 00:01:23 +0000 (UTC) To: Emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 29 02:01:18 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QFb94-0003Hq-1n for ged-emacs-devel@m.gmane.org; Fri, 29 Apr 2011 02:01:18 +0200 Original-Received: from localhost ([::1]:58221 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFb93-0006lW-9C for ged-emacs-devel@m.gmane.org; Thu, 28 Apr 2011 20:01:17 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:36370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFb8z-0006lR-Sx for Emacs-devel@gnu.org; Thu, 28 Apr 2011 20:01:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFb8y-0000GI-F0 for Emacs-devel@gnu.org; Thu, 28 Apr 2011 20:01:13 -0400 Original-Received: from mail-bw0-f41.google.com ([209.85.214.41]:62391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFb8y-0000G8-5X for Emacs-devel@gnu.org; Thu, 28 Apr 2011 20:01:12 -0400 Original-Received: by bwz17 with SMTP id 17so3445684bwz.0 for ; Thu, 28 Apr 2011 17:01:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=fw9iL/2GfImQ2K51PrstiyI0W3duC4AeXKmx3RojRFY=; b=E/SZv6qosI48CgD+nhc8OBILTZlK6mjxv6oxLBp0MHWr07wwifQM0/pUFk/1BghPzi 6akndSzThtdNEbseXeC0ju7nbn3WR+azgL0HwM1BTQP6PGNDdjqN2wkZVOnJyc8YBmiW GCa8WyuA5kmsMNbRNHjo5vf/AUF1XD/M+7wSg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=i2gQ70Koun9VN4hEvNJHzRHHcQhbb064fxquQ7xNnOZDK0+1L+c8W/gExJIKJITEGT DQk9xhCcP4rjhldGv5zsLdb5bb2JyM8UHAbxvkkjzIUrQyDJjFUPQG3pbkUnt/1aspsR g/CWBYc739aCsEoESEmXAbJ6dtTKtYfMJb3Zk= Original-Received: by 10.204.75.22 with SMTP id w22mr4075324bkj.65.1304035271210; Thu, 28 Apr 2011 17:01:11 -0700 (PDT) Original-Received: by 10.204.126.85 with HTTP; Thu, 28 Apr 2011 17:00:51 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.214.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138882 Archived-At: --0016e6db2e401d779904a2035f54 Content-Type: multipart/alternative; boundary=0016e6db2e401d778c04a2035f52 --0016e6db2e401d778c04a2035f52 Content-Type: text/plain; charset=ISO-8859-1 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). === 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 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. --0016e6db2e401d778c04a2035f52 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello,

I am working on a patch that will configure.= bat support --cflags and --ldflags options that include quotes.=A0 For exam= ple this patch makes it possible to configure Emacs as follows

confi= gure.bat --without-png --without-jpeg --without-gif --without-tiff
=A0--without-xpm --prefix=3DC:\emacs-24-test
=A0--cflags=3D-I"C:/Pr= ogram Files/GnuTLS-2.10.1/include"
=A0--ldflags=3D-L"C:/Progra= m Files/GnuTLS-2.10.1/lib" --lib gnutls --lib gcrypt

to build E= macs 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 document= ed at http://stackoverflow.com/questions/562038/escaping-= double-quotes-in-batch-script.=A0 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).

&= lt;patch>
=3D=3D=3D modified file 'nt/configure.= bat'
--- nt/configure.bat=A0=A0=A0 2011-04-25 01:29:31 +0000
+++ = nt/configure.bat=A0=A0=A0 2011-04-28 23:31:18 +0000
@@ -97,8 +97,10 @@
=A0set nocygwin=3DN
=A0set COMPILER=3D
=A0set u= sercflags=3D
+set fusercflags=3D
=A0set docflags=3D
=A0set userldf= lags=3D
+set fuserldflags=3D
=A0set extrauserlibs=3D
=A0set doldfl= ags=3D
=A0set doextralibs=3D
@@ -238,6 +240,7 @@
=A0:ucflagex
=A0shift
=A0set usercflags=3D%use= rcflags%%sep1%%~1
+set fusercflags=3D%usercflags:"=3D\"%
= =A0set sep1=3D %nothing%
=A0shift
=A0goto again
@@ -245,6 +248,7 @= @
=A0:ucflagne
=A0shift
=A0set usercflags=3D%usercflags%%sep1%%1
+set fusercflags=3D= %usercflags%
=A0set sep1=3D %nothing%
=A0shift
=A0goto again
@@= -266,6 +270,7 @@
=A0:ulflagex
=A0shift
=A0set userldflags=3D%user= ldflags%%sep2%%~1
+set fuserldflags=3D%userldflags:"=3D\"%
=A0set sep2=3D %nothi= ng%
=A0shift
=A0goto again
@@ -273,6 +278,7 @@
=A0:ulflagne
= =A0shift
=A0set userldflags=3D%userldflags%%sep2%%1
+set fuserldflags= =3D%userldflags%
=A0set sep2=3D %nothing%
=A0shift
=A0goto again
@@ -437,7 +443,7 @= @
=A0:chkuser
=A0rm -f junk.o
=A0echo int main (int argc, char *ar= gv[]) {>junk.c
-echo char *usercflags =3D "%usercflags%";&g= t;>junk.c
+echo char *usercflags =3D "%fusercflags%";>>junk.c
=A0e= cho }>>junk.c
=A0echo gcc -Werror -c junk.c >>config.log
= =A0gcc -Werror -c junk.c >>config.log 2>&1
@@ -745,8 +751,8= @@
=A0echo /* Start of settings from configure.bat.=A0 */ >>config.tmp=A0rem=A0=A0 We write USER_CFLAGS and USER_LDFLAGS starting with a space = to simplify
=A0rem=A0=A0 processing of compiler options in w32.c:get_ema= cs_configuration_options
-if (%docflags%) =3D=3D (Y) echo #define USER_CFLAGS " %usercflags%&qu= ot;>>config.tmp
-if (%doldflags%) =3D=3D (Y) echo #define USER_LDF= LAGS " %userldflags%">>config.tmp
+if (%docflags%) =3D= =3D (Y) echo #define USER_CFLAGS " %fusercflags%">>config.t= mp
+if (%doldflags%) =3D=3D (Y) echo #define USER_LDFLAGS " %fuserldflags= %">>config.tmp
=A0if (%profile%) =3D=3D (Y) echo #define PROF= ILING 1 >>config.tmp
=A0if not "(%HAVE_PNG%)" =3D=3D &qu= ot;()" echo #define HAVE_PNG 1 >>config.tmp
=A0if not "(%HAVE_GNUTLS%)" =3D=3D "()" echo #define HA= VE_GNUTLS 1 >>config.tmp

</patch>

This pat= ch is just a logical extension of an earlier change I made to allow support= for --cflags and
--ldflags options in the form of = -DFOO=3DBAR as long as they are enclosed in quotes.

I will commit this patch, along with an appropr= iate update to nt/INSTALL in the next day or so unless someone objects.
=
--0016e6db2e401d778c04a2035f52-- --0016e6db2e401d779904a2035f54 Content-Type: application/octet-stream; name="configure.bat.patch" Content-Disposition: attachment; filename="configure.bat.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gn2cn07c0 PT09IG1vZGlmaWVkIGZpbGUgJ250L2NvbmZpZ3VyZS5iYXQnCi0tLSBudC9jb25maWd1cmUuYmF0 CTIwMTEtMDQtMjUgMDE6Mjk6MzEgKzAwMDAKKysrIG50L2NvbmZpZ3VyZS5iYXQJMjAxMS0wNC0y OCAyMzozMToxOCArMDAwMApAQCAtOTcsOCArOTcsMTAgQEAKIHNldCBub2N5Z3dpbj1ODQogc2V0 IENPTVBJTEVSPQ0KIHNldCB1c2VyY2ZsYWdzPQ0KK3NldCBmdXNlcmNmbGFncz0NCiBzZXQgZG9j ZmxhZ3M9DQogc2V0IHVzZXJsZGZsYWdzPQ0KK3NldCBmdXNlcmxkZmxhZ3M9DQogc2V0IGV4dHJh dXNlcmxpYnM9DQogc2V0IGRvbGRmbGFncz0NCiBzZXQgZG9leHRyYWxpYnM9DQpAQCAtMjM4LDYg KzI0MCw3IEBACiA6dWNmbGFnZXgNCiBzaGlmdA0KIHNldCB1c2VyY2ZsYWdzPSV1c2VyY2ZsYWdz JSVzZXAxJSV+MQ0KK3NldCBmdXNlcmNmbGFncz0ldXNlc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