From ebc32319f687ee2ee3840c8f92bae650c1a0a6f5 Mon Sep 17 00:00:00 2001
From: Michael Kuhn <michael.kuhn@informatik.uni-hamburg.de>
Date: Thu, 9 May 2019 19:23:49 +0200
Subject: [PATCH] netcdf: Fix build if curl is not installed (#11387)

For 4.7.0, configure fails if curl is not installed.
---
 var/spack/repos/builtin/packages/netcdf/package.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/var/spack/repos/builtin/packages/netcdf/package.py b/var/spack/repos/builtin/packages/netcdf/package.py
index 304397025d..09bdbbd17f 100644
--- a/var/spack/repos/builtin/packages/netcdf/package.py
+++ b/var/spack/repos/builtin/packages/netcdf/package.py
@@ -50,6 +50,10 @@ def url_for_version(self, version):
     version('4.3.3.1', sha256='bdde3d8b0e48eed2948ead65f82c5cfb7590313bc32c4cf6c6546e4cea47ba19')
     version('4.3.3',   sha256='83223ed74423c685a10f6c3cfa15c2d6bf7dc84b46af1e95b9fa862016aaa27e')
 
+    # configure fails if curl is not installed.
+    # See https://github.com/Unidata/netcdf-c/issues/1390
+    patch('https://github.com/Unidata/netcdf-c/commit/e5315da1e748dc541d50796fb05233da65e86b6b.patch', sha256='10a1c3f7fa05e2c82457482e272bbe04d66d0047b237ad0a73e87d63d848b16c', when='@4.7.0')
+
     variant('mpi', default=True,
             description='Enable parallel I/O for netcdf-4')
     variant('parallel-netcdf', default=False,
@@ -82,6 +86,11 @@ def url_for_version(self, version):
         values=is_integral
     )
 
+    # The patch for 4.7.0 touches configure.ac. See force_autoreconf below.
+    depends_on('autoconf', type='build', when='@4.7.0')
+    depends_on('automake', type='build', when='@4.7.0')
+    depends_on('libtool', type='build', when='@4.7.0')
+
     depends_on("m4", type='build')
     depends_on("hdf", when='+hdf4')
 
@@ -137,6 +146,11 @@ def url_for_version(self, version):
     conflicts('+parallel-netcdf', when='@:4.0')
     conflicts('+hdf4', when='@:4.0')
 
+    @property
+    def force_autoreconf(self):
+        # The patch for 4.7.0 touches configure.ac.
+        return self.spec.satisfies('@4.7.0')
+
     def patch(self):
         try:
             max_dims = int(self.spec.variants['maxdims'].value)
-- 
GitLab