Fixed issue 1317 - git revision info used as version info for autotools & DEBUG

This commit is contained in:
Zdenko Podobný 2015-05-02 12:15:13 +02:00
parent d1c749f6ad
commit d508751e58
2 changed files with 13 additions and 3 deletions

View File

@ -138,7 +138,11 @@ TessBaseAPI::~TessBaseAPI() {
* Returns the version identifier as a static string. Do not delete. * Returns the version identifier as a static string. Do not delete.
*/ */
const char* TessBaseAPI::Version() { const char* TessBaseAPI::Version() {
#if defined(DEBUG) && defined(GIT_REV)
return GIT_REV;
#else
return TESSERACT_VERSION_STR; return TESSERACT_VERSION_STR;
#endif
} }
/** /**

View File

@ -5,12 +5,10 @@
# ---------------------------------------- # ----------------------------------------
# Initialization # Initialization
# ---------------------------------------- # ----------------------------------------
AC_PREREQ(2.50) AC_PREREQ(2.50)
AC_INIT([tesseract], [3.04], [http://code.google.com/p/tesseract-ocr/issues/list]) AC_INIT([tesseract], [3.04], [http://code.google.com/p/tesseract-ocr/issues/list])
CXXFLAGS=${CXXFLAGS:-""} CXXFLAGS=${CXXFLAGS:-""}
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AC_REVISION([$Revision$])
AC_CONFIG_AUX_DIR(config) AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR(api/tesseractmain.cpp) AC_CONFIG_SRCDIR(api/tesseractmain.cpp)
AC_PREFIX_DEFAULT(/usr/local) AC_PREFIX_DEFAULT(/usr/local)
@ -21,6 +19,14 @@ AC_PREFIX_DEFAULT(/usr/local)
PACKAGE_YEAR=2014 PACKAGE_YEAR=2014
PACKAGE_DATE="08/13" 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_NAME,["${PACKAGE_NAME}"],[Name of package])
AC_DEFINE_UNQUOTED(PACKAGE_VERSION,["${PACKAGE_VERSION}"],[Version number]) AC_DEFINE_UNQUOTED(PACKAGE_VERSION,["${PACKAGE_VERSION}"],[Version number])
AC_DEFINE_UNQUOTED(PACKAGE_YEAR,"$PACKAGE_YEAR",[Official year for this release]) 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(ADD_RT, false)
AM_CONDITIONAL(T_WIN, true) AM_CONDITIONAL(T_WIN, true)
AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed']) AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed'])
;; ;;
solaris*) solaris*)
LIBS="-lsocket -lnsl -lrt -lxnet" LIBS="-lsocket -lnsl -lrt -lxnet"
AM_CONDITIONAL(ADD_RT, true) AM_CONDITIONAL(ADD_RT, true)