all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ben Key <bkey76@gmail.com>
To: Emacs-devel@gnu.org
Subject: Patch make configure.bat support --cflags and --ldflags options that include quotes
Date: Thu, 28 Apr 2011 19:00:51 -0500	[thread overview]
Message-ID: <BANLkTinOKksoHp5-hL5RT59X5LJ_rW3zTg@mail.gmail.com> (raw)


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


             reply	other threads:[~2011-04-29  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29  0:00 Ben Key [this message]
2011-04-29  7:30 ` Patch make configure.bat support --cflags and --ldflags options that include quotes Eli Zaretskii
2011-04-29 15:11   ` Ben Key
2011-04-29 17:11     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTinOKksoHp5-hL5RT59X5LJ_rW3zTg@mail.gmail.com \
    --to=bkey76@gmail.com \
    --cc=Emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.