Fix AC_CONFIG_LINKS to generated files when srcdir is absolute.

* lib/autoconf/status.m4 (_AC_OUTPUT_LINK): Check $ac_source,
not $srcdir, for being relative or absolute.
* tests/torture.at (AC_CONFIG_LINKS): New test.
(AC_CONFIG_LINKS and identical files): Extend test, avoid some
forks.
Report, patch and testcase example by Peter Breitenlohner.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
This commit is contained in:
Peter Breitenlohner 2010-01-06 20:14:53 +01:00 committed by Ralf Wildenhues
parent acf0439102
commit 13e3570bc9
3 changed files with 83 additions and 3 deletions

View File

@ -1,3 +1,14 @@
2010-01-06 Peter Breitenlohner <peb@mppmu.mpg.de>
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Fix AC_CONFIG_LINKS to generated files when srcdir is absolute.
* lib/autoconf/status.m4 (_AC_OUTPUT_LINK): Check $ac_source,
not $srcdir, for being relative or absolute.
* tests/torture.at (AC_CONFIG_LINKS): New test.
(AC_CONFIG_LINKS and identical files): Extend test, avoid some
forks.
Report, patch and testcase example by Peter Breitenlohner.
2010-01-05 Eric Blake <ebb9@byu.net>
Improve release automation.

View File

@ -974,7 +974,7 @@ m4_define([_AC_OUTPUT_LINK],
rm -f "$ac_file"
# Try a relative symlink, then a hard link, then a copy.
case $srcdir in
case $ac_source in
[[\\/$]]* | ?:[[\\/]]* ) ac_rel_source=$ac_source ;;
*) ac_rel_source=$ac_top_build_prefix$ac_source ;;
esac

View File

@ -1160,6 +1160,61 @@ AT_CHECK_CONFIGURE([], 1, ignore, ignore)
AT_CLEANUP
## ----------------- ##
## AC_CONFIG_LINKS. ##
## ----------------- ##
AT_SETUP([AC_CONFIG_LINKS])
AT_DATA([configure.ac],
[[AC_INIT([config links to config files test], [1.0])
AC_CONFIG_SRCDIR([sub1/file1.in])
AC_CONFIG_FILES([sub1/file1 file2])
AC_CONFIG_LINKS([file1:sub1/file1 sub2/file2:file2])
AC_OUTPUT
]])
mkdir sub1
AT_DATA([sub1/file1.in],
[[/* @configure_input@ */
#define PACKAGE_STRING "@PACKAGE_STRING@"
]])
AT_DATA([file2.in],
[[/* @configure_input@ */
#define PACKAGE_STRING "@PACKAGE_STRING@"
]])
mkdir build
AT_CHECK_AUTOCONF
cd build
AT_CHECK([../configure && ../configure], 0, [ignore])
AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
])
AT_CHECK([../configure && ../configure], 0, [ignore])
AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
])
cd ..
rm -rf build
mkdir build
cd build
cwd=`pwd`
AT_CHECK(["$cwd"/../configure && "$cwd"/../configure], 0, [ignore])
AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
])
cd ..
AT_CHECK([./configure && ./configure], 0, [ignore], [stderr])
AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
])
cwd=`pwd`
AT_CHECK(["$cwd"/configure && "$cwd"/configure], 0, [ignore], [ignore])
AT_CHECK([cat sub1/file1 sub2/file2 | grep -c "config links"], 0, [2
])
AT_CLEANUP
## ------------------------------------- ##
## AC_CONFIG_LINKS and identical files. ##
## ------------------------------------- ##
@ -1182,6 +1237,20 @@ AT_CHECK([../configure $configure_options && ../configure $configure_options],
AT_CHECK([cat src/s src/t], 0, [file1
file2
])
cd ..
rm -rf build
mkdir build
cd build
cwd=`pwd`
AT_CHECK(["$cwd"/../configure], 0, [ignore])
AT_CHECK([cat src/s src/t], 0, [file1
file2
])
AT_CHECK(["$cwd"/../configure], 0, [ignore])
AT_CHECK([cat src/s src/t], 0, [file1
file2
])
cd ..
AT_CHECK([./configure $configure_options && ./configure $configure_options],
0, [ignore], [stderr])
@ -1189,8 +1258,8 @@ AT_CHECK([grep src/t stderr], 1)
AT_CHECK([cat src/s src/t], 0, [file1
file2
])
AT_CHECK(["`pwd`"/configure $configure_options && "`pwd`"/configure $configure_options],
0, [ignore], [ignore])
cwd=`pwd`
AT_CHECK(["$cwd"/configure && "$cwd"/configure], 0, [ignore], [ignore])
AT_CHECK([cat src/s src/t], 0, [file1
file2
])