summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>2022-11-07 15:49:55 +0100
committerGitHub <noreply@github.com>2022-11-07 15:49:55 +0100
commit74c3fbdf87fa685cc915a1a07175849c7abe386f (patch)
tree07c6a6bdcde91ac24bb9968eba20255abcc2ab9d
parent492525fda5e6f7a49a371bcde11412d85eba9102 (diff)
downloadspack-74c3fbdf87fa685cc915a1a07175849c7abe386f.tar.gz
spack-74c3fbdf87fa685cc915a1a07175849c7abe386f.tar.bz2
spack-74c3fbdf87fa685cc915a1a07175849c7abe386f.tar.xz
spack-74c3fbdf87fa685cc915a1a07175849c7abe386f.zip
netcdf-c: add variant optimize (#33642)
-rw-r--r--var/spack/repos/builtin/packages/netcdf-c/package.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/netcdf-c/package.py b/var/spack/repos/builtin/packages/netcdf-c/package.py
index 3207163747..de3f8950cc 100644
--- a/var/spack/repos/builtin/packages/netcdf-c/package.py
+++ b/var/spack/repos/builtin/packages/netcdf-c/package.py
@@ -77,6 +77,7 @@ class NetcdfC(AutotoolsPackage):
variant("jna", default=False, description="Enable JNA support")
variant("fsync", default=False, description="Enable fsync support")
variant("zstd", default=True, description="Enable ZStandard compression", when="@4.9.0:")
+ variant("optimize", default=True, description="Enable -O2 for a more optimized lib")
# It's unclear if cdmremote can be enabled if '--enable-netcdf-4' is passed
# to the configure script. Since netcdf-4 support is mandatory we comment
@@ -161,6 +162,9 @@ class NetcdfC(AutotoolsPackage):
"--enable-netcdf-4",
]
+ if "+optimize" in self.spec:
+ cflags.append("-O2")
+
config_args.extend(self.enable_or_disable("fsync"))
# The flag was introduced in version 4.3.1
@@ -169,9 +173,7 @@ class NetcdfC(AutotoolsPackage):
config_args += self.enable_or_disable("shared")
- if "~shared" in self.spec or "+pic" in self.spec:
- # We don't have shared libraries but we still want it to be
- # possible to use this library in shared builds
+ if "+pic" in self.spec:
cflags.append(self.compiler.cc_pic_flag)
config_args += self.enable_or_disable("dap")