>>  It looks like the existing GSL_VERSION #define was set automagically
>>  by autoconf via @vers...@.  The patch you submitted seems to hard code
>>  two fixed values.
>>
>
> Unfortunately, I am unfamiliar with how autoconfig generator works.
> Please, feel free to modify the patch.

Attached is a patch like Leo's that performs the autoconf voodoo to
get the version numbers automatically from VERSION at configure time.
It builds atop head.  Note that it uses AC_PROG_SED, which may/may not
be an issue depending on GSL's portability requirements.

- Rhys
From 4a26161bfcec9a2921964218cd4bf7b98b02ec46 Mon Sep 17 00:00:00 2001
From: Rhys Ulerich <[email protected]>
Date: Fri, 15 Jan 2010 10:26:17 -0600
Subject: [PATCH] Added GSL_VERSION_{MAJOR,MINOR} macros with numeric constants

Constants are usable in preprocessor conditionals.
Patch follows earlier work by Leo Razoumov
---
 configure.ac     |   12 ++++++++++++
 gsl_version.h.in |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index f9f5b04..421e160 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,6 +82,18 @@ AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_LIBTOOL
 
+dnl Split VERSION into GSL_VERSION_MAJOR and GSL_VERSION_MINOR
+dnl Follows AX_SPLIT_VERSION macro from AC-Archive
+AC_PROG_SED
+AC_MSG_CHECKING([package major version])
+GSL_VERSION_MAJOR=`echo "$VERSION" | $SED 's/\([[^.]][[^.]]*\).*/\1/'`
+AC_MSG_RESULT([$GSL_VERSION_MAJOR])
+AC_SUBST(GSL_VERSION_MAJOR)
+AC_MSG_CHECKING([package minor version])
+GSL_VERSION_MINOR=`echo "$VERSION" | $SED 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
+AC_MSG_RESULT([$GSL_VERSION_MINOR])
+AC_SUBST(GSL_VERSION_MINOR)
+
 dnl Check compiler features
 AC_TYPE_SIZE_T
 dnl AC_C_CONST
diff --git a/gsl_version.h.in b/gsl_version.h.in
index 25bf3a3..591b9c6 100644
--- a/gsl_version.h.in
+++ b/gsl_version.h.in
@@ -16,6 +16,8 @@ __BEGIN_DECLS
 
 
 #define GSL_VERSION "@VERSION@"
+#define GSL_VERSION_MAJOR @GSL_VERSION_MAJOR@
+#define GSL_VERSION_MINOR @GSL_VERSION_MINOR@
 
 GSL_VAR const char * gsl_version;
 
-- 
1.5.4.3

_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to