]> www.ginac.de Git - ginac.git/commitdiff
[build] Define package version number in version.h (for non autotools build).
authorAlexei Sheplyakov <Alexei.Sheplyakov@gmail.com>
Sun, 29 May 2011 13:27:49 +0000 (16:27 +0300)
committerAlexei Sheplyakov <Alexei.Sheplyakov@gmail.com>
Tue, 17 Jul 2012 04:49:55 +0000 (07:49 +0300)
acinclude.m4
configure.ac
ginac/version.h [moved from ginac/version.h.in with 86% similarity]

index 1e53fa45c41f2bbe6eb0d572ebd1d452220b4c49..d6089d4f0bbf84d46473fe29e52306dd0a0c4b98 100644 (file)
@@ -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], [
index 7ca6c3bb3ee736d5de1aa7a8407702b20565956d..9cdf91282575a6ed709ae1d5a43fbf14154f97d1 100644 (file)
@@ -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.
similarity index 86%
rename from ginac/version.h.in
rename to ginac/version.h
index a8a717577723af6781e9b585dd2e28ae80f2c6ed..b79b9fb5ae7cc035c7fa22a322d83f6af7224d9b 100644 (file)
  *  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