I updated M4, Autoconf and Automake to their latest version. In Makefile.am, I'm added only this:
AM_TESTS_ENVIRONMENT = \ myprog_abspath='$(abs_srcdir)'/../src/myprog; \ export myprog_abspath; And now "make check" works! However, "make distcheck" doesn't. This is due to the fact that, for "make distcheck", the variable $(abs_srcdir) points to ~/mypkg/mypkg-1.0/_build/../test/ while I'd like it to point to ~/mypkg/mypkg-1.0/_build/test/. I also tried with this: AM_TESTS_ENVIRONMENT = \ myprog_abspath='$(abs_top_srcdir)'/src/myprog; \ export myprog_abspath; "make check" still works but "make distchek" doesn't because $(abs_top_srcdir) now points to ~/mypkg/mypkg-1.0/_build/../ while I want it to point to ~/mypkg/mypkg-1.0/_build/. To summarize, when using "make distcheck", "myprog" is not in ~/mypkg/mypkg-1.0/src/ but in ~/mypkg/mypkg-1.0/_build/src/. I don't understand the rationale underlying this behavior. Why does "distcheck" need to create _build? Any idea on how to solve my problem? BTW I had a look at the code of Coreutils here, http://git.savannah.gnu.org/cgit/coreutils.git/tree/, but can't see any Makefile.am. Thanks already for all your advice, Tim On Thu, Jan 10, 2013 at 3:00 AM, Stefano Lattarini < stefano.lattar...@gmail.com> wrote: > On 01/09/2013 04:09 PM, Timothée Flutre wrote: > > Thanks, I've added TESTS_ENVIRONMENT (tried with or without "AC_") > > > (it's "AM_" BTW) > > > in my test/Makefile.am and updated the rest like this: > > > > launch_functional_tests.bash: $(srcdir)/launch_functional_tests.in > > sed -e 's,PATHTOMYPROG,$(myprog_abspath),g' > > $(srcdir)/launch_functional_tests.in > launch_functional_tests.bash > > chmod +x launch_functional_tests.bash > > > Sorry if I wasn't clear enough: with my suggestion, you don't need to > preprocess 'launch_functional_tests.bash' any longer; you can just have > it rely on the '$myprog_abspath' environment variable instead. > > > However, the variable $(myprog_abspath) is empty! This can be seen on > > the stdout when running "make": > > ... > > make[1]: Entering directory `~/mypkg/test' > > sed -e 's,PATHTOMYPROG,,g' ./launch_functional_tests.in > > > launch_functional_tests.bash > > chmod +x launch_functional_tests.bash > > make[1]: Leaving directory `~/mypkg/test' > > ... > > > > I'm using Automake v1.9.6. > > > Wow, that is ancient. My suggestions only applied to Automake 1.11 > onward. Automake versions older tan those are no longer worth > supporting nor considering, IMHO. > > Can the problem come from this? (For > > completeness, the machine I'm using has Autoconf v2.59.) > > > I suggest you update your installation ASAP (at least to Automake 1.12.6 > and Autoconf 2.65). > > > The manual > > > Be careful: the online manual only refers to the latest released > Automake version (as of today, 1.13.1). If you have a different > version, you should only refer to the locally-installed documentation. > > > also speaks of a script "tests-env.sh". Is there a GNU > > package using something like this, so that I could have a look at it? > > > Yes, GNU coreutils, IIRC. But consider that the coreutils build system > requires Automake 1.11 or later, so some (or many) of its idioms cannot > work with older Automake. > > HTH, > Stefano >