From d508751e585559e2bfe1dcb1c460cba765470884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zdenko=20Podobn=C3=BD?= Date: Sat, 2 May 2015 12:15:13 +0200 Subject: [PATCH] Fixed issue 1317 - git revision info used as version info for autotools & DEBUG --- api/baseapi.cpp | 4 ++++ configure.ac | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/api/baseapi.cpp b/api/baseapi.cpp index af14be31f9..da68d0a729 100644 --- a/api/baseapi.cpp +++ b/api/baseapi.cpp @@ -138,7 +138,11 @@ TessBaseAPI::~TessBaseAPI() { * Returns the version identifier as a static string. Do not delete. */ const char* TessBaseAPI::Version() { +#if defined(DEBUG) && defined(GIT_REV) + return GIT_REV; +#else return TESSERACT_VERSION_STR; +#endif } /** diff --git a/configure.ac b/configure.ac index 8d8f7fa8ef..69cf526308 100644 --- a/configure.ac +++ b/configure.ac @@ -5,12 +5,10 @@ # ---------------------------------------- # Initialization # ---------------------------------------- - AC_PREREQ(2.50) AC_INIT([tesseract], [3.04], [http://code.google.com/p/tesseract-ocr/issues/list]) CXXFLAGS=${CXXFLAGS:-""} AC_CONFIG_MACRO_DIR([m4]) -AC_REVISION([$Revision$]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_SRCDIR(api/tesseractmain.cpp) AC_PREFIX_DEFAULT(/usr/local) @@ -21,6 +19,14 @@ AC_PREFIX_DEFAULT(/usr/local) PACKAGE_YEAR=2014 PACKAGE_DATE="08/13" +abs_top_srcdir=`AS_DIRNAME([$0])` +gitrev="`git --git-dir=${abs_top_srcdir}/.git --work-tree=${abs_top_srcdir} describe --always --tags`" +if test -n "${gitrev}" ; then + AC_REVISION("${gitrev}") + AC_DEFINE_UNQUOTED(GIT_REV,"${gitrev}", [Define to be the git revision]) + echo "Using git revision: ${gitrev}" +fi + AC_DEFINE_UNQUOTED(PACKAGE_NAME,["${PACKAGE_NAME}"],[Name of package]) AC_DEFINE_UNQUOTED(PACKAGE_VERSION,["${PACKAGE_VERSION}"],[Version number]) AC_DEFINE_UNQUOTED(PACKAGE_YEAR,"$PACKAGE_YEAR",[Official year for this release]) @@ -85,7 +91,7 @@ case "${host_os}" in AM_CONDITIONAL(ADD_RT, false) AM_CONDITIONAL(T_WIN, true) AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed']) - ;; + ;; solaris*) LIBS="-lsocket -lnsl -lrt -lxnet" AM_CONDITIONAL(ADD_RT, true)