From: Alexei Sheplyakov Date: Sun, 29 May 2011 13:27:49 +0000 (+0300) Subject: [build] Define package version number in version.h (for non autotools build). X-Git-Tag: release_1-6-3~62 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=e0f0681b814fecff5523d21b4368ebbeecc330eb [build] Define package version number in version.h (for non autotools build). --- diff --git a/acinclude.m4 b/acinclude.m4 index 1e53fa45..d6089d4f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -4,6 +4,22 @@ dnl additions' names with AC_ but with GINAC_ in order to steer clear of dnl future trouble. dnl =========================================================================== +dnl GINAC_HEADER_GETVAL(NAME,FILE) +dnl ---------------------------- +dnl Expand at autoconf time to the value of a "#define NAME" from the given +dnl FILE. The regexps here aren't very rugged, but are enough for us. +dnl /dev/null as a parameter prevents a hang if $2 is accidentally omitted. +dnl (shamelessly ripped from GMP, and changed prefix to GINAC_). + +define(GINAC_HEADER_GETVAL, +[patsubst(patsubst( +esyscmd([grep "^#define $1 " $2 /dev/null 2>/dev/null]), +[^.*$1[ ]+],[]), +[[ + ]*$],[])]) +define(GINAC_GET_VERSION, +[GINAC_HEADER_GETVAL(GINACLIB_$1_VERSION,[ginac/version.h])]) + dnl Usage: GINAC_STD_CXX_HEADERS dnl Check for standard C++ headers, bail out if something is missing. AC_DEFUN([GINAC_STD_CXX_HEADERS], [ diff --git a/configure.ac b/configure.ac index 7ca6c3bb..9cdf9128 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,9 @@ dnl Process this file with autoconf to produce a configure script. dnl GiNaC version number -m4_define([ginac_major_version], [1]) -m4_define([ginac_minor_version], [6]) -m4_define([ginac_micro_version], [2]) +m4_define([ginac_major_version], GINAC_GET_VERSION([MAJOR])) +m4_define([ginac_minor_version], GINAC_GET_VERSION([MINOR])) +m4_define([ginac_micro_version], GINAC_GET_VERSION([MICRO])) m4_define([ginac_version], [ginac_major_version.ginac_minor_version.ginac_micro_version]) m4_define([ginac_release], [ginac_major_version.ginac_minor_version]) @@ -32,16 +32,11 @@ AC_INIT([GiNaC], ginac_version, [ginac-list@ginac.de], [ginac], [http://www.gina AC_PREREQ(2.59) AC_CONFIG_SRCDIR(ginac/basic.cpp) AC_CONFIG_AUX_DIR([config]) -AC_CONFIG_HEADERS([config/config.h ginac/version.h]) +AC_CONFIG_HEADERS([config/config.h]) AC_CONFIG_MACRO_DIR([m4]) dnl This defines PACKAGE and VERSION. AM_INIT_AUTOMAKE([gnu 1.8 dist-bzip2]) -dnl Process GiNaC version information -AC_DEFINE([GINACLIB_MAJOR_VERSION], ginac_major_version, [Major version of GiNaC]) -AC_DEFINE([GINACLIB_MINOR_VERSION], ginac_minor_version, [Minor version of GiNaC]) -AC_DEFINE([GINACLIB_MICRO_VERSION], ginac_micro_version, [Micro version of GiNaC]) - dnl GiNaC archive file version information. dnl dnl If properties have been added, ARCHIVE_VERSION += 1, ARCHIVE_AGE += 1. diff --git a/ginac/version.h.in b/ginac/version.h similarity index 86% rename from ginac/version.h.in rename to ginac/version.h index a8a71757..b79b9fb5 100644 --- a/ginac/version.h.in +++ b/ginac/version.h @@ -20,17 +20,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __GINAC_VERSION_H__ -#define __GINAC_VERSION_H__ +#ifndef GINAC_VERSION_H +#define GINAC_VERSION_H /* Major version of GiNaC */ -#undef GINACLIB_MAJOR_VERSION +#define GINACLIB_MAJOR_VERSION 1 /* Minor version of GiNaC */ -#undef GINACLIB_MINOR_VERSION +#define GINACLIB_MINOR_VERSION 6 /* Micro version of GiNaC */ -#undef GINACLIB_MICRO_VERSION +#define GINACLIB_MICRO_VERSION 2 namespace GiNaC { @@ -40,4 +40,4 @@ extern const int version_micro; } // namespace GiNaC -#endif // ndef __GINAC_VERSION_H__ +#endif // ndef GINAC_VERSION_H