On 2021-10-18, Sébastien Hinderer <sebastien.hinde...@inria.fr> wrote: > Given the follwing configure.ac script: > > AC_INIT([demo], [demo], [0.1], [d...@demo.org]) > AC_MSG_NOTICE([abs_top_srcdir="$abs_top_srcdir"]) > > [The] configure script produced by autoconf 2.69 prints: > > configure: abs_top_srcdir="" > > Is that an expected behaviour?
I don't know about "expected" but it appears to at least be longstanding behavour. This variable is substituted into output files but this is done directly by config.status and is not itself available within configure scripts. I can't say the documentation is particularly clear on this. In the section that defines abs_top_srcdir et al[1]: "The preset variables which are available during config.status (see Configuration Actions[2]) may also be used during configure tests." If we interpret that as meaning "the variables that are both in this list and in that other list[3]" then there is just one -- srcdir -- and this one does indeed work as expected in configure scripts. But this is not a really obvious interpretation and there are many other variables in the list (like CFLAGS) that are routinely used in configure tests. Configure scripts are always executed from the top build directory so most of these directory variables are not needed in tests. If required, it is easy enough to compute absolute directories in the shell: case $srcdir in /*) my_abs_top_srcdir=$srcdir ;; *) my_abs_top_srcdir=`pwd`/$srcdir ;; esac [1] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Preset-Output-Variables.html [2] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Configuration-Actions.html [3] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Configuration-Actions.html#index-srcdir-1 Cheers, Nick