From e297565ae34d6cc62f41810a261adbeef576af7b Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@fe.uni-lj.si>
Date: Tue, 16 Feb 2016 15:42:49 +0000
Subject: [PATCH] Changed the way the information on the version is inserted into the code

---
 src/Makefile.am |    3 ++-
 configure.ac    |    9 +++------
 src/snapshot.c  |    3 ++-
 config.h.in     |    3 ---
 4 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/config.h.in b/config.h.in
index cdffe53..b68dfc5 100644
--- a/config.h.in
+++ b/config.h.in
@@ -83,9 +83,6 @@
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
-/* A string containing the version number */
-#undef TS_VERSION
-
 /* Version number of package */
 #undef VERSION
 
diff --git a/configure.ac b/configure.ac
index 63fe5b4..f43881a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,12 +41,9 @@
 AC_MSG_RESULT(no)
 fi
 
-#detect commit version and date
-#-                   ["Trisurf $VERSION on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"],
-#                   ["Trisurf (commit `cd $srcdir && git log -1 --format=format:%h`) on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"],
-AC_DEFINE_UNQUOTED(TS_VERSION,
-                    ["Trisurf (commit `git describe  --abbrev=6 --dirty --always --tags`) build on `date` @`hostname`."],
-                    [A string containing the version number])
+#AC_DEFINE_UNQUOTED(TS_VERSION,
+#                    ["Trisurf (commit `git describe  --abbrev=6 --dirty --always --tags`) build on `date` @`hostname`."],
+#                    [A string containing the version number])
 
 # Checks for library functions.
 AC_FUNC_MALLOC
diff --git a/src/Makefile.am b/src/Makefile.am
index 5646d8c..4517cb2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,7 @@
 bin_PROGRAMS = trisurf
 trisurf_SOURCES = general.c vertex.c bond.c triangle.c cell.c vesicle.c initial_distribution.c io.c dumpstate.c frame.c energy.c timestep.c vertexmove.c bondflip.c main.c poly.c stats.c sh.c shcomplex.c constvol.c snapshot.c
-AM_CFLAGS = -Wall -Werror
+GITVERSION:=$(shell git --no-pager describe --tags --always --dirty)
+AM_CFLAGS = -Wall -Werror -DTS_VERSION=\"$(GITVERSION)\"
 AM_CPPFLAGS = ${libxml2_CFLAGS}
 trisurf_LDADD = ${libcurl_LIBS} ${libxml2_LIBS}
 #shdiscoverdir=../
diff --git a/src/snapshot.c b/src/snapshot.c
index 3b62b49..50dc139 100644
--- a/src/snapshot.c
+++ b/src/snapshot.c
@@ -49,7 +49,8 @@
     	char *c_time_string;
 	current_time = time(NULL);
 	c_time_string = ctime(&current_time);
-	fprintf(fh, "<trisurfversion>%s</trisurfversion>\n",TS_VERSION);
+	
+	fprintf(fh, "<trisurfversion>Trisurf (commit %s), compiled on %s %s</trisurfversion>\n",TS_VERSION, __DATE__,  __TIME__);
 	fprintf(fh, "<dumpdate>%s</dumpdate>\n", c_time_string);
 	//free (c_time_string);
 

--
Gitblit v1.9.3