2007-10-05 Eric Blake <ebb9@byu.net>
+ 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.
** 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
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
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}
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
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;;
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