Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion repos/spack_repo/builtin/build_systems/autotools.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import subprocess
from typing import Callable, List, Optional, Set, Tuple, Union

from spack import deptypes
from spack.package import (
BuilderWithDefaults,
Executable,
Expand Down Expand Up @@ -856,7 +857,11 @@ def _autoreconf_search_path_args(spec: Spec) -> List[str]:
except OSError:
pass

for dep in spec.dependencies(deptype="build"):
for edge in spec.edges_to_dependencies(depflag=deptypes.BUILD):
# compiler prefixes might have foreign aclocal files which we do not want to include
if any(language in edge.virtuals for language in ("c", "cxx", "fortran")):
continue
dep = edge.spec
path = dep.prefix.share.aclocal
# Skip non-existing aclocal paths
try:
Expand Down
18 changes: 18 additions & 0 deletions tests/build_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,24 @@ def test_autoreconf_search_path_args_external_order(
]


def test_autoreconf_search_path_args_skip_compiler(
default_mock_concretization, tmp_path: pathlib.Path
):
"""Compiler prefixes are not aclocal macro providers."""
spec = default_mock_concretization("dttop")
compiler, macro_provider = spec.dependencies(deptype="build")
compiler_aclocal = tmp_path / "compiler" / "share" / "aclocal"
provider_aclocal = tmp_path / "provider" / "share" / "aclocal"
compiler_aclocal.mkdir(parents=True)
provider_aclocal.mkdir(parents=True)
compiler.external_path = str(tmp_path / "compiler")
macro_provider.set_prefix(str(tmp_path / "provider"))
compiler_edge = next(edge for edge in spec.edges_to_dependencies() if edge.spec is compiler)
compiler_edge.virtuals = ("c", "cxx")

assert autotools._autoreconf_search_path_args(spec) == ["-I", str(provider_aclocal)]


def test_autoreconf_search_path_skip_nonexisting(
default_mock_concretization, tmp_path: pathlib.Path
):
Expand Down
Loading