autoconf
[Top][All Lists]
Advanced

[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:

test/
   Makefile.am
   src/
      Makefile.am

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.

Regards,
John

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

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
example configure.ac:

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


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 './install.sh'. However, in
'../test_parent' @INSTALL@ is replaced by '.././install.sh', 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
configure.ac and the other necessary files at
http://www.usecode.org/misc/autoconf_parent_output.tar .



Aside: this issue popped up when building the Singular
( http://www.singular.uni-kl.de/ ) 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 (
http://www.sagemath.org ) developer who was building a patched Singular
as part of Sage on a Solaris machine that did not have an 'install'
binary.



With kind regards,
Willem Jan


_______________________________________________
Autoconf mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/autoconf






reply via email to

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