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.
|
|
|
|
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
dnl University of Stuttgart. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
dnl All rights reserved.
|
2011-02-17 01:53:23 +03:00
|
|
|
dnl Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
|
2014-05-08 06:01:35 +04:00
|
|
|
dnl Copyright (c) 2014 Intel, Inc. All rights reserved.
|
2008-10-28 20:22:29 +03:00
|
|
|
dnl $COPYRIGHT$
|
|
|
|
dnl
|
|
|
|
dnl Additional copyrights may follow
|
|
|
|
dnl
|
|
|
|
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:
|
|
|
|
#
|
|
|
|
# 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_WANT_REPO_REV
|
|
|
|
# prefix_REPO_REV
|
2008-10-28 20:22:29 +03:00
|
|
|
# prefix_RELEASE_DATE
|
2010-09-18 03:04:06 +04:00
|
|
|
m4_define([OPAL_GET_VERSION],[
|
2014-05-08 06:01:35 +04:00
|
|
|
: ${opal_ver_need_repo_rev=1}
|
2008-10-28 20:22:29 +03:00
|
|
|
: ${svnversion_result=-1}
|
|
|
|
|
|
|
|
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/^want_repo_rev/$2_WANT_REPO_REV/
|
|
|
|
s/^repo_rev/$2_REPO_REV/
|
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
|
|
|
|
|
|
|
# Only print release version if it isn't 0
|
|
|
|
if test $$2_RELEASE_VERSION -ne 0 ; then
|
|
|
|
$2_VERSION="$$2_MAJOR_VERSION.$$2_MINOR_VERSION.$$2_RELEASE_VERSION"
|
|
|
|
else
|
|
|
|
$2_VERSION="$$2_MAJOR_VERSION.$$2_MINOR_VERSION"
|
|
|
|
fi
|
|
|
|
$2_VERSION="${$2_VERSION}${$2_GREEK_VERSION}"
|
|
|
|
$2_BASE_VERSION=$$2_VERSION
|
|
|
|
|
2014-05-08 06:01:35 +04:00
|
|
|
if test $$2_WANT_REPO_REV -eq 1 && test $opal_ver_need_repo_rev -eq 1 ; then
|
2008-10-28 20:22:29 +03:00
|
|
|
if test "$svnversion_result" != "-1" ; then
|
2011-02-17 01:53:23 +03:00
|
|
|
$2_REPO_REV=$svnversion_result
|
2008-10-28 20:22:29 +03:00
|
|
|
fi
|
2011-02-17 01:53:23 +03:00
|
|
|
if test "$$2_REPO_REV" = "-1" ; then
|
2008-10-28 20:22:29 +03:00
|
|
|
m4_ifdef([AC_MSG_CHECKING],
|
2011-02-17 01:53:23 +03:00
|
|
|
[AC_MSG_CHECKING([for repo version])])
|
2009-09-05 13:01:30 +04:00
|
|
|
d=`date '+%m-%d-%Y'`
|
2008-10-28 20:22:29 +03:00
|
|
|
if test -d "$srcdir/.svn" ; then
|
2011-02-17 01:53:23 +03:00
|
|
|
$2_REPO_REV=r`svnversion "$srcdir"`
|
2009-09-05 13:01:30 +04:00
|
|
|
if test $? != 0; then
|
2010-02-16 05:25:00 +03:00
|
|
|
# The following is too long for Fortran
|
2011-02-17 01:53:23 +03:00
|
|
|
# $2_REPO_REV="unknown svn version (svnversion not found); $d"
|
|
|
|
$2_REPO_REV="? (no svnversion); $d"
|
2009-09-05 13:01:30 +04:00
|
|
|
fi
|
2008-10-28 20:22:29 +03:00
|
|
|
elif test -d "$srcdir/.hg" ; then
|
2009-09-05 13:01:30 +04:00
|
|
|
# Check to see if we can find the hg command
|
2010-02-16 05:25:00 +03:00
|
|
|
# remember that $? reflects the status of the
|
|
|
|
# *last* command in a pipe change, so if "hg ..
|
2009-09-05 13:01:30 +04:00
|
|
|
# cut ..." runs and "hg" is not found, $? will
|
|
|
|
# reflect the status of "cut", not hg not being
|
|
|
|
# found. So test for hg specifically first.
|
|
|
|
hg --version > /dev/null 2>&1
|
|
|
|
if test $? = 0; then
|
2011-02-17 01:53:23 +03:00
|
|
|
$2_REPO_REV=hg`hg -v -R "$srcdir" tip | grep ^changeset: | head -n 1 | cut -d: -f3`
|
2009-09-05 13:01:30 +04:00
|
|
|
else
|
2010-02-16 05:25:00 +03:00
|
|
|
# The following is too long for Fortran
|
2011-02-17 01:53:23 +03:00
|
|
|
# $2_REPO_REV="unknown hg version (hg not found); $d"
|
|
|
|
$2_REPO_REV="? (no hg); $d"
|
|
|
|
fi
|
|
|
|
elif test -d "$srcdir/.git" ; then
|
|
|
|
# By the same logic as above, check to see if we
|
|
|
|
# can find the "git" command.
|
|
|
|
git --version > /dev/null 2>&1
|
|
|
|
if test $? = 0; then
|
2014-09-19 01:03:31 +04:00
|
|
|
$2_REPO_REV=git`git log --pretty=format:'%h' -1`
|
2011-02-17 01:53:23 +03:00
|
|
|
else
|
|
|
|
# The following is too long for Fortran
|
|
|
|
# $2_REPO_REV="unknown hg version (hg not found); $d"
|
|
|
|
$2_REPO_REV="? (no git); $d"
|
2009-09-05 13:01:30 +04:00
|
|
|
fi
|
2008-10-28 20:22:29 +03:00
|
|
|
fi
|
2011-02-17 01:53:23 +03:00
|
|
|
if test "$2_REPO_REV" = ""; then
|
|
|
|
$2_REPO_REV="date$d"
|
2008-10-28 20:22:29 +03:00
|
|
|
fi
|
|
|
|
m4_ifdef([AC_MSG_RESULT],
|
|
|
|
[AC_MSG_RESULT([done])])
|
|
|
|
fi
|
2011-02-17 01:53:23 +03:00
|
|
|
$2_VERSION="${$2_VERSION}${$2_REPO_REV}"
|
2008-10-28 20:22:29 +03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
])
|