+2001-08-27 Akim Demaille <akim@epita.fr>
+
+ * lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): $2 defaults to $1.
+ * lib/autotest/autotest.m4 (AT_INIT): Expand AUTOTEST_PATH into
+ first the build dirs, then the src dirs.
+ * configure.ac (AC_CONFIG_TESTDIR): Adjust.
+
2001-08-27 Akim Demaille <akim@epita.fr>
* lib/autotest/general.m4 (AT_INIT): Output the definition of
AM_INIT_AUTOMAKE(autoconf, 2.52c)
# Initialize the test suite.
-AC_CONFIG_TESTDIR(tests, ../bin)
+AC_CONFIG_TESTDIR(tests, bin)
AC_PATH_PROG(EXPR, expr)
# We use a path for GNU m4 so even if users have another m4 first in
# Roland McGrath, Noah Friedman, david d zuhn, and many others.
-# AC_CONFIG_TESTDIR(TEST-DIRECTORY, [AUTOTEST-PATH = .])
-# ------------------------------------------------------
+# AC_CONFIG_TESTDIR(TEST-DIRECTORY, [AUTOTEST-PATH = TEST-DIRECTORY])
+# -------------------------------------------------------------------
# Configure an Autotest test suite directory. Invoke it once per dir,
# even if there are several test suites in there.
#
-# AUTOTEST-PATH must help the test suite to find the executables,
-# i.e., if the executables are in `src/', pass `src'. If there are
-# also executables in the source tree, use `src:$top_srcdir/src'.
+# AUTOTEST-PATH must help the test suite to find the executables.
+# It is relative to the top level of the package, and is expanded
+# into all the build dirs of AUTOTEST-PATH, then all the src dirs.
AC_DEFUN([AC_CONFIG_TESTDIR],
[AC_CONFIG_COMMANDS([$1/atconfig],
[cat >$1/atconfig <<ATEOF
top_srcdir='$ac_top_srcdir'
top_builddir='$ac_top_builddir'
-AUTOTEST_PATH='m4_default([$2], [.])'
+AUTOTEST_PATH='m4_default([$2], [$1])'
SHELL=\${CONFIG_SHELL-'$at_shell'}
PATH_SEPARATOR='$at_path_separator'
at_srcdir=`cd "$srcdir" && pwd`
at_top_srcdir=`cd "$top_srcdir" && pwd`
-# Don't take risks: use absolute path names.
-at_path=`pwd`
+
+# Don't take risks: use only absolute directories in PATH.
+# AUTOTEST_PATH is expanded into build/src parts, since users
+# may create executables in both places.
+#
+# There might be directories that don't exist, but don't redirect
+# builtins' (eg., cd) stderr directly: Ultrix's sh hates that.
at_IFS_save=$IFS
IFS=$PATH_SEPARATOR
-for at_dir in $AUTOTEST_PATH $PATH; do
- # There might be directories that don't exist, but don't redirect
- # builtins' (eg., cd) stderr directly: Ultrix's sh hates that.
+at_sep=
+at_path=
+# Build first.
+for at_dir in $AUTOTEST_PATH; do
+ at_dir=`(cd "$top_builddir/$at_dir" && pwd) 2>/dev/null`
+ if test -n "$at_dir"; then
+ at_path="$at_path$at_sep$at_dir"
+ at_sep=$PATH_SEPARATOR
+ fi
+done
+# Then source.
+for at_dir in $AUTOTEST_PATH; do
+ at_dir=`(cd "$top_srcdir/$at_dir" && pwd) 2>/dev/null`
+ if test -n "$at_dir"; then
+ at_path="$at_path$at_sep$at_dir"
+ at_sep=$PATH_SEPARATOR
+ fi
+done
+# And finally PATH.
+for at_dir in $PATH; do
at_dir=`(cd "$at_dir" && pwd) 2>/dev/null`
- test -n "$at_dir" && at_path="$at_path$PATH_SEPARATOR$at_dir"
+ if test -n "$at_dir"; then
+ at_path="$at_path$at_sep$at_dir"
+ at_sep=$PATH_SEPARATOR
+ fi
done
IFS=$at_IFS_save
PATH=$at_path