2005-03-22 Paul Eggert <eggert@cs.ucla.edu>
+ * NEWS: The configure command now warns you if you attempt to use
+ a directory whose name contains a special character like space,
+ newline, or "\".
+ * doc/autoconf.texi (Installation Directory Variables): Allow
+ "," in file names. Do not use \@; it's not a portable regexp.
+ * bin/Makefile.am (edit): Likewise.
+ * lib/Makefile.am (edit): Likewise.
+ * tests/Makefile.am (edit): Likewise.
+ * tests/semantics.at: Likewise.
+ * tests/torture.at: Likewise.
+ * lib/autoconf/general.m4 (AC_ARG_PROGRAM): Likewise.
+ * lib/autoconf/status.m4 (_AC_SRCDIRS): Likewise.
+ * doc/autoconf.texi (File System Conventions): Warn about
+ unportable file names.
+ * lib/autoconf/general.m4 (_AC_INIT_DIRCHECK): New macro.
+ (AC_INIT): Use it.
+ (_AC_INIT_SRCDIR): Use ac_pwd rather than invoking pwd.
+ * lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Propagate
+ ac_pwd, and quote srcdir.
+ * lib/autotest/general.m4 (AT_INIT): Quote file name args.
+
* doc/autoconf.texi: Fix some systematic formatting problems.
".)" needs a following @: if not at the end of a sentence, and
similarly for "!)". "etc." should be preceded by a comma.
* Major changes in Autoconf 2.59c
+** The configure command now warns you if you attempt to use a directory
+ whose name contains a special character like space, newline, or "\".
+ Such names are not supported, and can cause "configure" to crash.
+
** The configure command now redirects standard input from /dev/null,
to help avoid problems with subsidiary commands that might mistakenly
read standard input. AS_ORIGINAL_STDIN_FD points to the original
## Makefile for Autoconf.
-## Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+## Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
## Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## ------------- ##
edit = sed \
- -e 's,@SHELL\@,$(SHELL),g' \
- -e 's,@PERL\@,$(PERL),g' \
- -e 's,@bindir\@,$(bindir),g' \
- -e 's,@datadir\@,$(pkgdatadir),g' \
- -e 's,@prefix\@,$(prefix),g' \
- -e 's,@autoconf-name\@,'`echo autoconf | sed '$(transform)'`',g' \
- -e 's,@autoheader-name\@,'`echo autoheader | sed '$(transform)'`',g' \
- -e 's,@autom4te-name\@,'`echo autom4te | sed '$(transform)'`',g' \
- -e 's,@M4\@,$(M4),g' \
- -e 's,@AWK\@,$(AWK),g' \
- -e 's,@VERSION\@,$(VERSION),g' \
- -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
- -e 's,@configure_input\@,Generated from $@.in; do not edit by hand.,g'
+ -e 's|@SHELL[@]|$(SHELL)|g' \
+ -e 's|@PERL[@]|$(PERL)|g' \
+ -e 's|@bindir[@]|$(bindir)|g' \
+ -e 's|@datadir[@]|$(pkgdatadir)|g' \
+ -e 's|@prefix[@]|$(prefix)|g' \
+ -e 's|@autoconf-name[@]|'`echo autoconf | sed '$(transform)'`'|g' \
+ -e 's|@autoheader-name[@]|'`echo autoheader | sed '$(transform)'`'|g' \
+ -e 's|@autom4te-name[@]|'`echo autom4te | sed '$(transform)'`'|g' \
+ -e 's|@M4[@]|$(M4)|g' \
+ -e 's|@AWK[@]|$(AWK)|g' \
+ -e 's|@VERSION[@]|$(VERSION)|g' \
+ -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
+ -e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g'
# autoconf is written in M4sh.
autoconf.in: $(srcdir)/autoconf.as $(m4sh_m4f_dependencies)
@example
@group
edit = sed \
- -e 's,@@datadir\@@,$(pkgdatadir),g' \
- -e 's,@@prefix\@@,$(prefix),g'
+ -e 's|@@datadir[@@]|$(pkgdatadir)|g' \
+ -e 's|@@prefix[@@]|$(prefix)|g'
@end group
@group
Some details are noteworthy:
@table @samp
-@item @@datadir\@@
-The backslash prevents @command{configure} from replacing
+@item @@datadir[@@]
+The brackets prevent @command{configure} from replacing
@samp{@@datadir@@} in the sed expression itself.
+Brackets are preferable to a backslash here, since
+Posix says @samp{\@@} is not portable.
@item $(pkgdatadir)
Don't use @samp{@@pkgdatadir@@}! Use the matching makefile variable
@section File System Conventions
@cindex File system conventions
+Autoconf uses shell-script processing extensively, so the file names
+that it processes should not contain characters that are special to the
+shell. Special characters include space, tab, newline, @sc{nul}, and
+the following:
+
+@example
+" # $ & ' ( ) * ; < = > ? [ \ ` |
+@end example
+
+Also, file names should not begin with @samp{~} or @samp{-}, and should
+not contain @samp{-} immediately after @samp{/}.
+
+These restrictions apply not only to the files that you distribute, but
+also to the absolute file names of your source, build, and destination
+directories. Autoconf-generated @command{configure} scripts warn of
+violations to the above restrictions.
+
+On some Posix-like platforms, @samp{!} and @samp{^} are special too, so
+they should be avoided.
+
While @command{autoconf} and friends will usually be run on some Posix
variety, it can and will be used on other systems, most notably @acronym{DOS}
variants. This impacts several assumptions regarding file names.
## Process this file with automake to create Makefile.in
-## Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
EXTRA_DIST = autom4te.in freeze.mk
edit = sed \
- -e 's,@SHELL\@,$(SHELL),g' \
- -e 's,@PERL\@,$(PERL),g' \
- -e 's,@bindir\@,$(bindir),g' \
- -e 's,@datadir\@,$(pkgdatadir),g' \
- -e 's,@prefix\@,$(prefix),g' \
- -e 's,@autoconf-name\@,'`echo autoconf | sed '$(transform)'`',g' \
- -e 's,@autoheader-name\@,'`echo autoheader | sed '$(transform)'`',g' \
- -e 's,@autom4te-name\@,'`echo autom4te | sed '$(transform)'`',g' \
- -e 's,@M4\@,$(M4),g' \
- -e 's,@AWK\@,$(AWK),g' \
- -e 's,@VERSION\@,$(VERSION),g' \
- -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g'
+ -e 's|@SHELL[@]|$(SHELL)|g' \
+ -e 's|@PERL[@]|$(PERL)|g' \
+ -e 's|@bindir[@]|$(bindir)|g' \
+ -e 's|@datadir[@]|$(pkgdatadir)|g' \
+ -e 's|@prefix[@]|$(prefix)|g' \
+ -e 's|@autoconf-name[@]|'`echo autoconf | sed '$(transform)'`'|g' \
+ -e 's|@autoheader-name[@]|'`echo autoheader | sed '$(transform)'`'|g' \
+ -e 's|@autom4te-name[@]|'`echo autom4te | sed '$(transform)'`'|g' \
+ -e 's|@M4[@]|$(M4)|g' \
+ -e 's|@AWK[@]|$(AWK)|g' \
+ -e 's|@VERSION[@]|$(VERSION)|g' \
+ -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g'
# All the files below depend on Makefile so that they are rebuilt
# when the prefix, etc. changes. Unfortunately, suffix rules
[m4_divert_text([DEFAULTS], [ac_unique_file="$1"])])
+# _AC_INIT_DIRCHECK
+# -----------------
+# Set ac_pwd, and sanity-check it and the source and installation directories.
+m4_define([_AC_INIT_DIRCHECK],
+[m4_divert_push([PARSE_ARGS])dnl
+
+ac_pwd=`pwd` && test -n "$ac_pwd" ||
+ AC_MSG_ERROR([Working directory cannot be determined])
+
+ac_pat="[[\$][{][_$as_cr_Letters][_$as_cr_alnum]*[}]]"
+
+for ac_dir in "$ac_pwd" "$srcdir" \
+ "$bindir" "$sbindir" "$libexecdir" "$datarootdir" "$datadir" \
+ "$sysconfdir" "$sharedstatedir" "$localstatedir" "$includedir" \
+ "$oldincludedir" "$docdir" "$infodir" "$htmldir" "$dvidir" "$pdfdir" \
+ "$psdir" "$libdir" "$localedir" "$mandir"
+do
+ # Remove references to shell or make variables.
+ ac_dirx=$ac_dir
+ while :
+ do
+ case $ac_dirx in
+ *\${*}*)
+ ac_dirx=`
+ expr "X$ac_dirx" : "X\\(.*\\)$ac_pat"`X`
+ expr "X$ac_dirx" : "X.*$ac_pat\\(.*\\)"`;;
+ *) break;;
+ esac
+ done
+
+ # Check for newline, tab, space, and other weird possibilities.
+ # Preserve that tab character below!
+ case $ac_dirx in
+ '' | -* | */-* | *'
+'* | *' '* | *' '* | *\"* | *\#* | *\$* | *\&* | *\'* | *\(* | *\)* | \
+ *\** | *\;* | *\<* | *\=* | *\>* | *\?* | *\@<:@* | *\\* | *\`* | \
+ *\|* | \~*)
+ AC_MSG_WARN([Directory name `$ac_dir' contains special characters]);;
+ esac
+done
+m4_divert_pop([PARSE_ARGS])dnl
+])# _AC_INIT_DIRCHECK
+
# _AC_INIT_SRCDIR
# ---------------
# Compute `srcdir' based on `$ac_unique_file'.
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
- ac_popdir=`pwd`
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
test -d $ac_dir || continue
_AC_SRCDIRS(["$ac_dir"])
else
AC_MSG_WARN([no configuration information is in $ac_dir])
fi || ac_status=$?
- cd "$ac_popdir" || { ac_status=$?; break; }
+ cd "$ac_pwd" || { ac_status=$?; break; }
done
fi
_AC_INIT_DEFAULTS
_AC_INIT_PARSE_ARGS
_AC_INIT_SRCDIR
+_AC_INIT_DIRCHECK
_AC_INIT_HELP
_AC_INIT_VERSION
_AC_INIT_CONFIG_LOG
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
m4_divert_pop([HELP_BEGIN])dnl
test "$program_prefix" != NONE &&
- program_transform_name="s,^,$program_prefix,;$program_transform_name"
+ program_transform_name="s|^|$program_prefix|;$program_transform_name"
# Use a double $ so make ignores it.
test "$program_suffix" != NONE &&
- program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+ program_transform_name="s|\$|$program_suffix|;$program_transform_name"
# Double any \ or $. echo might interpret backslashes.
# By default was `s,x,x', remove it if useless.
cat <<\_ACEOF >conftest.sed
# Do not use `cd foo && pwd` to compute absolute names, because
# the directories may not exist.
-AS_SET_CATFILE([ac_abs_builddir], [`pwd`], [$1])
+AS_SET_CATFILE([ac_abs_builddir], [$ac_pwd], [$1])
AS_SET_CATFILE([ac_abs_top_builddir],
[$ac_abs_builddir], [${ac_top_builddir}.])
AS_SET_CATFILE([ac_abs_srcdir], [$ac_abs_builddir], [$ac_srcdir])
cat >>$CONFIG_STATUS <<\_ACEOF
:t
[/@[a-zA-Z_][a-zA-Z_0-9]*@/!b]
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s|@configure_input@|$configure_input|;t t
+s|@srcdir@|$ac_srcdir|;t t
+s|@abs_srcdir@|$ac_abs_srcdir|;t t
+s|@top_srcdir@|$ac_top_srcdir|;t t
+s|@abs_top_srcdir@|$ac_abs_top_srcdir|;t t
+s|@builddir@|$ac_builddir|;t t
+s|@abs_builddir@|$ac_abs_builddir|;t t
+s|@top_builddir@|$ac_top_builddir|;t t
+s|@abs_top_builddir@|$ac_abs_top_builddir|;t t
AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [s,@INSTALL@,$ac_INSTALL,;t t
])dnl
dnl The parens around the eval prevent an "illegal io" in Ultrix sh.
Copyright (C) 2005 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
AC_PROVIDE_IFELSE([AC_PROG_INSTALL],
[dnl Leave those double quotes here: this $INSTALL is evaluated in a
dnl here document, which might result in `INSTALL=/bin/install -c'.
at_errexit=false
;;
yes:*)
- at_msg='expected failure ('`cat $at_check_line_file`')'
+ at_msg='expected failure ('`cat "$at_check_line_file"`')'
at_xfail_list="$at_xfail_list $at_group"
at_errexit=false
;;
no:*)
- at_msg='FAILED ('`cat $at_check_line_file`')'
+ at_msg='FAILED ('`cat "$at_check_line_file"`')'
at_fail_list="$at_fail_list $at_group"
at_errexit=$at_errexit_p
;;
## Process this file with automake to create Makefile.in. -*-Makefile-*-
## Makefile for Autoconf testsuite.
-## Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+## Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
check_SCRIPTS = autoconf autoheader autoreconf autom4te autoscan autoupdate ifnames
DISTCLEANFILES = atconfig atlocal $(TESTSUITE) $(check_SCRIPTS)
-MAINTAINERCLEANFILES = Makefile.in
+MAINTAINERCLEANFILES = Makefile.in
# Import the dependencies on Autotest and M4sh.
include ../lib/freeze.mk
$(MY_AUTOM4TE) --language=M4sh $(srcdir)/wrapper.as -o $@
edit = sed \
- -e 's,@wrap_program\@,$@,g' \
- -e 's,@abs_top_srcdir\@,@abs_top_srcdir@,g' \
- -e 's,@abs_top_builddir\@,@abs_top_builddir@,g' \
- -e 's,@configure_input\@,Generated from $<.,g'
+ -e 's|@wrap_program[@]|$@|g' \
+ -e 's|@abs_top_srcdir[@]|@abs_top_srcdir@|g' \
+ -e 's|@abs_top_builddir[@]|@abs_top_builddir@|g' \
+ -e 's|@configure_input[@]|Generated from $<.|g'
$(wrappers): wrapper.in
rm -f $@ $@.tmp
[[AC_INIT
pwd=`pwd`
p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
-path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
+path=`echo $p | sed -e 's|\([[0-9]]\)|'"$pwd"'/path/\1|g'`
fail=false
AC_CHECK_PROG(TOOL1, tool, found, not-found, $path)
test "$TOOL2" = not-found || fail=:
AC_CHECK_PROG(TOOL3, tool, tool, not-found, $path, $pwd/path/1/tool)
-test "$TOOL3" = $pwd/path/2/tool || fail=:
+test "$TOOL3" = "$pwd/path/2/tool" || fail=:
AC_CHECK_PROG(TOOL4, better, better, not-found, $path, $pwd/path/1/tool)
test "$TOOL4" = better || fail=:
[[AC_INIT
pwd=`pwd`
p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
-path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
+path=`echo $p | sed -e 's|\([[0-9]]\)|'"$pwd"'/path/\1|g'`
fail=false
AC_PATH_PROG(TOOL1, tool, not-found, $path)
-test "$TOOL1" = $pwd/path/1/tool || fail=:
+test "$TOOL1" = "$pwd/path/1/tool" || fail=:
AC_PATH_PROG(TOOL2, better, not-found, $path)
-test "$TOOL2" = $pwd/path/6/better || fail=:
+test "$TOOL2" = "$pwd/path/6/better" || fail=:
# When a tool is not found, and no value is given for not-found,
# the variable is left empty.
test -z "$TOOL3" || fail=:
AC_PATH_PROGS(TOOL4, missing tool better,, $path)
-test "$TOOL4" = $pwd/path/1/tool || fail=:
+test "$TOOL4" = "$pwd/path/1/tool" || fail=:
# No AC-OUTPUT, we don't need config.status.
$fail &&
# Absolute name.
at_here=`pwd`
-AT_CHECK([cd at-dir && $at_here/configure], [], [ignore])
+AT_CHECK([cd at-dir && "$at_here/configure"], [], [ignore])
AT_CLEANUP