there was an #include directive missing
[openmpi-llc.git] / config / ompi_get_version.sh
blob9f2de6ba4f40d43f4ab7108b26dc862c5b0f2c43
1 #!/bin/sh
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
10 # reserved.
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.
15 # $COPYRIGHT$
17 # Additional copyrights may follow
19 # $HEADER$
24 # OMPI_GET_VERSION(version_file, variable_prefix)
25 # -----------------------------------------------
26 # parse version_file for version information, setting
27 # the following shell variables:
29 # prefix_VERSION
30 # prefix_BASE_VERSION
31 # prefix_MAJOR_VERSION
32 # prefix_MINOR_VERSION
33 # prefix_RELEASE_VERSION
34 # prefix_GREEK_VERSION
35 # prefix_WANT_SVN
36 # prefix_SVN_R
40 srcfile="$1"
41 option="$2"
43 case "$option" in
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)
46 ompi_ver_need_svn=0
49 ompi_ver_need_svn=1
50 esac
53 if test -z "$srcfile"; then
54 option="--help"
55 else
57 : ${ompi_ver_need_svn=1}
58 : ${srcdir=.}
59 : ${svnversion_result=-1}
61 if test -f "$srcfile"; then
62 eval "`sed -n \"\
63 t clear
64 : clear
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/
70 s/^svn_r/OMPI_SVN_R/
71 t print
73 : print
74 p\" < \"\$srcfile\"`"
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"
79 else
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"
98 else
99 OMPI_SVN_R=svn`date '+%m%d%Y'`
103 OMPI_VERSION="${OMPI_VERSION}${OMPI_SVN_R}"
108 if test "$option" = ""; then
109 option="--full"
113 case "$option" in
114 --full|-v|--version)
115 echo $OMPI_VERSION
117 --major)
118 echo $OMPI_MAJOR_VERSION
120 --minor)
121 echo $OMPI_MINOR_VERSION
123 --release)
124 echo $OMPI_RELEASE_VERSION
126 --greek)
127 echo $OMPI_GREEK_VERSION
129 --svn)
130 echo $OMPI_SVN_R
132 --base)
133 echo $OMPI_BASE_VERSION
135 --all)
136 echo ${OMPI_VERSION} ${OMPI_MAJOR_VERSION} ${OMPI_MINOR_VERSION} ${OMPI_RELEASE_VERSION} ${OMPI_GREEK_VERSION} ${OMPI_SVN_R}
138 -h|--help)
139 cat <<EOF
140 $0 <srcfile> <option>
142 <srcfile> - Text version file
143 <option> - One of:
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"
158 esac
160 # All done
162 exit 0