Skip to content
Browse files

Added retrieval of ISIS version in Autotools

This will hopefully be a reliable way to extract ISIS version.
  • Loading branch information...
1 parent abf3b2a commit afb8bd99d82a699504f5f7f908609b5231bf1cdb Moratto committed with Zack Moratto Oct 14, 2011
Showing with 46 additions and 0 deletions.
  1. +3 −0 configure.ac
  2. +43 −0 m4/ax_pkg_isis_check_version.m4
View
3 configure.ac
@@ -316,6 +316,9 @@ else
fi
AX_PKG(ISIS, [ISIS3RDPARTY QT], [-lisis3], [SpecialPixel.h])
+if test x"$HAVE_PKG_ISIS" = "xyes"; then
+ AX_PKG_ISIS_CHECK_VERSION()
+fi
dnl check for recent rabbitmq; this can go away soon, it's just to prevent a
dnl flag-day upgrade
View
43 m4/ax_pkg_isis_check_version.m4
@@ -0,0 +1,43 @@
+dnl __BEGIN_LICENSE__
+dnl Copyright (C) 2006-2011 United States Government as represented by
+dnl the Administrator of the National Aeronautics and Space Administration.
+dnl All Rights Reserved.
+dnl __END_LICENSE__
+
+# Usage AX_PKG_ISIS_CHECK_VERSION()
+# This checks for ISIS3.3.0+ style versioning
+AC_DEFUN([AX_PKG_ISIS_CHECK_VERSION],
+[
+ if test x"$HAVE_PKG_ISIS" != "xyes"; then
+ AC_MSG_ERROR([ISIS not found before hand, unable to find version now])
+ fi
+
+ echo "ISISROOT = $ISISROOT" >&AS_MESSAGE_LOG_FD
+ echo "PKG_PATHS_ISIS = $PKG_PATHS_ISIS" >&AS_MESSAGE_LOG_FD
+
+ if test -s "$ISISROOT"/version; then
+ # Found ISIS 3.3.0+ style versioning
+ ISIS_VERSION_PRE=`tr '\n' ' ' < $ISISROOT/version`
+ elif test -s "$PKG_PATHS_ISIS"/version; then
+ # Found ISIS 3.3.0+ style versioning
+ ISIS_VERSION_PRE=`tr '\n' ' ' < $PKG_PATHS_ISIS/version`
+ elif grep "std::string version" < "$ISISROOT"/inc/Constants.h > /dev/null; then
+ # Found ISIS < 3.3.0 style versioning
+ ISIS_VERSION_PRE=`grep "std::string version" < $ISISROOT/inc/Constants.h | sed 's/.*"\(.*\)".*/\1/'`
+ elif grep "std::string version" < "$PKG_PATHS_ISIS"/inc/Constants.h > /dev/null; then
+ # Found ISIS < 3.3.0 style versioning
+ ISIS_VERSION_PRE=`grep "std::string version" < $PKG_PATHS_ISIS/inc/Constants.h | sed 's/.*"\(.*\)".*/\1/'`
+ else
+ AC_MSG_ERROR([Unable to detect ISIS version])
+ fi
+
+ # Trim whitespaces leading an trailing
+ ISIS_VERSION=`echo $ISIS_VERSION_PRE | sed 's/^[ \t]*//;s/[ \t]*$//'`
+
+ echo "ISIS_VERSION_PRE = \"$ISIS_VERSION_PRE\"" >&AS_MESSAGE_LOG_FD
+ echo "ISIS_VERSION = \"$ISIS_VERSION\"" >&AS_MESSAGE_LOG_FD
+
+ AC_DEFINE_UNQUOTED([ISIS_VERSION],
+ ["$ISIS_VERSION"],
+ [The version of ISIS that this software was built against.])
+])

0 comments on commit afb8bd9

Please sign in to comment.
Something went wrong with that request. Please try again.