diff --git a/var/spack/repos/builtin/packages/apr-util/package.py b/var/spack/repos/builtin/packages/apr-util/package.py index 5ac152ba47..df1379a0fa 100644 --- a/var/spack/repos/builtin/packages/apr-util/package.py +++ b/var/spack/repos/builtin/packages/apr-util/package.py @@ -32,6 +32,7 @@ class AprUtil(AutotoolsPackage): depends_on("postgresql", when="+pgsql") depends_on("sqlite", when="+sqlite") depends_on("unixodbc", when="+odbc") + depends_on("pkg-config", type="build", when="+crypto ^openssl~shared") @property def libs(self): @@ -85,6 +86,13 @@ def configure_args(self): else: args.append("--without-odbc") + if spec.satisfies("+crypto ^openssl~shared"): + # Need pkg-config to get zlib and -ldl flags + # (see https://dev.apr.apache.narkive.com/pNnO9F1S/configure-bug-openssl) + pkgconf = which("pkg-config") + ssl_libs = pkgconf("--libs", "--static", "openssl", output=str) + args.append(f"LIBS={ssl_libs}") + return args def check(self):