Skip to content

Commit 43e607f

Browse files
committed
Set version number in header file.
1 parent 65528be commit 43e607f

File tree

2 files changed

+89
-1
lines changed

2 files changed

+89
-1
lines changed

configure.ac

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,66 @@ AC_INIT([OSHMPI],
1212

1313
AC_CONFIG_SRCDIR([src/shmem.c])
1414

15+
# build info
16+
CONFIGURE_ARGS_CLEAN=`echo $* | tr '"' ' '`
17+
AC_SUBST(CONFIGURE_ARGS_CLEAN)
18+
19+
# these values come from the m4_include above
20+
OSHMPI_VERSION=OSHMPI_VERSION_m4
21+
AC_SUBST(OSHMPI_VERSION)
22+
OSHMPI_RELEASE_DATE="OSHMPI_RELEASE_DATE_m4"
23+
AC_SUBST(OSHMPI_RELEASE_DATE)
24+
25+
if test -z "$OSHMPI_VERSION" ; then
26+
AC_MSG_ERROR([OSHMPI_VERSION is empty, check maint/version.m4 for errors])
27+
fi
28+
29+
# Produce a numeric version assuming the following format:
30+
# Version: [MAJ].[MIN].[REV][EXT][EXT_NUMBER]
31+
# Example: 1.0.7rc1 has
32+
# MAJ = 1
33+
# MIN = 0
34+
# REV = 7
35+
# EXT = rc
36+
# EXT_NUMBER = 1
37+
#
38+
# Converting to numeric version will convert EXT to a format number:
39+
# ALPHA (a) = 0
40+
# BETA (b) = 1
41+
# RC (rc) = 2
42+
# PATCH (p) = 3
43+
# Regular releases are treated as patch 0
44+
#
45+
# Numeric version will have 1 digit for MAJ, 2 digits for MIN,
46+
# 2 digits for REV, 1 digit for EXT and 2 digits for EXT_NUMBER.
47+
changequote(<<,>>)
48+
V1=`expr $OSHMPI_VERSION : '\([0-9]*\)\.[0-9]*\.*[0-9]*[a-zA-Z]*[0-9]*'`
49+
V2=`expr $OSHMPI_VERSION : '[0-9]*\.\([0-9]*\)\.*[0-9]*[a-zA-Z]*[0-9]*'`
50+
V3=`expr $OSHMPI_VERSION : '[0-9]*\.[0-9]*\.*\([0-9]*\)[a-zA-Z]*[0-9]*'`
51+
V4=`expr $OSHMPI_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*\([a-zA-Z]*\)[0-9]*'`
52+
V5=`expr $OSHMPI_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*[a-zA-Z]*\([0-9]*\)'`
53+
changequote([,])
54+
55+
if test "$V2" -le 9 ; then V2=0$V2 ; fi
56+
if test "$V3" = "" ; then V3=0; fi
57+
if test "$V3" -le 9 ; then V3=0$V3 ; fi
58+
if test "$V4" = "a" ; then
59+
V4=0
60+
elif test "$V4" = "b" ; then
61+
V4=1
62+
elif test "$V4" = "rc" ; then
63+
V4=2
64+
elif test "$V4" = "" ; then
65+
V4=3
66+
V5=0
67+
elif test "$V4" = "p" ; then
68+
V4=3
69+
fi
70+
if test "$V5" -le 9 ; then V5=0$V5 ; fi
71+
72+
OSHMPI_NUMVERSION=`expr $V1$V2$V3$V4$V5 + 0`
73+
AC_SUBST(OSHMPI_NUMVERSION)
74+
1575
# From ARMCI-MPI
1676
AC_CONFIG_AUX_DIR(m4)
1777
AC_CONFIG_MACRO_DIR(m4)
@@ -250,5 +310,5 @@ fi
250310
#if test -n "$enable_extension_" ; then
251311
# AC_DEFINE(EXTENSION_,1,[Define to enable ])
252312
#fi
253-
313+
AC_CONFIG_FILES([src/shmem.h])
254314
AC_OUTPUT(Makefile)

src/shmem.h renamed to src/shmem.h.in

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,34 @@
2121
#include <complex.h>
2222
#include <assert.h>
2323

24+
/* OSHMPI_VERSION is the version string. OSHMPI_NUMVERSION is the
25+
* numeric version that can be used in numeric comparisons.
26+
*
27+
* OSHMPI_VERSION uses the following format:
28+
* Version: [MAJ].[MIN].[REV][EXT][EXT_NUMBER]
29+
* Example: 1.0.7rc1 has
30+
* MAJ = 1
31+
* MIN = 0
32+
* REV = 7
33+
* EXT = rc
34+
* EXT_NUMBER = 1
35+
*
36+
* OSHMPI_NUMVERSION will convert EXT to a format number:
37+
* ALPHA (a) = 0
38+
* BETA (b) = 1
39+
* RC (rc) = 2
40+
* PATCH (p) = 3
41+
* Regular releases are treated as patch 0
42+
*
43+
* Numeric version will have 1 digit for MAJ, 2 digits for MIN, 2
44+
* digits for REV, 1 digit for EXT and 2 digits for EXT_NUMBER. So,
45+
* 1.0.7rc1 will have the numeric version 10007201.
46+
*/
47+
#define OSHMPI_VERSION "@OSHMPI_VERSION@"
48+
#define OSHMPI_NUMVERSION @OSHMPI_NUMVERSION@
49+
#define OSHMPI_RELEASE_DATE "@OSHMPI_RELEASE_DATE@"
50+
#define OSHMPI_BUILD_INFO "@CONFIGURE_ARGS_CLEAN@"
51+
2452
/* These few lines and the ones they replaced are the only changes to this file. */
2553
/* This header is not needed for the SHMEM public API, but we include it here so *
2654
* we can tell the user at compile time if they are using an MPI implementation *

0 commit comments

Comments
 (0)