Re: Getting srcdir in script executed using m4_esyscmd in AC_INIT

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

 



On Sun, Jan 3, 2021 at 6:01 PM Bob Friesenhahn
<bfriesen@xxxxxxxxxxxxxxxxxxx> wrote:
>
> AC_INIT(m4_esyscmd([./version.sh packagename]),
>          m4_esyscmd([./version.sh packageversion]),
>          m4_esyscmd([./version.sh packagebugreport]))
>
> This works fine when building in the source directory.
>
> The problem I am encountering is that in the context of AC_INIT and
> m4_esyscmd, I do not know how to obtain the path to the top of the
> source directory.

The trick here is that these shell commands will be executed when you
run autoconf, *not* when you run configure.  And you have to run
autoconf with the current working directory equal to the top of the
source tree *anyway*.  So the answer is ". will be the top of the
source tree."  This is why automake's rule for regenerating configure
from configure.ac does `cd $(top_srcdir) && $(AUTOCONF)`.

Autoconf itself does something similar and it works reliably:
(quoting https://git.savannah.gnu.org/cgit/autoconf.git/tree/configure.ac#n22)

AC_INIT([GNU Autoconf],
    m4_esyscmd([build-aux/git-version-gen .tarball-version]),
    [bug-autoconf@xxxxxxx])

I presume this is *not* working reliably for you or you wouldn't have
asked the question, so could you go into a little more detail about
how you invoked autoconf and/or configure and what went wrong?

zw




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux