3 # ompi_get_version is created from ompi_get_version.m4 and ompi_get_version.m4sh.
5 # Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
6 # University Research and Technology
7 # Corporation. All rights reserved.
8 # Copyright (c) 2004-2005 The University of Tennessee and The University
9 # of Tennessee Research Foundation. All rights
11 # Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
12 # University of Stuttgart. All rights reserved.
13 # Copyright (c) 2004-2005 The Regents of the University of California.
14 # All rights reserved.
17 # Additional copyrights may follow
24 # OMPI_GET_VERSION(version_file, variable_prefix)
25 # -----------------------------------------------
26 # parse version_file for version information, setting
27 # the following shell variables:
31 # prefix_MAJOR_VERSION
32 # prefix_MINOR_VERSION
33 # prefix_RELEASE_VERSION
34 # prefix_GREEK_VERSION
44 # svnversion can take a while to run. If we don't need it, don't run it.
45 --major|
--minor|
--release|
--greek|
--base|
--help)
53 if test -z "$srcfile"; then
57 : ${ompi_ver_need_svn=1}
59 : ${svnversion_result=-1}
61 if test -f "$srcfile"; then
65 s/^major/OMPI_MAJOR_VERSION/
66 s/^minor/OMPI_MINOR_VERSION/
67 s/^release/OMPI_RELEASE_VERSION/
68 s/^greek/OMPI_GREEK_VERSION/
69 s/^want_svn/OMPI_WANT_SVN/
76 # Only print release version if it isn't 0
77 if test $OMPI_RELEASE_VERSION -ne 0 ; then
78 OMPI_VERSION
="$OMPI_MAJOR_VERSION.$OMPI_MINOR_VERSION.$OMPI_RELEASE_VERSION"
80 OMPI_VERSION
="$OMPI_MAJOR_VERSION.$OMPI_MINOR_VERSION"
82 OMPI_VERSION
="${OMPI_VERSION}${OMPI_GREEK_VERSION}"
83 OMPI_BASE_VERSION
=$OMPI_VERSION
85 if test $OMPI_WANT_SVN -eq 1 && test $ompi_ver_need_svn -eq 1 ; then
86 if test "$svnversion_result" != "-1" ; then
87 OMPI_SVN_R
=$svnversion_result
89 if test "$OMPI_SVN_R" = "-1" ; then
91 if test -d "$srcdir/.svn" ; then
92 OMPI_SVN_R
=r
`svnversion "$srcdir"`
93 # make sure svnversion worked
94 if test $?
-ne 0 ; then
95 OMPI_SVN_R
=svn
`date '+%m%d%Y'`
97 svnversion_result
="$OMPI_SVN_R"
99 OMPI_SVN_R
=svn
`date '+%m%d%Y'`
103 OMPI_VERSION
="${OMPI_VERSION}${OMPI_SVN_R}"
108 if test "$option" = ""; then
118 echo $OMPI_MAJOR_VERSION
121 echo $OMPI_MINOR_VERSION
124 echo $OMPI_RELEASE_VERSION
127 echo $OMPI_GREEK_VERSION
133 echo $OMPI_BASE_VERSION
136 echo ${OMPI_VERSION} ${OMPI_MAJOR_VERSION} ${OMPI_MINOR_VERSION} ${OMPI_RELEASE_VERSION} ${OMPI_GREEK_VERSION} ${OMPI_SVN_R}
140 $0 <srcfile> <option>
142 <srcfile> - Text version file
144 --full - Full version number
145 --major - Major version number
146 --minor - Minor version number
147 --release - Release version number
148 --greek - Greek (alpha, beta, etc) version number
149 --svn - Subversion repository number
150 --all - Show all version numbers, separated by :
151 --base - Show base version number (no svn number)
152 --help - This message
156 echo "Unrecognized option $option. Run $0 --help for options"