[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_CONFIG_LINKS([sub/file:file]) with abs srcdir creates a bad link
From: |
Ralf Wildenhues |
Subject: |
Re: AC_CONFIG_LINKS([sub/file:file]) with abs srcdir creates a bad link |
Date: |
Tue, 22 Dec 2009 22:43:40 +0100 |
User-agent: |
Mutt/1.5.20 (2009-10-28) |
[ adding autoconf-patches ]
Hi Peter,
* Peter Breitenlohner wrote on Mon, Dec 21, 2009 at 02:11:50PM CET:
> here another Autoconf 2.65 bug, reported by TeX Live builders:
>
> AC_CONFIG_LINKS([sub/file:file])
>
> creates a wrong symlink when used with an absolute srcdir (different from
> builddir). As far as I can reconstruct 2.64 did it differently but also
> wrong.
I think the patch is ok.
> Attached is a small tarball demonstrating the problem. Everything is as
> expected with a relative (explicit or implicit) srcdir, but
> /path/to/src/configure --srcdir=/path/to/src
> creates a dangling symlink.
> Also attached is a tiny patch adressing this problem.
Thanks. I've reworked your test case into a couple of testsuite
additions. Below is what I have now. Unless I hear complaints,
I will commit it soonish.
> Finally, the manual states that AC_CONFIG_LINKS creates (sym)links from the
> source tree to the build tree. Looking at the code this is obviouly not (no
> longer?) the case for files in the build tree created explicitly by
> configure or via AC_CONFIG_FILES (execpt for the current problem). That
> sentence might need to be revised.
Do you mean a change like in the patch below?
Thanks,
Ralf
2009-12-22 Peter Breitenlohner <address@hidden>
Ralf Wildenhues <address@hidden>
Fix AC_CONFIG_LINKS to generated files when srcdir is absolute.
* lib/autoconf/status.m4 (_AC_OUTPUT_LINK):
* tests/torture.at (AC_CONFIG_LINKS): New test.
(AC_CONFIG_LINKS and identical files): Extend test, avoid some
forks.
* doc/autoconf.texi (Configuration Links): Do not imply in the
example that links always point to the source tree.
Report, patch and testcase example by Peter Breitenlohner.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 76bb279..c59ec6f 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -3553,7 +3553,8 @@ Configuration Links
@noindent
creates in the current directory @file{host.h} as a link to
@address@hidden/config/$machine.h}, and @file{object.h} as a
-link to @address@hidden/config/$obj_format.h}.
+link to @address@hidden/config/$obj_format.h}, if those files
+exist in the source tree.
The tempting value @samp{.} for @var{dest} is invalid: it makes it
impossible for @samp{config.status} to guess the links to establish.
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index e921d97..20bcb51 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 6fdf7e7..19b7483 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
])
- Re: AC_CONFIG_LINKS([sub/file:file]) with abs srcdir creates a bad link,
Ralf Wildenhues <=