emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113972: * configure.ac (EMACS_CONFIG_OPTIONS): Quot


From: Paul Eggert
Subject: [Emacs-diffs] trunk r113972: * configure.ac (EMACS_CONFIG_OPTIONS): Quote systematically.
Date: Thu, 22 Aug 2013 17:35:07 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113972
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/13274
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2013-08-22 10:35:00 -0700
message:
  * configure.ac (EMACS_CONFIG_OPTIONS): Quote systematically.
  
  This improves on the patch already installed, by quoting options
  that contain spaces and suchlike systematically, so that
  EMACS_CONFIG_OPTIONS is no longer ambiguous when options contain
  these characters.
modified:
  ChangeLog                      changelog-20091113204419-o5vbwnq5f7feedwu-1538
  configure.ac                   
configure.in-20091113204419-o5vbwnq5f7feedwu-783
=== modified file 'ChangeLog'
--- a/ChangeLog 2013-08-21 06:11:50 +0000
+++ b/ChangeLog 2013-08-22 17:35:00 +0000
@@ -1,3 +1,11 @@
+2013-08-22  Paul Eggert  <address@hidden>
+
+       * configure.ac (EMACS_CONFIG_OPTIONS): Quote systematically (Bug#13274).
+       This improves on the patch already installed, by quoting options
+       that contain spaces and suchlike systematically, so that
+       EMACS_CONFIG_OPTIONS is no longer ambiguous when options contain
+       these characters.
+
 2013-08-21  Paul Eggert  <address@hidden>
 
        Port close-on-exec pty creation to FreeBSD 9.1-RELEASE (Bug#15129).

=== modified file 'configure.ac'
--- a/configure.ac      2013-08-21 06:11:50 +0000
+++ b/configure.ac      2013-08-22 17:35:00 +0000
@@ -24,18 +24,43 @@
 AC_PREREQ(2.65)
 AC_INIT(emacs, 24.3.50)
 
+dnl Set emacs_config_options to the options of 'configure', quoted for the 
shell,
+dnl and then quoted again for a C string.  Separate options with spaces.
+dnl Add some environment variables, if they were passed via the environment
+dnl rather than on the command-line.
+emacs_config_options=
+optsep=
 dnl This is the documented way to record the args passed to configure,
 dnl rather than $ac_configure_args.
-emacs_config_options="$@"
-## Add some environment variables, if they were passed via the environment
-## rather than on the command-line.
-for var in CFLAGS CPPFLAGS LDFLAGS; do
-    case "$emacs_config_options" in
-      *$var=*) continue ;;
-    esac
-    eval val="\$${var}"
-    test x"$val" = x && continue
-    emacs_config_options="${emacs_config_options}${emacs_config_options:+ 
}$var=\"$val\""
+for opt in ${1+"$@"} CFLAGS CPPFLAGS LDFLAGS; do
+  case $opt in
+    -n | --no-create | --no-recursion)
+      continue ;;
+    CFLAGS | CPPFLAGS | LDFLAGS)
+      eval 'test "${'$opt'+set}" = set' || continue
+      case " $*" in
+       *" $opt="*) continue ;;
+      esac
+      eval opt=$opt=\$$opt ;;
+  esac
+
+  emacs_shell_specials=$IFS\''"#$&()*;<>?@<:@\\`{|~'
+  case $opt in
+    *[["$emacs_shell_specials"]]*)
+      case $opt in
+       *\'*)
+         emacs_quote_apostrophes="s/'/'\\\\''/g"
+         opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_apostrophes"` ;;
+      esac
+      opt="'$opt'"
+      case $opt in
+       *[['"\\']]*)
+         emacs_quote_for_c='s/[["\\]]/\\&/g; $!s/$/\\n\\/'
+         opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_for_c"` ;;
+      esac ;;
+  esac
+  AS_VAR_APPEND([emacs_config_options], ["$optsep$opt"])
+  optsep=' '
 done
 
 AC_CONFIG_HEADER(src/config.h:src/config.in)
@@ -4440,8 +4465,6 @@
 
 AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION,  "${canonical}",
                   [Define to the canonical Emacs configuration name.])
-dnl Replace any embedded " characters (bug#13274).
-emacs_config_options=`echo "$emacs_config_options " | sed -e 's/--no-create 
//' -e 's/--no-recursion //' -e 's/ *$//' -e "s/\"/'/g" -e 's/\\\\/\\\\\\\\/g'`
 AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}",
                   [Define to the options passed to configure.])
 AH_TEMPLATE(config_opsysfile, [Some platforms that do not use configure


reply via email to

[Prev in Thread] Current Thread [Next in Thread]