Re: m4 macro expansion problem

2021-09-08 Thread Sébastien Hinderer
Zack Weinberg (2021/08/25 14:41 -0400): > On Wed, Aug 25, 2021, at 12:06 PM, Sébastien Hinderer wrote: > > Zack Weinberg (2021/08/25 11:39 -0400): > > > m4_syscmd is a primitive, and it doesn't expand its argument, so you need > > > to expand PKG_VERSION first: > > > > > > m4_syscmd([cat > VERSION

Re: m4 macro expansion problem

2021-09-08 Thread Sébastien Hinderer
Hey Peter, Peter Johansson (2021/08/26 10:26 +1000): > Hi Sebastien, > > On 26/8/21 12:49 am, Sébastien Hinderer wrote: > > > Perhaps macros > > > are available that let one write some content to a file directly from > > > aclocal.m4? > > There is a macro in the autoconf-archive (not part of autoc

Re: m4 macro expansion problem

2021-08-25 Thread Peter Johansson
Hi Sebastien, On 26/8/21 12:49 am, Sébastien Hinderer wrote: Perhaps macros are available that let one write some content to a file directly from aclocal.m4? There is a macro in the autoconf-archive (not part of autoconf) that let you write to a file at autoconf time. The code is very similar

Re: m4 macro expansion problem

2021-08-25 Thread Zack Weinberg
On Wed, Aug 25, 2021, at 12:06 PM, Sébastien Hinderer wrote: > Zack Weinberg (2021/08/25 11:39 -0400): > > m4_syscmd is a primitive, and it doesn't expand its argument, so you need > > to expand PKG_VERSION first: > > > > m4_syscmd([cat > VERSION << \END_OF_VERSION_FILE > > ]PKG_VERSION[ > > > > #

Re: m4 macro expansion problem

2021-08-25 Thread Sébastien Hinderer
Hey Zack! Many thanks for your reposne! I'll not quote you, to keep mine short. No, I wasn't aware that the macro wouold be executed several times. It's a pity, but I do think it will do exactly the same thing eeach time. And at the moemnt, as soon as we use some components of VERSION in the bui

Re: m4 macro expansion problem

2021-08-25 Thread Zack Weinberg
On Wed, Aug 25, 2021, at 10:49 AM, Sébastien Hinderer wrote: > Sébastien Hinderer (2021/08/25 15:45 +0200): > > My preference would be to have VERSION generated at the same time than > > the configure script, i.e. during the autoconf invocation. > > > > Is that possible? > > > > I started to invest

Re: m4 macro expansion problem

2021-08-25 Thread Sébastien Hinderer
Sébastien Hinderer (2021/08/25 15:45 +0200): > Dear Nick, > > Yes, your email was definitely helpful and clear! Many thanks for that! > > Now the macro works like a charm. > > The only thing that remains osbcure to me is what would be the best way > to generate our "VERSION" file, the one I am tryi

Re: m4 macro expansion problem

2021-08-25 Thread Sébastien Hinderer
Dear Peter, Many thanks for your response and the link to your code! I willl definitely look into it. It's just that I wanted to see if I am able to write the code by myself first, so that I can then compare what I was able to produce to what other produced, but I'll definitely look at it. Thank

Re: m4 macro expansion problem

2021-08-25 Thread Sébastien Hinderer
Dear Nick, Yes, your email was definitely helpful and clear! Many thanks for that! Now the macro works like a charm. The only thing that remains osbcure to me is what would be the best way to generate our "VERSION" file, the one I am trying to replace. ONe simple way would be to have a VERSION.

Re: m4 macro expansion problem

2021-08-23 Thread Peter Johansson
Hi Sebastien, On 24/8/21 2:49 am, Sébastien Hinderer wrote: Dear all, I am trying to define a package version properly by first defining its components separately (major and minor version number, patchlevel, and extra). The major and minor numbers are assumed to be always present. The patchlev

Re: m4 macro expansion problem

2021-08-23 Thread Nick Bowler
On 2021-08-23, Nick Bowler wrote: > However, you might not notice that this text went unexpanded in > Autoconf (which is in effect while processing aclocal.m4) is KILL, > so all resulting text is simply discarded. Erm, I appear to have accidentally some words... I meant to say "the default diver

Re: m4 macro expansion problem

2021-08-23 Thread Nick Bowler
On 2021-08-23, Sébastien Hinderer wrote: > I would like to express all this in m4, more precisely in aclocal.m4, so > that the configure script has proper version information. > > At the moment I don't manage to do so and failed to find an exemple of a > macro whose body can take several lines but

m4 macro expansion problem

2021-08-23 Thread Sébastien Hinderer
Dear all, I am trying to define a package version properly by first defining its components separately (major and minor version number, patchlevel, and extra). The major and minor numbers are assumed to be always present. The patchlevel and the extra bits are optional. In pseudo-shell code, the