Skip to content

Commit

Permalink
Set version number in header file.
Browse files Browse the repository at this point in the history
  • Loading branch information
minsii committed Nov 11, 2018
1 parent 65528be commit 43e607f
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
62 changes: 61 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,66 @@ AC_INIT([OSHMPI],

AC_CONFIG_SRCDIR([src/shmem.c])

# build info
CONFIGURE_ARGS_CLEAN=`echo $* | tr '"' ' '`
AC_SUBST(CONFIGURE_ARGS_CLEAN)

# these values come from the m4_include above
OSHMPI_VERSION=OSHMPI_VERSION_m4
AC_SUBST(OSHMPI_VERSION)
OSHMPI_RELEASE_DATE="OSHMPI_RELEASE_DATE_m4"
AC_SUBST(OSHMPI_RELEASE_DATE)

if test -z "$OSHMPI_VERSION" ; then
AC_MSG_ERROR([OSHMPI_VERSION is empty, check maint/version.m4 for errors])
fi

# Produce a numeric version assuming the following format:
# Version: [MAJ].[MIN].[REV][EXT][EXT_NUMBER]
# Example: 1.0.7rc1 has
# MAJ = 1
# MIN = 0
# REV = 7
# EXT = rc
# EXT_NUMBER = 1
#
# Converting to numeric version will convert EXT to a format number:
# ALPHA (a) = 0
# BETA (b) = 1
# RC (rc) = 2
# PATCH (p) = 3
# Regular releases are treated as patch 0
#
# Numeric version will have 1 digit for MAJ, 2 digits for MIN,
# 2 digits for REV, 1 digit for EXT and 2 digits for EXT_NUMBER.
changequote(<<,>>)
V1=`expr $OSHMPI_VERSION : '\([0-9]*\)\.[0-9]*\.*[0-9]*[a-zA-Z]*[0-9]*'`
V2=`expr $OSHMPI_VERSION : '[0-9]*\.\([0-9]*\)\.*[0-9]*[a-zA-Z]*[0-9]*'`
V3=`expr $OSHMPI_VERSION : '[0-9]*\.[0-9]*\.*\([0-9]*\)[a-zA-Z]*[0-9]*'`
V4=`expr $OSHMPI_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*\([a-zA-Z]*\)[0-9]*'`
V5=`expr $OSHMPI_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*[a-zA-Z]*\([0-9]*\)'`
changequote([,])

if test "$V2" -le 9 ; then V2=0$V2 ; fi
if test "$V3" = "" ; then V3=0; fi
if test "$V3" -le 9 ; then V3=0$V3 ; fi
if test "$V4" = "a" ; then
V4=0
elif test "$V4" = "b" ; then
V4=1
elif test "$V4" = "rc" ; then
V4=2
elif test "$V4" = "" ; then
V4=3
V5=0
elif test "$V4" = "p" ; then
V4=3
fi
if test "$V5" -le 9 ; then V5=0$V5 ; fi

OSHMPI_NUMVERSION=`expr $V1$V2$V3$V4$V5 + 0`
AC_SUBST(OSHMPI_NUMVERSION)

# From ARMCI-MPI
AC_CONFIG_AUX_DIR(m4)
AC_CONFIG_MACRO_DIR(m4)
Expand Down Expand Up @@ -250,5 +310,5 @@ fi
#if test -n "$enable_extension_" ; then
# AC_DEFINE(EXTENSION_,1,[Define to enable ])
#fi

AC_CONFIG_FILES([src/shmem.h])
AC_OUTPUT(Makefile)
28 changes: 28 additions & 0 deletions src/shmem.h → src/shmem.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,34 @@
#include <complex.h>
#include <assert.h>

/* OSHMPI_VERSION is the version string. OSHMPI_NUMVERSION is the
* numeric version that can be used in numeric comparisons.
*
* OSHMPI_VERSION uses the following format:
* Version: [MAJ].[MIN].[REV][EXT][EXT_NUMBER]
* Example: 1.0.7rc1 has
* MAJ = 1
* MIN = 0
* REV = 7
* EXT = rc
* EXT_NUMBER = 1
*
* OSHMPI_NUMVERSION will convert EXT to a format number:
* ALPHA (a) = 0
* BETA (b) = 1
* RC (rc) = 2
* PATCH (p) = 3
* Regular releases are treated as patch 0
*
* Numeric version will have 1 digit for MAJ, 2 digits for MIN, 2
* digits for REV, 1 digit for EXT and 2 digits for EXT_NUMBER. So,
* 1.0.7rc1 will have the numeric version 10007201.
*/
#define OSHMPI_VERSION "@OSHMPI_VERSION@"
#define OSHMPI_NUMVERSION @OSHMPI_NUMVERSION@
#define OSHMPI_RELEASE_DATE "@OSHMPI_RELEASE_DATE@"
#define OSHMPI_BUILD_INFO "@CONFIGURE_ARGS_CLEAN@"

/* These few lines and the ones they replaced are the only changes to this file. */
/* This header is not needed for the SHMEM public API, but we include it here so *
* we can tell the user at compile time if they are using an MPI implementation *
Expand Down

0 comments on commit 43e607f

Please sign in to comment.