From 13e3570bc9cd43f2a036adb45497c96da65331e0 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 6 Jan 2010 20:14:53 +0100 Subject: [PATCH] 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 --- ChangeLog | 11 +++++++ lib/autoconf/status.m4 | 2 +- tests/torture.at | 73 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 83 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2765bda9..d5fc01d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2010-01-06 Peter Breitenlohner + Ralf Wildenhues + + 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 Improve release automation. diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 4f4e843f..f74bd347 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -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 diff --git a/tests/torture.at b/tests/torture.at index f00498fb..ceea62c5 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -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 ]) -- 2.47.2