[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_OUTPUT to parent dir and install-sh

From: John Calcote
Subject: Re: AC_OUTPUT to parent dir and install-sh
Date: Tue, 21 Jul 2009 10:55:58 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2

Hi Willem,

As you may have discovered by now, the algorithm used by Automake to reference the autotools-installed utility scripts pre-pends the functional inverse of the $(srcdir) path to the utility program name as it's referenced. Thus, if you had a project, "test" with the following directory structure:


In the resulting top-level Makefile, $(srcdir) is "./", the functional inverse of which is the same (the "identity" value, if you will). The "src" directory's $(srcdir) value is "./src", so it's functional inverse is "../" . However, the parent directory of "test" would have a $(srcdir) value of "../". The inverse of this directory can't be calculated, because it would require a directory name, which is not part of the original path. Thus, files outside of the project top-level directory can't be referenced in this manner.

This is a general rule, but it isn't strictly true -- there are some exceptions. For an example, if your project is a sub-project of a higher-level project, then you may reference the m4 macro directory of the parent project within a sub-project's AC_CONFIG_MACRO_DIR call in order to consolidate macros for all of the projects into one location. However, I shy away from such tactics because it makes your sub-projects non-functional outside of the context of the parent project.

Another problem that you'll soon discover, should you find a way to work around your install-sh problem is that a distribution package can't be built from a project that references files using relative paths outside the project's top-level directory. The project's top-level directory is the root of a tarball created for source-level distribution. Files above this root will not be captured in the tarball.


On 7/19/2009 4:52 PM, Willem Jan Palenstijn wrote:

Is it allowed to list files in the parent directory of the
main source directory in AC_CONFIG_FILES? I'm trying the following small

AC_INIT(testcase, 0.0.1, address@hidden)
AC_CONFIG_FILES([test ../test_parent])

When I use autoconf-2.63 with this, and run the resulting configure
script, and there is no 'install' program in $PATH, the script
'./install-sh' is used as $INSTALL. In the 'test' output file, @INSTALL@
is then correctly replaced by './'. However, in
'../test_parent' @INSTALL@ is replaced by '.././', which does
not exist.

At a cursory glance, it seems config.status is counting slashes in
'../test_parent' and concluding test_parent is in a subdirectory of the
source directory.

Is this expected behaviour? I couldn't find any reference in the
autoconf documentation or on the mailing list to this case, but I may
have overlooked it.

Should it be useful, I prepared a small tarball with the example and the other necessary files at .

Aside: this issue popped up when building the Singular
( ) mathematics package which uses
autoconf. It uses multiple configure scripts, one of which is in one
subdirectory of the root and generates a Makefile in another
subdirectory of the root. It was encountered by a Sage ( ) developer who was building a patched Singular
as part of Sage on a Solaris machine that did not have an 'install'

With kind regards,
Willem Jan

Autoconf mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]