I define my project version number in a plain text file instead of configure.ac for some reasons. I would like to create a statement that would read the version number and store it during compilation time.
Right now my configure.ac looks like this:
AC_INIT([my program],[999.9.9])
I would like to have something like:
AC_INIT([my program],[ $(cat VERSION) ])
This wont work of course. What is the trick here? (I know I am loosing some portability - I don't care at the moment). Thanks!
Try:
AC_INIT([my program], m4_esyscmd([tr -d '\n' < VERSION]))
Edited with fixes suggested in the comments.
I was also able to remove the non-portable tr
invocation using:
AC_INIT([my program], [m4_translit(m4_esyscmd([cat VERSION]),m4_newline)])
which seems to work just as well, as does the solution suggested by Enrico in the comments below:
AC_INIT([my program], [m4_esyscmd_s([cat VERSION])])