From: Eric Blake Date: Fri, 5 Oct 2007 17:26:26 +0000 (-0600) Subject: Resolve Python issue 1676135 regarding configure directory args. X-Git-Tag: v2.62~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35b65ec05c4e8f667c08ea4b47cb2c6bd9a5b7cb;p=thirdparty%2Fautoconf.git Resolve Python issue 1676135 regarding configure directory args. * lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Strip trailing slashes from directory arguments. * tests/base.at (configure directories): New test. * doc/autoconf.texi (Installation Directory Variables): Document the change. * NEWS: Likewise. * THANKS: Update. Reported by Björn Lindqvist. http://bugs.python.org/issue1676135 Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 57dfbb5a..e5e01c27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2007-10-05 Eric Blake + Resolve Python issue 1676135 regarding configure directory args. + * lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Strip trailing + slashes from directory arguments. + * tests/base.at (configure directories): New test. + * doc/autoconf.texi (Installation Directory Variables): Document + the change. + * NEWS: Likewise. + * THANKS: Update. + Reported by Björn Lindqvist. + Provide better short-circuiting operation. * lib/m4sugar/m4sugar.m4 (m4_cond, m4_newline): New macros. (m4_text_wrap): Use it. Also avoid useless m4_for. diff --git a/NEWS b/NEWS index 1bd5f5ab..70a4a1a2 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,12 @@ GNU Autoconf NEWS - User visible changes. ** The command 'autoconf -' now correctly processes a file from stdin. +** For all of the directory arguments for 'configure', such as '--prefix' + or '--bindir', trailing slashes are stripped. As an example, if + tab completion in the user's shell appends trailing slashes, the + command './configure --prefix=/usr/' will still result in an + expanded libdir value of /usr/lib, not /usr//lib. + ** AT_SETUP now handles macro expansions properly when calculating line length. However, as a side effect, any whitespace immediately following a single-quoted comma is lost. If you previously used diff --git a/THANKS b/THANKS index 13318e0d..a3c215b2 100644 --- a/THANKS +++ b/THANKS @@ -52,6 +52,7 @@ Brian Gough bjg@network-theory.co.uk Bruce Korb bkorb@gnu.org Bruce Lilly ? Bruno Haible haible@ilog.fr +Björn Lindqvist bjourne@gmail.com Carl Edman cedman@princeton.edu Carlos Velasco carlosev@newipnet.com Chad R. Larson chad@anasazi.com diff --git a/doc/autoconf.texi b/doc/autoconf.texi index ecc496b4..1b470eb3 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -1728,7 +1728,7 @@ M4. The following M4 macros (e.g., @code{AC_PACKAGE_NAME}), output variables (e.g., @code{PACKAGE_NAME}), and preprocessor symbols (e.g., -@code{PACKAGE_NAME}) are defined by @code{AC_INIT}: +@code{PACKAGE_NAME}), are defined by @code{AC_INIT}: @table @asis @item @code{AC_PACKAGE_NAME}, @code{PACKAGE_NAME} @@ -2465,7 +2465,10 @@ Absolute name of @code{top_srcdir}. The following variables specify the directories for package installation, see @ref{Directory Variables, , Variables for Installation Directories, standards, The @acronym{GNU} Coding -Standards}, for more information. See the end of this section for +Standards}, for more information. Each variable corresponds to an +argument of @command{configure}; trailing slashes are stripped so that +expressions such as @samp{$@{prefix@}/lib} expand with only one slash +between directory names. See the end of this section for details on when and how to use these variables. @defvar bindir diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index df501ec4..0f8a5dcf 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -895,13 +895,19 @@ if test -n "$ac_unrecognized_opts"; then esac fi -# Be sure to have absolute directory names. +# Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + / | // ) ;; + */ ) eval $ac_var='`echo "$ac_val" | sed "s|/*\$||"`' ;; + esac + # Be sure to have absolute directory names. case $ac_val in [[\\/$]]* | ?:[[\\/]]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; diff --git a/tests/base.at b/tests/base.at index afbe8844..f1f1a9da 100644 --- a/tests/base.at +++ b/tests/base.at @@ -321,3 +321,37 @@ AT_CHECK_CONFIGURE([FOO=bar --enable-baz --without-zork --silent], [0], [stdout] AT_CHECK([grep 'FOO=bar --enable-baz --without-zork --silent' stdout], [0], [ignore], [ignore]) AT_CLEANUP + + +## --------------------- ## +## configure directories ## +## --------------------- ## + +AT_SETUP([configure directories]) + +AT_DATA([foo.in], +[[prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +]]) + +AT_DATA([configure.ac], +[[AC_INIT +AC_CONFIG_FILES([foo]) +AC_OUTPUT +]]) + +AT_CHECK_AUTOCONF +dnl check that relative paths are rejected +AT_CHECK_CONFIGURE([--libdir=.], [1], [ignore], [stderr]) +AT_CHECK([grep 'expected an absolute directory name for --libdir: \.' stderr], + [0], [ignore]) + +dnl check that extra slashes are stripped, and that defaults are not expanded +AT_CHECK_CONFIGURE([--prefix=/usr//]) +AT_CHECK([cat foo], [0], [[prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +]]) + +AT_CLEANUP