Skip to content
Snippets Groups Projects
Commit 94e9f3d6 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Merge branch 'autotool-fixes' into 'master'

Updates to autotools

Adds new function git_branch() to version.c and support to set it.
Adds --enable-compiler--warnings (error/yes/no), error is default.
Add support for clang sanitizer flags.
Fix small issues in units.c, once warnings become errors.
Make HDF5 compulsory and stop configure if not found.



See merge request !36

Former-commit-id: 74ba76d4cb1eac483283e29394235f36d189f03e
parents 65fa80db 07ab46d3
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,7 @@ AX_COMPILER_VERSION
# http://lists.gnu.org/archive/html/autoconf-archive-maintainers/2011-05/msg00004.html.
AC_ARG_ENABLE([mpi],
[AS_HELP_STRING([--enable-mpi],
[Compile with functionality for distributed-memory parallelism using MPI @<:@default=yes@:>@]
[Compile with functionality for distributed-memory parallelism using MPI @<:@yes/no@:>@]
)],
[enable_mpi="$enableval"],
[enable_mpi="yes"]
......@@ -126,7 +126,7 @@ AX_FUNC_POSIX_MEMALIGN
# appropriate.
AC_ARG_ENABLE([optimization],
[AS_HELP_STRING([--enable-optimization],
[Enable compile time optimization flags for host @<:@default=yes@:>@]
[Enable compile time optimization flags for host @<:@yes/no@:>@]
)],
[enable_opt="$enableval"],
[enable_opt="yes"]
......@@ -151,10 +151,10 @@ if test "$enable_opt" = "yes" ; then
fi
# Add address sanitizer options to flags, if requested. Only useful for GCC
# version 4.8 and later.
# version 4.8 and later and clang.
AC_ARG_ENABLE([sanitizer],
[AS_HELP_STRING([--enable-sanitizer],
[Enable memory error detection using address sanitizer @<:@default=no@:>@]
[Enable memory error detection using address sanitizer @<:@no/yes@:>@]
)],
[enable_san="$enableval"],
[enable_san="no"]
......@@ -164,9 +164,12 @@ if test "$enable_san" = "yes"; then
if test "$ax_cv_c_compiler_vendor" = "gnu"; then
AX_COMPARE_VERSION( $ax_cv_c_compiler_version, [ge], [4.8.0],
[enable_san="yes"], [enable_san="no"] )
if test "$enable_san" = "yes"; then
CFLAGS="$CFLAGS -fsanitize=address -fno-omit-frame-pointer"
fi
elif test "$ax_cv_c_compiler_vendor" = "clang"; then
AX_COMPARE_VERSION( $ax_cv_c_compiler_version, [ge], [3.2.0],
[enable_san="yes"], [enable_san="no"] )
fi
if test "$enable_san" = "yes"; then
CFLAGS="$CFLAGS -fsanitize=address -fno-omit-frame-pointer"
else
AC_MSG_WARN([Compiler does not support address sanitizer option])
fi
......@@ -194,7 +197,7 @@ AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# don't use that.
AC_ARG_WITH([metis],
[AS_HELP_STRING([--with-metis=PATH],
[root directory where metis is installed @<:@default=yes@:>@]
[root directory where metis is installed @<:@yes/no@:>@]
)],
[],
[with_metis="no"]
......@@ -222,9 +225,13 @@ AC_CHECK_LIB([z],[gzopen],[
],[])
# Check for HDF5.
# Check for HDF5. This is required.
AX_LIB_HDF5
if test "$with_hdf5" != "yes"; then
AC_MSG_ERROR([Could not find a working HDF5 library])
fi
# We want to know if this HDF5 supports MPI and whether we should use it.
# The default is to use MPI support if it is available, i.e. this is
# a parallel HDF5.
......@@ -234,7 +241,7 @@ have_parallel_hdf5="no"
if test "$with_hdf5" = "yes"; then
AC_ARG_ENABLE([parallel-hdf5],
[AS_HELP_STRING([--enable-parallel-hdf5],
[Enable parallel HDF5 library MPI functions if available. @<:@default=yes@:>@]
[Enable parallel HDF5 library MPI functions if available. @<:@yes/no@:>@]
)],
[enable_parallel_hdf5="$enableval"],
[enable_parallel_hdf5="yes"]
......@@ -275,6 +282,28 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM(
[AC_DEFINE(HAVE__RTC,1,[Define if you have the UNICOS _rtc() intrinsic.])],[rtc_ok=no])
AC_MSG_RESULT($rtc_ok)
# Add warning flags by default, if these can be used. Option =error adds
# -Werror to GCC and Intel. Note do this last as compiler tests may become
# errors, if that's an issue don't use CFLAGS for these, use an AC_SUBST().
AC_ARG_ENABLE([compiler-warnings],
[AS_HELP_STRING([--enable-compiler-warnings],
[Enable compile time warning flags, if compiler is known @<:@error/no/yes)@:>@]
)],
[enable_warn="$enableval"],
[enable_warn="error"]
)
if test "$enable_warn" != "no"; then
AX_CFLAGS_WARN_ALL
if test "$enable_warn" = "error"; then
case "$ax_cv_c_compiler_vendor" in
intel | gnu )
CFLAGS="$CFLAGS -Werror"
;;
esac
fi
fi
# Check for git, needed for revision stamps.
AC_PATH_PROG([GIT_CMD], [git])
AC_SUBST([GIT_CMD])
......
......@@ -20,7 +20,7 @@
MYFLAGS = -DTIMER
# Add the source directory and debug to CFLAGS
AM_CFLAGS = -Wall -Werror -I../src -DCPU_TPS=2.67e9 $(HDF5_CPPFLAGS)
AM_CFLAGS = -I../src -DCPU_TPS=2.67e9 $(HDF5_CPPFLAGS)
AM_LDFLAGS =
......
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
#
# DESCRIPTION
#
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
# added in between.
#
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
# FLAG.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 5
AC_DEFUN([AX_APPEND_FLAG],
[dnl
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
AS_VAR_SET_IF(FLAGS,[
AS_CASE([" AS_VAR_GET(FLAGS) "],
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
[
AS_VAR_APPEND(FLAGS," $1")
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
],
[
AS_VAR_SET(FLAGS,[$1])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
AS_VAR_POPDEF([FLAGS])dnl
])dnl AX_APPEND_FLAG
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
# AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
# AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
#
# DESCRIPTION
#
# Try to find a compiler option that enables most reasonable warnings.
#
# For the GNU compiler it will be -Wall (and -ansi -pedantic) The result
# is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default.
#
# Currently this macro knows about the GCC, Solaris, Digital Unix, AIX,
# HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and
# Intel compilers. For a given compiler, the Fortran flags are much more
# experimental than their C equivalents.
#
# - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS
# - $2 add-value-if-not-found : nothing
# - $3 action-if-found : add value to shellvariable
# - $4 action-if-not-found : nothing
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2010 Rhys Ulerich <rhys.ulerich@gmail.com>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 9
AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
VAR,[VAR="no, unknown"
AC_LANG_PUSH([C])
ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic % -Wall" dnl GCC
"-xstrconst % -v" dnl Solaris C
"-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
"-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
"-ansi -ansiE % -fullwarn" dnl IRIX
"+ESlit % +w1" dnl HP-UX C
"-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
"-h conform % -h msglevel 2" dnl Cray C (Unicos)
#
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
done
FLAGS="$ac_save_[]FLAGS"
AC_LANG_POP([C])
])
case ".$VAR" in
.ok|.ok,*) m4_ifvaln($3,$3) ;;
.|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
*) m4_ifvaln($3,$3,[
if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
fi ]) ;;
esac
AS_VAR_POPDEF([VAR])dnl
AS_VAR_POPDEF([FLAGS])dnl
])
dnl the only difference - the LANG selection... and the default FLAGS
AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_warn_all])dnl
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
VAR,[VAR="no, unknown"
AC_LANG_PUSH([C++])
ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-pedantic % -Wall" dnl GCC
"-xstrconst % -v" dnl Solaris C
"-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
"-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
"-ansi -ansiE % -fullwarn" dnl IRIX
"+ESlit % +w1" dnl HP-UX C
"-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
"-h conform % -h msglevel 2" dnl Cray C (Unicos)
#
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
done
FLAGS="$ac_save_[]FLAGS"
AC_LANG_POP([C++])
])
case ".$VAR" in
.ok|.ok,*) m4_ifvaln($3,$3) ;;
.|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
*) m4_ifvaln($3,$3,[
if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
fi ]) ;;
esac
AS_VAR_POPDEF([VAR])dnl
AS_VAR_POPDEF([FLAGS])dnl
])
dnl the only difference - the LANG selection... and the default FLAGS
AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl
AS_VAR_PUSHDEF([FLAGS],[FCFLAGS])dnl
AS_VAR_PUSHDEF([VAR],[ax_cv_fcflags_warn_all])dnl
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
VAR,[VAR="no, unknown"
AC_LANG_PUSH([Fortran])
ac_save_[]FLAGS="$[]FLAGS"
for ac_arg dnl
in "-warn all % -warn all" dnl Intel
"-pedantic % -Wall" dnl GCC
"-xstrconst % -v" dnl Solaris C
"-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
"-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
"-ansi -ansiE % -fullwarn" dnl IRIX
"+ESlit % +w1" dnl HP-UX C
"-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
"-h conform % -h msglevel 2" dnl Cray C (Unicos)
#
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
done
FLAGS="$ac_save_[]FLAGS"
AC_LANG_POP([Fortran])
])
case ".$VAR" in
.ok|.ok,*) m4_ifvaln($3,$3) ;;
.|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
*) m4_ifvaln($3,$3,[
if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
fi ]) ;;
esac
AS_VAR_POPDEF([VAR])dnl
AS_VAR_POPDEF([FLAGS])dnl
])
dnl implementation tactics:
dnl the for-argument contains a list of options. The first part of
dnl these does only exist to detect the compiler - usually it is
dnl a global option to enable -ansi or -extrawarnings. All other
dnl compilers will fail about it. That was needed since a lot of
dnl compilers will give false positives for some option-syntax
dnl like -Woption or -Xoption as they think of it is a pass-through
dnl to later compile stages or something. The "%" is used as a
dnl delimiter. A non-option comment can be given after "%%" marks
dnl which will be shown but not added to the respective C/CXXFLAGS.
......@@ -22,6 +22,8 @@
# yes - do check for HDF5 library in standard locations.
# path - complete path to the HDF5 helper script h5cc or h5pcc.
#
# SWIFT modification: HDF5 is required, so only path is described.
#
# If HDF5 is successfully found, this macro calls
#
# AC_SUBST(HDF5_VERSION)
......@@ -110,7 +112,7 @@ fi
dnl Add a default --with-hdf5 configuration option.
AC_ARG_WITH([hdf5],
AS_HELP_STRING(
[--with-hdf5=[yes/no/PATH]],
[--with-hdf5=[PATH]],
m4_case(m4_normalize([$1]),
[serial], [location of h5cc for serial HDF5 configuration],
[parallel], [location of h5pcc for parallel HDF5 configuration],
......@@ -160,15 +162,15 @@ if test "$with_hdf5" = "yes"; then
[serial], [
Unable to locate serial HDF5 compilation helper script 'h5cc'.
Please specify --with-hdf5=<LOCATION> as the full path to h5cc.
HDF5 support is being disabled (equivalent to --with-hdf5=no).
HDF5 support is being disabled.
], [parallel],[
Unable to locate parallel HDF5 compilation helper script 'h5pcc'.
Please specify --with-hdf5=<LOCATION> as the full path to h5pcc.
HDF5 support is being disabled (equivalent to --with-hdf5=no).
HDF5 support is being disabled.
], [
Unable to locate HDF5 compilation helper scripts 'h5cc' or 'h5pcc'.
Please specify --with-hdf5=<LOCATION> as the full path to h5cc or h5pcc.
HDF5 support is being disabled (equivalent to --with-hdf5=no).
HDF5 support is being disabled.
]))
with_hdf5="no"
with_hdf5_fortran="no"
......
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_require_defined.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_REQUIRE_DEFINED(MACRO)
#
# DESCRIPTION
#
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
# been defined and thus are available for use. This avoids random issues
# where a macro isn't expanded. Instead the configure script emits a
# non-fatal:
#
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
#
# It's like AC_REQUIRE except it doesn't expand the required macro.
#
# Here's an example:
#
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
#
# LICENSE
#
# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 1
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
])dnl AX_REQUIRE_DEFINED
......@@ -62,13 +62,16 @@ libswiftsim_mpi_la_SHORTNAME = mpi
# download), allow that, but make sure we know it.
version.h: version.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_HEADERS)
if test "X$(GIT_CMD)" != "X"; then \
GIT_REVISION=`git describe --abbrev=8 --always --tags --dirty`; \
GIT_REVISION=`$(GIT_CMD) describe --abbrev=8 --always --tags --dirty`; \
GIT_BRANCH=`$(GIT_CMD) symbolic-ref --short HEAD`; \
sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
-e "s,@GIT_REVISION\@,$${GIT_REVISION}," version.h.in > version.h; \
-e "s,@GIT_REVISION\@,$${GIT_REVISION}," \
-e "s,@GIT_BRANCH\@,$${GIT_BRANCH}," version.h.in > version.h; \
else \
if test ! -f version.h; then \
sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
-e "s,@GIT_REVISION\@,unknown," version.h.in > version.h; \
-e "s,@GIT_REVISION\@,unknown," \
-e "s,@GIT_BRANCH\@,unknown," version.h.in > version.h; \
fi; \
fi
......
......@@ -76,6 +76,7 @@ double getBaseUnit(struct UnitSystem* us, enum BaseUnits baseUnit) {
default:
error("Invalid base Unit");
}
return 0.0;
}
/**
......@@ -97,6 +98,7 @@ const char* getBaseUnitSymbol(enum BaseUnits baseUnit) {
default:
error("Invalid base Unit");
}
return "";
}
/**
......@@ -118,6 +120,7 @@ const char* getBaseUnitCGSSymbol(enum BaseUnits baseUnit) {
default:
error("Invalid base Unit");
}
return "";
}
void getBaseUnitExponantsArray(float baseUnitsExp[5],
......
......@@ -35,6 +35,17 @@ const char *git_revision(void) {
return revision;
}
/**
* @brief Return the source code git branch
*
* @details The name of the current branch when the code was last built.
*/
const char *git_branch(void) {
static const char *branch = GIT_BRANCH;
return branch;
}
/**
* @brief The version of SWIFT
*/
......@@ -50,8 +61,8 @@ const char *package_description(void) {
static char buf[256];
static int initialised = 0;
if (!initialised) {
sprintf(buf, "SWIFT version: %s, at revision: %s", PACKAGE_VERSION,
GIT_REVISION);
sprintf(buf, "SWIFT version: %s, at revision: %s, branch: %s",
PACKAGE_VERSION, GIT_REVISION, GIT_BRANCH);
initialised = 1;
}
return buf;
......@@ -72,6 +83,6 @@ void greetings(void) {
printf(" SPH With Inter-dependent Fine-grained Tasking\n\n");
printf(" Version : %s\n", package_version());
printf(" Revision: %s\n", git_revision());
printf(" Revision: %s, branch: %s\n", git_revision(), git_branch());
printf(" Webpage : www.swiftsim.com\n\n");
}
......@@ -27,10 +27,12 @@
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
#define GIT_REVISION "@GIT_REVISION@"
#define GIT_BRANCH "@GIT_BRANCH@"
const char* package_description( void );
const char* package_description(void);
const char* package_version(void);
const char* git_revision(void);
const char* git_branch(void);
void greetings(void);
#endif /* SWIFT_VERSION_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment