Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert Git-based version in autoconf-managed project?

How can I assign a dynamic, git-based version number to an autoconf project? Autoconf requires a static string argument to

AC_INIT([Title],[version],[name])

AC_INIT documentation says that one can use M4 to supply a shell-based version. M4 is beyond my ken. I'd like to version my software according to the results of this command

version=`git describe --abbrev=7 --dirty --always --tags`

This produces something like 4.6.6-alpha07-9-ga3e01a8.

I may not understand high level answers. I need a solution like "cut and paste this into your autoconf.ac and/or acinclude.m4".

Any help appreciated.

like image 550
Charlie Zender Avatar asked Apr 20 '17 18:04

Charlie Zender


Video Answer


1 Answers

How about:

AC_INIT([Title], [m4_esyscmd_s([git describe --abbrev=7 --dirty --always --tags])])

should work for you.

like image 176
ldav1s Avatar answered Sep 28 '22 02:09

ldav1s