2008-10-28 20:22:29 +03:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
|
|
|
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
|
|
|
dnl University Research and Technology
|
|
|
|
dnl Corporation. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
dnl of Tennessee Research Foundation. All rights
|
|
|
|
dnl reserved.
|
2014-10-02 18:31:47 +04:00
|
|
|
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2008-10-28 20:22:29 +03:00
|
|
|
dnl University of Stuttgart. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
dnl All rights reserved.
|
2014-09-30 19:54:18 +04:00
|
|
|
dnl Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved.
|
2014-05-08 06:01:35 +04:00
|
|
|
dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
|
2014-12-22 09:14:33 +03:00
|
|
|
dnl Copyright (c) 2014 Research Organization for Information Science
|
|
|
|
dnl and Technology (RIST). All rights reserved.
|
2008-10-28 20:22:29 +03:00
|
|
|
dnl $COPYRIGHT$
|
2014-10-02 18:31:47 +04:00
|
|
|
dnl
|
2008-10-28 20:22:29 +03:00
|
|
|
dnl Additional copyrights may follow
|
2014-10-02 18:31:47 +04:00
|
|
|
dnl
|
2008-10-28 20:22:29 +03:00
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
|
|
|
dnl
|
2010-09-18 03:04:06 +04:00
|
|
|
dnl This file is also used as input to opal_get_version.sh.
|
2008-10-28 20:22:29 +03:00
|
|
|
dnl
|
|
|
|
|
2010-09-18 03:04:06 +04:00
|
|
|
# OPAL_GET_VERSION(version_file, variable_prefix)
|
2008-10-28 20:22:29 +03:00
|
|
|
# -----------------------------------------------
|
|
|
|
# parse version_file for version information, setting
|
|
|
|
# the following shell variables:
|
2014-10-02 18:31:47 +04:00
|
|
|
#
|
2008-10-28 20:22:29 +03:00
|
|
|
# prefix_VERSION
|
|
|
|
# prefix_BASE_VERSION
|
|
|
|
# prefix_MAJOR_VERSION
|
|
|
|
# prefix_MINOR_VERSION
|
|
|
|
# prefix_RELEASE_VERSION
|
|
|
|
# prefix_GREEK_VERSION
|
2011-02-17 01:53:23 +03:00
|
|
|
# prefix_REPO_REV
|
2014-10-02 18:31:47 +04:00
|
|
|
# prefix_TARBALL_VERSION
|
2008-10-28 20:22:29 +03:00
|
|
|
# prefix_RELEASE_DATE
|
2010-09-18 03:04:06 +04:00
|
|
|
m4_define([OPAL_GET_VERSION],[
|
2008-10-28 20:22:29 +03:00
|
|
|
dnl quote eval to suppress macro expansion with non-GNU m4
|
|
|
|
if test -f "$1"; then
|
2009-08-05 02:50:23 +04:00
|
|
|
srcdir=`dirname $1`
|
2014-05-08 06:01:35 +04:00
|
|
|
opal_vers=`sed -n "
|
2008-10-28 20:22:29 +03:00
|
|
|
t clear
|
|
|
|
: clear
|
|
|
|
s/^major/$2_MAJOR_VERSION/
|
|
|
|
s/^minor/$2_MINOR_VERSION/
|
|
|
|
s/^release/$2_RELEASE_VERSION/
|
|
|
|
s/^greek/$2_GREEK_VERSION/
|
2011-02-17 01:53:23 +03:00
|
|
|
s/^repo_rev/$2_REPO_REV/
|
2014-10-02 18:31:47 +04:00
|
|
|
s/^tarball_version/$2_TARBALL_VERSION/
|
2008-10-28 20:22:29 +03:00
|
|
|
s/^date/$2_RELEASE_DATE/
|
|
|
|
t print
|
|
|
|
b
|
|
|
|
: print
|
|
|
|
p" < "$1"`
|
2014-05-08 06:01:35 +04:00
|
|
|
[eval] "$opal_vers"
|
2008-10-28 20:22:29 +03:00
|
|
|
|
2014-09-30 19:54:18 +04:00
|
|
|
$2_VERSION="$$2_MAJOR_VERSION.$$2_MINOR_VERSION.$$2_RELEASE_VERSION"
|
2008-10-28 20:22:29 +03:00
|
|
|
$2_VERSION="${$2_VERSION}${$2_GREEK_VERSION}"
|
|
|
|
|
2014-10-02 18:31:47 +04:00
|
|
|
if test "$$2_TARBALL_VERSION" = ""; then
|
|
|
|
$2_TARBALL_VERSION=$$2_VERSION
|
|
|
|
fi
|
|
|
|
|
|
|
|
m4_ifdef([AC_MSG_CHECKING],
|
|
|
|
[AC_MSG_CHECKING([for repo version])])
|
|
|
|
|
|
|
|
# If repo_rev was not set in the VERSION file, then get it now
|
|
|
|
if test "$$2_REPO_REV" = ""; then
|
|
|
|
# See if we can find the "git" command.
|
|
|
|
git_happy=0
|
|
|
|
git --version > /dev/null 2>&1
|
|
|
|
if test $? -eq 0; then
|
|
|
|
git_happy=1
|
2008-10-28 20:22:29 +03:00
|
|
|
fi
|
2014-10-02 18:31:47 +04:00
|
|
|
|
|
|
|
# If we're in a git repo and we found the git command, use
|
|
|
|
# git describe to get the repo rev
|
|
|
|
if test -d "$srcdir/.git" && test $git_happy -eq 1; then
|
2014-12-22 09:14:33 +03:00
|
|
|
if test "$srcdir" != "`pwd`"; then
|
|
|
|
git_save_dir=`pwd`
|
|
|
|
cd $srcdir
|
|
|
|
$2_REPO_REV=`git describe --tags --always`
|
|
|
|
cd $git_save_dir
|
|
|
|
unset git_save_dir
|
|
|
|
else
|
|
|
|
$2_REPO_REV=`git describe --tags --always`
|
|
|
|
fi
|
2014-10-02 18:31:47 +04:00
|
|
|
else
|
|
|
|
$2_REPO_REV="date`date '+%Y-%m-%d'`"
|
2008-10-28 20:22:29 +03:00
|
|
|
fi
|
|
|
|
fi
|
2014-10-02 18:31:47 +04:00
|
|
|
|
|
|
|
m4_ifdef([AC_MSG_RESULT],
|
|
|
|
[AC_MSG_RESULT([$$2_REPO_REV])])
|
2008-10-28 20:22:29 +03:00
|
|
|
fi
|
|
|
|
])
|