Skip to content
This repository
Browse code

Added retrieval of ISIS version in Autotools

This will hopefully be a reliable way to extract ISIS version.
  • Loading branch information...
commit afb8bd99d82a699504f5f7f908609b5231bf1cdb 1 parent abf3b2a
Moratto authored zmoratto committed

Showing 2 changed files with 46 additions and 0 deletions. Show diff stats Hide diff stats

  1. +3 0  configure.ac
  2. +43 0 m4/ax_pkg_isis_check_version.m4
3  configure.ac
@@ -316,6 +316,9 @@ else
316 316 fi
317 317
318 318 AX_PKG(ISIS, [ISIS3RDPARTY QT], [-lisis3], [SpecialPixel.h])
  319 +if test x"$HAVE_PKG_ISIS" = "xyes"; then
  320 + AX_PKG_ISIS_CHECK_VERSION()
  321 +fi
319 322
320 323 dnl check for recent rabbitmq; this can go away soon, it's just to prevent a
321 324 dnl flag-day upgrade
43 m4/ax_pkg_isis_check_version.m4
... ... @@ -0,0 +1,43 @@
  1 +dnl __BEGIN_LICENSE__
  2 +dnl Copyright (C) 2006-2011 United States Government as represented by
  3 +dnl the Administrator of the National Aeronautics and Space Administration.
  4 +dnl All Rights Reserved.
  5 +dnl __END_LICENSE__
  6 +
  7 +# Usage AX_PKG_ISIS_CHECK_VERSION()
  8 +# This checks for ISIS3.3.0+ style versioning
  9 +AC_DEFUN([AX_PKG_ISIS_CHECK_VERSION],
  10 +[
  11 + if test x"$HAVE_PKG_ISIS" != "xyes"; then
  12 + AC_MSG_ERROR([ISIS not found before hand, unable to find version now])
  13 + fi
  14 +
  15 + echo "ISISROOT = $ISISROOT" >&AS_MESSAGE_LOG_FD
  16 + echo "PKG_PATHS_ISIS = $PKG_PATHS_ISIS" >&AS_MESSAGE_LOG_FD
  17 +
  18 + if test -s "$ISISROOT"/version; then
  19 + # Found ISIS 3.3.0+ style versioning
  20 + ISIS_VERSION_PRE=`tr '\n' ' ' < $ISISROOT/version`
  21 + elif test -s "$PKG_PATHS_ISIS"/version; then
  22 + # Found ISIS 3.3.0+ style versioning
  23 + ISIS_VERSION_PRE=`tr '\n' ' ' < $PKG_PATHS_ISIS/version`
  24 + elif grep "std::string version" < "$ISISROOT"/inc/Constants.h > /dev/null; then
  25 + # Found ISIS < 3.3.0 style versioning
  26 + ISIS_VERSION_PRE=`grep "std::string version" < $ISISROOT/inc/Constants.h | sed 's/.*"\(.*\)".*/\1/'`
  27 + elif grep "std::string version" < "$PKG_PATHS_ISIS"/inc/Constants.h > /dev/null; then
  28 + # Found ISIS < 3.3.0 style versioning
  29 + ISIS_VERSION_PRE=`grep "std::string version" < $PKG_PATHS_ISIS/inc/Constants.h | sed 's/.*"\(.*\)".*/\1/'`
  30 + else
  31 + AC_MSG_ERROR([Unable to detect ISIS version])
  32 + fi
  33 +
  34 + # Trim whitespaces leading an trailing
  35 + ISIS_VERSION=`echo $ISIS_VERSION_PRE | sed 's/^[ \t]*//;s/[ \t]*$//'`
  36 +
  37 + echo "ISIS_VERSION_PRE = \"$ISIS_VERSION_PRE\"" >&AS_MESSAGE_LOG_FD
  38 + echo "ISIS_VERSION = \"$ISIS_VERSION\"" >&AS_MESSAGE_LOG_FD
  39 +
  40 + AC_DEFINE_UNQUOTED([ISIS_VERSION],
  41 + ["$ISIS_VERSION"],
  42 + [The version of ISIS that this software was built against.])
  43 +])

0 comments on commit afb8bd9

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