1dnl -*- shell-script -*- 2dnl 3dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana 4dnl University Research and Technology 5dnl Corporation. All rights reserved. 6dnl Copyright (c) 2004-2005 The University of Tennessee and The University 7dnl of Tennessee Research Foundation. All rights 8dnl reserved. 9dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 10dnl University of Stuttgart. All rights reserved. 11dnl Copyright (c) 2004-2005 The Regents of the University of California. 12dnl All rights reserved. 13dnl Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. 14dnl Copyright (c) 2014 Intel, Inc. All rights reserved. 15dnl Copyright (c) 2014 Research Organization for Information Science 16dnl and Technology (RIST). All rights reserved. 17dnl $COPYRIGHT$ 18dnl 19dnl Additional copyrights may follow 20dnl 21dnl $HEADER$ 22dnl 23 24dnl 25dnl This file is also used as input to opal_get_version.sh. 26dnl 27 28# OPAL_GET_VERSION(version_file, variable_prefix) 29# ----------------------------------------------- 30# parse version_file for version information, setting 31# the following shell variables: 32# 33# prefix_VERSION 34# prefix_BASE_VERSION 35# prefix_MAJOR_VERSION 36# prefix_MINOR_VERSION 37# prefix_RELEASE_VERSION 38# prefix_GREEK_VERSION 39# prefix_REPO_REV 40# prefix_TARBALL_VERSION 41# prefix_RELEASE_DATE 42m4_define([OPAL_GET_VERSION],[ 43 dnl quote eval to suppress macro expansion with non-GNU m4 44 if test -f "$1"; then 45 srcdir=`dirname $1` 46 opal_vers=`sed -n " 47 t clear 48 : clear 49 s/^major/$2_MAJOR_VERSION/ 50 s/^minor/$2_MINOR_VERSION/ 51 s/^release/$2_RELEASE_VERSION/ 52 s/^greek/$2_GREEK_VERSION/ 53 s/^repo_rev/$2_REPO_REV/ 54 s/^tarball_version/$2_TARBALL_VERSION/ 55 s/^date/$2_RELEASE_DATE/ 56 t print 57 b 58 : print 59 p" < "$1"` 60 [eval] "$opal_vers" 61 62 $2_VERSION="$$2_MAJOR_VERSION.$$2_MINOR_VERSION.$$2_RELEASE_VERSION" 63 $2_VERSION="${$2_VERSION}${$2_GREEK_VERSION}" 64 65 if test "$$2_TARBALL_VERSION" = ""; then 66 $2_TARBALL_VERSION=$$2_VERSION 67 fi 68 69 m4_ifdef([AC_MSG_CHECKING], 70 [AC_MSG_CHECKING([for repo version])]) 71 72 # If repo_rev was not set in the VERSION file, then get it now 73 if test "$$2_REPO_REV" = ""; then 74 # See if we can find the "git" command. 75 git_happy=0 76 git --version > /dev/null 2>&1 77 if test $? -eq 0; then 78 git_happy=1 79 fi 80 81 # If we're in a git repo and we found the git command, use 82 # git describe to get the repo rev 83 if test -d "$srcdir/.git" && test $git_happy -eq 1; then 84 if test "$srcdir" != "`pwd`"; then 85 git_save_dir=`pwd` 86 cd $srcdir 87 $2_REPO_REV=`git describe --tags --always` 88 cd $git_save_dir 89 unset git_save_dir 90 else 91 $2_REPO_REV=`git describe --tags --always` 92 fi 93 else 94 $2_REPO_REV="date`date '+%Y-%m-%d'`" 95 fi 96 fi 97 98 m4_ifdef([AC_MSG_RESULT], 99 [AC_MSG_RESULT([$$2_REPO_REV])]) 100 fi 101]) 102