diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-12-08 20:06:00 +0100 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-12-09 20:23:37 +0100 |
commit | 458776d704579528c999a70024dcce73329beee5 (patch) | |
tree | 80b03139d073889639007a495c574fca82c5719b /configure.ac | |
parent | 8169f76a3b95f07fd84bdc4aed41deb87973fb9a (diff) |
Add git commit to the reported version with -v
When git is available, records the git commit in the dillo binary, so
dillo -v reports the version and the commit. Otherwise only the release
version is reported (as we do now).
The commit is *always* recomputed when "make" is called. This allows
switching branches, doing a dirty rebuild and still get the correct
commit with "dillo -v".
Using AC_INIT() doesn't update the commit when the source is already
configured.
Fixes: https://github.com/dillo-browser/dillo/issues/288
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 03715e1b..89edfa1f 100644 --- a/configure.ac +++ b/configure.ac @@ -711,6 +711,29 @@ if eval "test x$GCC = xyes"; then CXXFLAGS="$CXXFLAGS -Wall -W -Wno-unused-parameter -fno-rtti -fno-exceptions -pedantic -std=c++11 -D_POSIX_C_SOURCE=200112L" fi +dnl ---------------------------------- +dnl Check if we can use the git commit +dnl ---------------------------------- +git_ok=no +AC_CHECK_PROG(git_found, git, yes, no) +if test "x$git_found" = "xyes" ; then + AC_MSG_CHECKING([.git directory exists]) + if test -d "$srcdir/.git"; then + AC_MSG_RESULT([yes]) + AC_MSG_CHECKING(git describe works) + git_version=`git --work-tree="$srcdir" describe --dirty` + if test "x$git_version" = "x"; then + AC_MSG_RESULT(no) + else + git_ok=yes + AC_MSG_RESULT([yes ($git_version)]) + fi + else + AC_MSG_RESULT([no]) + fi +fi +AM_CONDITIONAL([GIT_AVAILABLE], [test "x$git_ok" = "xyes"]) + AC_SUBST(BASE_CUR_WORKING_DIR) AC_SUBST(LIBJPEG_LIBS) AC_SUBST(LIBJPEG_LDFLAGS) |