From 8f0b8b7d5f1092aff7a394f213b1a698a3648a1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20H=C3=A6gland?= Date: Wed, 3 Jul 2024 11:42:49 +0200 Subject: [PATCH] Remove leading zeros in the numerical version --- inc/GSLBuilder.pm | 6 ++++++ swig/SparseMatrix.i | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/inc/GSLBuilder.pm b/inc/GSLBuilder.pm index 6977c7c7..dac3ab08 100644 --- a/inc/GSLBuilder.pm +++ b/inc/GSLBuilder.pm @@ -207,6 +207,12 @@ sub compile_swig { my @swig_flags = defined($p->{swig_flags}) ? $self->split_like_shell($p->{swig_flags}) : (); push @swig_flags, "-I./include"; my ($major, $minor, $numerical_ver) = reformat_version($ver); + if ($numerical_ver =~ /^0+$/) { + die "Unexpected swig version: $ver"; + } + else { + $numerical_ver =~ s/^0+//; # Swig seems to have problems with leading zeros + } push @swig_flags, "-DMG_GSL_MAJOR_VERSION=$major", "-DMG_GSL_MINOR_VERSION=$minor", "-DMG_GSL_VERSION=\"$major.$minor\"", diff --git a/swig/SparseMatrix.i b/swig/SparseMatrix.i index 54424734..50005bef 100644 --- a/swig/SparseMatrix.i +++ b/swig/SparseMatrix.i @@ -9,7 +9,13 @@ #include "gsl/gsl_spmatrix.h" %} -#if MG_GSL_NUM_VERSION >= 002006 +#if MG_GSL_NUM_VERSION >= 2006 +%warn "Including new GSL headers"; +#else +%warn "Including legacy GSL headers"; +#endif + +#if MG_GSL_NUM_VERSION >= 2006 // ignore gsl_spmatrix_uchar_norm1, gsl_spmatrix_char_norm1, ... %rename("%(regex:/^gsl_spmatrix_u.*_norm1$/$ignore/)s") ""; %include "gsl/gsl_spmatrix.h"