From: Youhei SASAKI <uwabami@gfd-dennou.org>
Date: Tue, 3 Mar 2026 00:20:10 +0900
Subject: Fix NetCDF version check

Forwarded: not-needed
Signed-off-by: Youhei SASAKI <uwabami@gfd-dennou.org>
--- a/ext/numru/extconf.rb
+++ b/ext/numru/extconf.rb
@@ -28,8 +28,8 @@
 
 if ( ! ( have_header("narray.h") && have_header("narray_config.h") ) ) then
 print <<EOS
-** configure error **  
-   Header narray.h or narray_config.h is not found. If you have these files in 
+** configure error **
+   Header narray.h or narray_config.h is not found. If you have these files in
    /narraydir/include, try the following:
 
    % ruby extconf.rb --with-narray-include=/narraydir/include
@@ -38,7 +38,7 @@
    exit(-1)
 end
 
-unless  ncversion 
+unless  ncversion
   # configure netcdf version
   if xsystem("nc-config --version")
     ncversion = `nc-config --version`.chomp!.sub!(/^n.* /i,"") # rm "netCDF "
@@ -51,8 +51,8 @@
 
 ncver0 = ncversion[0..0]  # "3" or "4"
 ncver = ncversion.gsub(/\./,'')
-unless /^\d\d\d(\-rc)?$/ =~ ncver   # 3 digits
-  raise("Invalid netcdf version: #{ncversion}. Use --with-netcdf-version=") 
+unless /^\d{3,}(\-rc)?$/ =~ ncver
+  raise("Invalid netcdf version: #{ncversion}. Use --with-netcdf-version=")
 end
 $CFLAGS += ' -DNCVER='+ncver
 
@@ -110,10 +110,10 @@
     CONFIG['LDSHARED'].sub!(/gcc/,'g++')
     $LIBS.sub!(/-lc\s/,'') ; $LIBS.sub!(/-lc$/,'')
     print <<-EOS
-      ** Warning **  non-portable treatments are made, 
+      ** Warning **  non-portable treatments are made,
       which was sucessfull redhat linux 9:
        * gcc was replaced with g++ in CONFIG['LDSHARED']
-       * -lc library was removed if in $LIBS 
+       * -lc library was removed if in $LIBS
 
     EOS
     #  p '@@@'
@@ -123,8 +123,8 @@
   else
     if ( ! ( have_header("netcdf.h") && have_library("netcdf") ) )then
       print <<-EOS
-      ** configure error **  
-         Header netcdf.h or the compiled netcdf library is not found. 
+      ** configure error **
+         Header netcdf.h or the compiled netcdf library is not found.
          If you have the library installed under /netcdfdir (that is, netcdf.h is
          in /netcdfdir/include and the library in /netcdfdir/lib/),
          try the following:
@@ -160,9 +160,9 @@
       newmkfl.puts("\t\t@$(RM) *.nc demo/*.nc demo/*~ lib/*~ doc/*~ test/*.nc test/*~ Makefile.orig")
    when /^all:/
       newmkfl.puts(line)
-      newmkfl.puts("")         
+      newmkfl.puts("")
       newmkfl.puts("test: all")            # insert the "test" target
-      newmkfl.puts("\t\t@cd test && ruby test.rb && echo 'test did not fail :-p (please ignore the warnings)' && cd ..") 
+      newmkfl.puts("\t\t@cd test && ruby test.rb && echo 'test did not fail :-p (please ignore the warnings)' && cd ..")
 #   when /lib\/netcdf/
 #      line = line.chomp! + "/"
 #      newmkfl.puts(line)
