Read a version number from a file in configure.ac

前端 未结 2 1413
清歌不尽
清歌不尽 2020-12-29 09:39

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 s

2条回答
  •  一个人的身影
    2020-12-29 10:05

    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])])
    

提交回复
热议问题