]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix AC_CONFIG_LINKS to generated files when srcdir is absolute.
authorPeter Breitenlohner <peb@mppmu.mpg.de>
Wed, 6 Jan 2010 19:14:53 +0000 (20:14 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Wed, 6 Jan 2010 19:14:53 +0000 (20:14 +0100)
* 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>
ChangeLog
lib/autoconf/status.m4
tests/torture.at

index 2765bda92a9dd78f0160dd8f3ad7db100c020c8e..d5fc01d49cefd50775c7ea260d207ad95090b7c0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 4f4e843ffd7ad0fb74eb4351a54878ddb682bac2..f74bd34706241e514a96c6493fd2b0fdedb1d297 100644 (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
index f00498fb96cab747ffd33d5d82465f58678b8f5d..ceea62c51425db73beb00eafddb062d9117a24a7 100644 (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
 ])