Language-specific PIC flags (#15474)

* Language-specific PIC flags

* Add tests for every compiler flag

* Fix bad rebase

* pic_flag -> cxx_pic_flag
This commit is contained in:
Adam J. Stewart
2020-04-17 16:28:51 -05:00
committed by GitHub
parent ad8977467b
commit 284e450c91
62 changed files with 415 additions and 160 deletions

View File

@@ -169,7 +169,7 @@ def _do_patch_libtool(self):
line = 'wl="-Wl,"\n'
if line == 'pic_flag=""\n':
line = 'pic_flag="{0}"\n'\
.format(self.compiler.pic_flag)
.format(self.compiler.cc_pic_flag)
sys.stdout.write(line)
@property

View File

@@ -410,6 +410,30 @@ def c11_flag(self):
"the C11 standard",
"c11_flag")
@property
def cc_pic_flag(self):
"""Returns the flag used by the C compiler to produce
Position Independent Code (PIC)."""
return '-fPIC'
@property
def cxx_pic_flag(self):
"""Returns the flag used by the C++ compiler to produce
Position Independent Code (PIC)."""
return '-fPIC'
@property
def f77_pic_flag(self):
"""Returns the flag used by the F77 compiler to produce
Position Independent Code (PIC)."""
return '-fPIC'
@property
def fc_pic_flag(self):
"""Returns the flag used by the FC compiler to produce
Position Independent Code (PIC)."""
return '-fPIC'
#
# Compiler classes have methods for querying the version of
# specific compiler executables. This is used when discovering compilers.

View File

@@ -80,7 +80,19 @@ def c11_flag(self):
return "-std=c11"
@property
def pic_flag(self):
def cc_pic_flag(self):
return "-fPIC"
@property
def cxx_pic_flag(self):
return "-fPIC"
@property
def f77_pic_flag(self):
return "-fPIC"
@property
def fc_pic_flag(self):
return "-fPIC"
required_libs = ['libclang', 'libflang']

View File

@@ -68,5 +68,17 @@ def c11_flag(self):
'< 8.5')
@property
def pic_flag(self):
def cc_pic_flag(self):
return "-h PIC"
@property
def cxx_pic_flag(self):
return "-h PIC"
@property
def f77_pic_flag(self):
return "-h PIC"
@property
def fc_pic_flag(self):
return "-h PIC"

View File

@@ -174,7 +174,19 @@ def c11_flag(self):
return "-std=c11"
@property
def pic_flag(self):
def cc_pic_flag(self):
return "-fPIC"
@property
def cxx_pic_flag(self):
return "-fPIC"
@property
def f77_pic_flag(self):
return "-fPIC"
@property
def fc_pic_flag(self):
return "-fPIC"
required_libs = ['libclang']

View File

@@ -59,5 +59,17 @@ def c11_flag(self):
return "-std=c11"
@property
def pic_flag(self):
def cc_pic_flag(self):
return "-KPIC"
@property
def cxx_pic_flag(self):
return "-KPIC"
@property
def f77_pic_flag(self):
return "-KPIC"
@property
def fc_pic_flag(self):
return "-KPIC"

View File

@@ -110,7 +110,19 @@ def c11_flag(self):
return "-std=c11"
@property
def pic_flag(self):
def cc_pic_flag(self):
return "-fPIC"
@property
def cxx_pic_flag(self):
return "-fPIC"
@property
def f77_pic_flag(self):
return "-fPIC"
@property
def fc_pic_flag(self):
return "-fPIC"
required_libs = ['libgcc', 'libgfortran']

View File

@@ -92,7 +92,19 @@ def c11_flag(self):
return "-std=c1x"
@property
def pic_flag(self):
def cc_pic_flag(self):
return "-fPIC"
@property
def cxx_pic_flag(self):
return "-fPIC"
@property
def f77_pic_flag(self):
return "-fPIC"
@property
def fc_pic_flag(self):
return "-fPIC"
@property

View File

@@ -41,7 +41,11 @@ def cxx11_flag(self):
return "-std=c++11"
@property
def pic_flag(self):
def f77_pic_flag(self):
return "-PIC"
@property
def fc_pic_flag(self):
return "-PIC"
# Unlike other compilers, the NAG compiler passes options to GCC, which

View File

@@ -46,7 +46,19 @@ def cxx11_flag(self):
return "-std=c++11"
@property
def pic_flag(self):
def cc_pic_flag(self):
return "-fpic"
@property
def cxx_pic_flag(self):
return "-fpic"
@property
def f77_pic_flag(self):
return "-fpic"
@property
def fc_pic_flag(self):
return "-fpic"
required_libs = ['libpgc', 'libpgf90']

View File

@@ -70,7 +70,19 @@ def c11_flag(self):
'< 12.1')
@property
def pic_flag(self):
def cc_pic_flag(self):
return "-qpic"
@property
def cxx_pic_flag(self):
return "-qpic"
@property
def f77_pic_flag(self):
return "-qpic"
@property
def fc_pic_flag(self):
return "-qpic"
@property

View File

@@ -17,13 +17,13 @@
import spack.compilers.arm
import spack.compilers.cce
import spack.compilers.clang
import spack.compilers.fj
import spack.compilers.gcc
import spack.compilers.intel
import spack.compilers.nag
import spack.compilers.pgi
import spack.compilers.xl
import spack.compilers.xl_r
import spack.compilers.fj
from spack.compiler import Compiler
@@ -222,18 +222,53 @@ def supported_flag_test(flag, flag_value_ref, spec=None):
# Tests for UnsupportedCompilerFlag exceptions from default
# implementations of flags.
def test_default_flags():
supported_flag_test("cc_rpath_arg", "-Wl,-rpath,")
supported_flag_test("cxx_rpath_arg", "-Wl,-rpath,")
supported_flag_test("f77_rpath_arg", "-Wl,-rpath,")
supported_flag_test("fc_rpath_arg", "-Wl,-rpath,")
supported_flag_test("linker_arg", "-Wl,")
unsupported_flag_test("openmp_flag")
unsupported_flag_test("cxx11_flag")
unsupported_flag_test("cxx14_flag")
unsupported_flag_test("cxx17_flag")
supported_flag_test("cxx98_flag", "")
unsupported_flag_test("c99_flag")
unsupported_flag_test("c11_flag")
supported_flag_test("cc_pic_flag", "-fPIC")
supported_flag_test("cxx_pic_flag", "-fPIC")
supported_flag_test("f77_pic_flag", "-fPIC")
supported_flag_test("fc_pic_flag", "-fPIC")
# Verify behavior of particular compiler definitions.
def test_clang_flags():
# Common
supported_flag_test("pic_flag", "-fPIC", "gcc@4.0")
def test_arm_flags():
supported_flag_test("openmp_flag", "-fopenmp", "arm@1.0")
supported_flag_test("cxx11_flag", "-std=c++11", "arm@1.0")
supported_flag_test("cxx14_flag", "-std=c++14", "arm@1.0")
supported_flag_test("cxx17_flag", "-std=c++1z", "arm@1.0")
supported_flag_test("c99_flag", "-std=c99", "arm@1.0")
supported_flag_test("c11_flag", "-std=c11", "arm@1.0")
supported_flag_test("cc_pic_flag", "-fPIC", "arm@1.0")
supported_flag_test("cxx_pic_flag", "-fPIC", "arm@1.0")
supported_flag_test("f77_pic_flag", "-fPIC", "arm@1.0")
supported_flag_test("fc_pic_flag", "-fPIC", "arm@1.0")
def test_cce_flags():
supported_flag_test("openmp_flag", "-h omp", "cce@1.0")
supported_flag_test("cxx11_flag", "-h std=c++11", "cce@1.0")
unsupported_flag_test("c99_flag", "cce@8.0")
supported_flag_test("c99_flag", "-h c99,noconform,gnu", "cce@8.1")
supported_flag_test("c99_flag", "-h stc=c99,noconform,gnu", "cce@8.4")
unsupported_flag_test("c11_flag", "cce@8.4")
supported_flag_test("c11_flag", "-h std=c11,noconform,gnu", "cce@8.5")
supported_flag_test("cc_pic_flag", "-h PIC", "cce@1.0")
supported_flag_test("cxx_pic_flag", "-h PIC", "cce@1.0")
supported_flag_test("f77_pic_flag", "-h PIC", "cce@1.0")
supported_flag_test("fc_pic_flag", "-h PIC", "cce@1.0")
def test_clang_flags():
# Apple Clang.
supported_flag_test(
"openmp_flag", "-Xpreprocessor -fopenmp", "clang@2.0.0-apple")
@@ -244,6 +279,13 @@ def test_clang_flags():
supported_flag_test("cxx14_flag", "-std=c++14", "clang@6.1.0-apple")
unsupported_flag_test("cxx17_flag", "clang@6.0.0-apple")
supported_flag_test("cxx17_flag", "-std=c++1z", "clang@6.1.0-apple")
supported_flag_test("c99_flag", "-std=c99", "clang@6.1.0-apple")
unsupported_flag_test("c11_flag", "clang@6.0.0-apple")
supported_flag_test("c11_flag", "-std=c11", "clang@6.1.0-apple")
supported_flag_test("cc_pic_flag", "-fPIC", "clang@2.0.0-apple")
supported_flag_test("cxx_pic_flag", "-fPIC", "clang@2.0.0-apple")
supported_flag_test("f77_pic_flag", "-fPIC", "clang@2.0.0-apple")
supported_flag_test("fc_pic_flag", "-fPIC", "clang@2.0.0-apple")
# non-Apple Clang.
supported_flag_test("openmp_flag", "-fopenmp", "clang@3.3")
@@ -255,12 +297,26 @@ def test_clang_flags():
unsupported_flag_test("cxx17_flag", "clang@3.4")
supported_flag_test("cxx17_flag", "-std=c++1z", "clang@3.5")
supported_flag_test("cxx17_flag", "-std=c++17", "clang@5.0")
supported_flag_test("c99_flag", "-std=c99", "clang@3.3")
unsupported_flag_test("c11_flag", "clang@6.0.0")
supported_flag_test("c11_flag", "-std=c11", "clang@6.1.0")
supported_flag_test("cc_pic_flag", "-fPIC", "clang@3.3")
supported_flag_test("cxx_pic_flag", "-fPIC", "clang@3.3")
supported_flag_test("f77_pic_flag", "-fPIC", "clang@3.3")
supported_flag_test("fc_pic_flag", "-fPIC", "clang@3.3")
def test_cce_flags():
supported_flag_test("openmp_flag", "-h omp", "cce@1.0")
supported_flag_test("cxx11_flag", "-h std=c++11", "cce@1.0")
supported_flag_test("pic_flag", "-h PIC", "cce@1.0")
def test_fj_flags():
supported_flag_test("openmp_flag", "-Kopenmp", "fj@4.0.0")
supported_flag_test("cxx98_flag", "-std=c++98", "fj@4.0.0")
supported_flag_test("cxx11_flag", "-std=c++11", "fj@4.0.0")
supported_flag_test("cxx14_flag", "-std=c++14", "fj@4.0.0")
supported_flag_test("c99_flag", "-std=c99", "fj@4.0.0")
supported_flag_test("c11_flag", "-std=c11", "fj@4.0.0")
supported_flag_test("cc_pic_flag", "-KPIC", "fj@4.0.0")
supported_flag_test("cxx_pic_flag", "-KPIC", "fj@4.0.0")
supported_flag_test("f77_pic_flag", "-KPIC", "fj@4.0.0")
supported_flag_test("fc_pic_flag", "-KPIC", "fj@4.0.0")
def test_gcc_flags():
@@ -275,7 +331,17 @@ def test_gcc_flags():
supported_flag_test("cxx14_flag", "-std=c++14", "gcc@4.9")
supported_flag_test("cxx14_flag", "", "gcc@6.0")
unsupported_flag_test("cxx17_flag", "gcc@4.9")
supported_flag_test("pic_flag", "-fPIC", "gcc@4.0")
supported_flag_test("cxx17_flag", "-std=c++1z", "gcc@5.0")
supported_flag_test("cxx17_flag", "-std=c++17", "gcc@6.0")
unsupported_flag_test("c99_flag", "gcc@4.4")
supported_flag_test("c99_flag", "-std=c99", "gcc@4.5")
unsupported_flag_test("c11_flag", "gcc@4.6")
supported_flag_test("c11_flag", "-std=c11", "gcc@4.7")
supported_flag_test("cc_pic_flag", "-fPIC", "gcc@4.0")
supported_flag_test("cxx_pic_flag", "-fPIC", "gcc@4.0")
supported_flag_test("f77_pic_flag", "-fPIC", "gcc@4.0")
supported_flag_test("fc_pic_flag", "-fPIC", "gcc@4.0")
supported_flag_test("stdcxx_libs", ("-lstdc++",), "gcc@4.1")
def test_intel_flags():
@@ -287,43 +353,105 @@ def test_intel_flags():
unsupported_flag_test("cxx14_flag", "intel@14.0")
supported_flag_test("cxx14_flag", "-std=c++1y", "intel@15.0")
supported_flag_test("cxx14_flag", "-std=c++14", "intel@15.0.2")
supported_flag_test("pic_flag", "-fPIC", "intel@1.0")
unsupported_flag_test("c99_flag", "intel@11.0")
supported_flag_test("c99_flag", "-std=c99", "intel@12.0")
unsupported_flag_test("c11_flag", "intel@15.0")
supported_flag_test("c11_flag", "-std=c1x", "intel@16.0")
supported_flag_test("cc_pic_flag", "-fPIC", "intel@1.0")
supported_flag_test("cxx_pic_flag", "-fPIC", "intel@1.0")
supported_flag_test("f77_pic_flag", "-fPIC", "intel@1.0")
supported_flag_test("fc_pic_flag", "-fPIC", "intel@1.0")
supported_flag_test("stdcxx_libs", ("-cxxlib",), "intel@1.0")
def test_nag_flags():
supported_flag_test("openmp_flag", "-openmp", "nag@1.0")
supported_flag_test("cxx11_flag", "-std=c++11", "nag@1.0")
supported_flag_test("pic_flag", "-PIC", "nag@1.0")
supported_flag_test("cc_pic_flag", "-fPIC", "nag@1.0")
supported_flag_test("cxx_pic_flag", "-fPIC", "nag@1.0")
supported_flag_test("f77_pic_flag", "-PIC", "nag@1.0")
supported_flag_test("fc_pic_flag", "-PIC", "nag@1.0")
supported_flag_test("cc_rpath_arg", "-Wl,-rpath,", "nag@1.0")
supported_flag_test("cxx_rpath_arg", "-Wl,-rpath,", "nag@1.0")
supported_flag_test("f77_rpath_arg", "-Wl,-Wl,,-rpath,,", "nag@1.0")
supported_flag_test("fc_rpath_arg", "-Wl,-Wl,,-rpath,,", "nag@1.0")
supported_flag_test("linker_arg", "-Wl,-Wl,,", "nag@1.0")
def test_pgi_flags():
supported_flag_test("openmp_flag", "-mp", "pgi@1.0")
supported_flag_test("cxx11_flag", "-std=c++11", "pgi@1.0")
supported_flag_test("pic_flag", "-fpic", "pgi@1.0")
unsupported_flag_test("c99_flag", "pgi@12.9")
supported_flag_test("c99_flag", "-c99", "pgi@12.10")
unsupported_flag_test("c11_flag", "pgi@15.2")
supported_flag_test("c11_flag", "-c11", "pgi@15.3")
supported_flag_test("cc_pic_flag", "-fpic", "pgi@1.0")
supported_flag_test("cxx_pic_flag", "-fpic", "pgi@1.0")
supported_flag_test("f77_pic_flag", "-fpic", "pgi@1.0")
supported_flag_test("fc_pic_flag", "-fpic", "pgi@1.0")
def test_xl_flags():
supported_flag_test("openmp_flag", "-qsmp=omp", "xl@1.0")
unsupported_flag_test("cxx11_flag", "xl@13.0")
supported_flag_test("cxx11_flag", "-qlanglvl=extended0x", "xl@13.1")
supported_flag_test("pic_flag", "-qpic", "xl@1.0")
unsupported_flag_test("c99_flag", "xl@10.0")
supported_flag_test("c99_flag", "-qlanglvl=extc99", "xl@10.1")
supported_flag_test("c99_flag", "-std=gnu99", "xl@13.1.1")
unsupported_flag_test("c11_flag", "xl@12.0")
supported_flag_test("c11_flag", "-qlanglvl=extc1x", "xl@12.1")
supported_flag_test("c11_flag", "-std=gnu11", "xl@13.1.2")
supported_flag_test("cc_pic_flag", "-qpic", "xl@1.0")
supported_flag_test("cxx_pic_flag", "-qpic", "xl@1.0")
supported_flag_test("f77_pic_flag", "-qpic", "xl@1.0")
supported_flag_test("fc_pic_flag", "-qpic", "xl@1.0")
supported_flag_test("fflags", "-qzerosize", "xl@1.0")
def test_xl_r_flags():
supported_flag_test("openmp_flag", "-qsmp=omp", "xl_r@1.0")
unsupported_flag_test("cxx11_flag", "xl_r@13.0")
supported_flag_test("cxx11_flag", "-qlanglvl=extended0x", "xl_r@13.1")
supported_flag_test("pic_flag", "-qpic", "xl_r@1.0")
unsupported_flag_test("c99_flag", "xl_r@10.0")
supported_flag_test("c99_flag", "-qlanglvl=extc99", "xl_r@10.1")
supported_flag_test("c99_flag", "-std=gnu99", "xl_r@13.1.1")
unsupported_flag_test("c11_flag", "xl_r@12.0")
supported_flag_test("c11_flag", "-qlanglvl=extc1x", "xl_r@12.1")
supported_flag_test("c11_flag", "-std=gnu11", "xl_r@13.1.2")
supported_flag_test("cc_pic_flag", "-qpic", "xl_r@1.0")
supported_flag_test("cxx_pic_flag", "-qpic", "xl_r@1.0")
supported_flag_test("f77_pic_flag", "-qpic", "xl_r@1.0")
supported_flag_test("fc_pic_flag", "-qpic", "xl_r@1.0")
supported_flag_test("fflags", "-qzerosize", "xl_r@1.0")
def test_fj_flags():
supported_flag_test("openmp_flag", "-Kopenmp", "fj@4.0.0")
supported_flag_test("cxx98_flag", "-std=c++98", "fj@4.0.0")
supported_flag_test("cxx11_flag", "-std=c++11", "fj@4.0.0")
supported_flag_test("cxx14_flag", "-std=c++14", "fj@4.0.0")
supported_flag_test("c99_flag", "-std=c99", "fj@4.0.0")
supported_flag_test("c11_flag", "-std=c11", "fj@4.0.0")
supported_flag_test("pic_flag", "-KPIC", "fj@4.0.0")
@pytest.mark.parametrize('version_str,expected_version', [
('Arm C/C++/Fortran Compiler version 19.0 (build number 73) (based on LLVM 7.0.2)\n' # NOQA
'Target: aarch64--linux-gnu\n'
'Thread model: posix\n'
'InstalledDir:\n'
'/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n', # NOQA
'19.0.0.73'),
('Arm C/C++/Fortran Compiler version 19.3.1 (build number 75) (based on LLVM 7.0.2)\n' # NOQA
'Target: aarch64--linux-gnu\n'
'Thread model: posix\n'
'InstalledDir:\n'
'/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n', # NOQA
'19.3.1.75')
])
def test_arm_version_detection(version_str, expected_version):
version = spack.compilers.arm.Arm.extract_version_from_output(version_str)
assert version == expected_version
@pytest.mark.parametrize('version_str,expected_version', [
('Cray C : Version 8.4.6 Mon Apr 15, 2019 12:13:39\n', '8.4.6'),
('Cray C++ : Version 8.4.6 Mon Apr 15, 2019 12:13:45\n', '8.4.6'),
('Cray Fortran : Version 8.4.6 Mon Apr 15, 2019 12:13:55\n', '8.4.6')
])
def test_cce_version_detection(version_str, expected_version):
version = spack.compilers.cce.Cce.extract_version_from_output(version_str)
assert version == expected_version
@pytest.mark.regression('10191')
@@ -364,21 +492,23 @@ def test_clang_version_detection(version_str, expected_version):
@pytest.mark.parametrize('version_str,expected_version', [
('Arm C/C++/Fortran Compiler version 19.0 (build number 73) (based on LLVM 7.0.2)\n' # NOQA
'Target: aarch64--linux-gnu\n'
'Thread model: posix\n'
'InstalledDir:\n'
'/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n', # NOQA
'19.0.0.73'),
('Arm C/C++/Fortran Compiler version 19.3.1 (build number 75) (based on LLVM 7.0.2)\n' # NOQA
'Target: aarch64--linux-gnu\n'
'Thread model: posix\n'
'InstalledDir:\n'
'/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin\n', # NOQA
'19.3.1.75')
# C compiler
('fcc (FCC) 4.0.0 20190314\n'
'simulating gcc version 6.1\n'
'Copyright FUJITSU LIMITED 2019',
'4.0.0'),
# C++ compiler
('FCC (FCC) 4.0.0 20190314\n'
'simulating gcc version 6.1\n'
'Copyright FUJITSU LIMITED 2019',
'4.0.0'),
# Fortran compiler
('frt (FRT) 4.0.0 20190314\n'
'Copyright FUJITSU LIMITED 2019',
'4.0.0')
])
def test_arm_version_detection(version_str, expected_version):
version = spack.compilers.arm.Arm.extract_version_from_output(version_str)
def test_fj_version_detection(version_str, expected_version):
version = spack.compilers.fj.Fj.extract_version_from_output(version_str)
assert version == expected_version
@@ -454,37 +584,6 @@ def test_xl_version_detection(version_str, expected_version):
assert version == expected_version
@pytest.mark.parametrize('version_str,expected_version', [
('Cray C : Version 8.4.6 Mon Apr 15, 2019 12:13:39\n', '8.4.6'),
('Cray C++ : Version 8.4.6 Mon Apr 15, 2019 12:13:45\n', '8.4.6'),
('Cray Fortran : Version 8.4.6 Mon Apr 15, 2019 12:13:55\n', '8.4.6')
])
def test_cce_version_detection(version_str, expected_version):
version = spack.compilers.cce.Cce.extract_version_from_output(version_str)
assert version == expected_version
@pytest.mark.parametrize('version_str,expected_version', [
# C compiler
('fcc (FCC) 4.0.0 20190314\n'
'simulating gcc version 6.1\n'
'Copyright FUJITSU LIMITED 2019',
'4.0.0'),
# C++ compiler
('FCC (FCC) 4.0.0 20190314\n'
'simulating gcc version 6.1\n'
'Copyright FUJITSU LIMITED 2019',
'4.0.0'),
# Fortran compiler
('frt (FRT) 4.0.0 20190314\n'
'Copyright FUJITSU LIMITED 2019',
'4.0.0')
])
def test_fj_version_detection(version_str, expected_version):
version = spack.compilers.fj.Fj.extract_version_from_output(version_str)
assert version == expected_version
@pytest.mark.parametrize('compiler_spec,expected_result', [
('gcc@4.7.2', False), ('clang@3.3', False), ('clang@8.0.0', True)
])

View File

@@ -133,7 +133,7 @@ def configure_args(self):
extra_args = [
# required, otherwise building its python bindings will fail
'CFLAGS={0}'.format(self.compiler.pic_flag)
'CFLAGS={0}'.format(self.compiler.cc_pic_flag)
]
extra_args += self.enable_or_disable('shared')

View File

@@ -371,7 +371,7 @@ def determine_b2_options(self, spec, options):
cxxflags.append(flag)
if '+pic' in self.spec:
cxxflags.append(self.compiler.pic_flag)
cxxflags.append(self.compiler.cxx_pic_flag)
# clang is not officially supported for pre-compiled headers
# and at least in clang 3.9 still fails to build

View File

@@ -59,7 +59,7 @@ def build_args(self, spec, prefix):
'CC={0}'.format(spack_cc),
'CXX={0}'.format(spack_cxx),
'FORTRAN={0}'.format(spack_fc),
'cc_flags={0}'.format(self.compiler.pic_flag),
'cc_flags={0}'.format(self.compiler.cc_pic_flag),
# Allow Spack environment variables to propagate through to SCons
'env_vars=all'
]

View File

@@ -56,7 +56,7 @@ def configure_args(self):
args = []
cookie = self.spec.variants['gni-cookie'].value
ptag = self.spec.variants['ptag'].value
args.append('CFLAGS={0}'.format(self.compiler.pic_flag))
args.append('CFLAGS={0}'.format(self.compiler.cc_pic_flag))
if self.spec.satisfies('+dimes'):
args.append('--enable-dimes')
if self.spec.satisfies('+cray-drc'):

View File

@@ -31,7 +31,7 @@ def edit(self, spec, prefix):
makefile = FileFilter('Makefile')
makefile.filter('CC=.*',
'CC={0} {1}'.format(spack_cc,
self.compiler.pic_flag))
self.compiler.cc_pic_flag))
makefile.filter('CFLAGS=.*', 'CFLAGS={0}'.format(cflags))
makefile.filter('PREFIX=.*', 'PREFIX={0}'.format(self.prefix))
p = self.spec['libzmq'].prefix

View File

@@ -61,8 +61,8 @@ def cmake_args(self):
if '+pic' in spec:
args.extend([
'-DCMAKE_C_FLAGS={0}'.format(self.compiler.pic_flag),
'-DCMAKE_CXX_FLAGS={0}'.format(self.compiler.pic_flag)
'-DCMAKE_C_FLAGS={0}'.format(self.compiler.cc_pic_flag),
'-DCMAKE_CXX_FLAGS={0}'.format(self.compiler.cxx_pic_flag)
])
args.append('-DCMAKE_CXX_STANDARD={0}'.format(

View File

@@ -60,8 +60,8 @@ def configure_args(self):
'--with-segment-mmap-max=%s '
% (self.spec.variants['segment-mmap-max'].value),
# for consumers with shared libs
'CC=%s %s' % (spack_cc, self.compiler.pic_flag),
'CXX=%s %s' % (spack_cxx, self.compiler.pic_flag),
"CC=%s %s" % (spack_cc, self.compiler.cc_pic_flag),
"CXX=%s %s" % (spack_cxx, self.compiler.cxx_pic_flag),
]
if '+aligned-segments' in self.spec:
@@ -80,7 +80,7 @@ def configure_args(self):
'--disable-ibv',
'--disable-seq',
'MPI_CC=%s %s'
% (self.spec['mpi'].mpicc, self.compiler.pic_flag)])
% (self.spec['mpi'].mpicc, self.compiler.cc_pic_flag)])
if '+ibv' in self.spec:
args.extend(['--enable-ibv',

View File

@@ -35,7 +35,7 @@ def configure_args(self):
spec = self.spec
config_args = [
'CFLAGS={0}'.format(self.compiler.pic_flag),
'CFLAGS={0}'.format(self.compiler.cc_pic_flag),
'--with-jpeg={0}'.format(spec['jpeg'].prefix),
'--with-zlib={0}'.format(spec['zlib'].prefix),
'--disable-netcdf', # must be disabled to build NetCDF with HDF4

View File

@@ -259,8 +259,11 @@ def configure_args(self):
extra_args.append('--enable-static-exec')
if '+pic' in self.spec:
extra_args += ['%s=%s' % (f, self.compiler.pic_flag)
for f in ['CFLAGS', 'CXXFLAGS', 'FCFLAGS']]
extra_args.extend([
'CFLAGS=' + self.compiler.cc_pic_flag,
'CXXFLAGS=' + self.compiler.cxx_pic_flag,
'FCFLAGS=' + self.compiler.fc_pic_flag,
])
if '+mpi' in self.spec:
# The HDF5 configure script warns if cxx and mpi are enabled

View File

@@ -81,7 +81,7 @@ def common_make_opts(self):
if '+cuda' in spec:
makeopts += ['CUDA_DIR=%s' % spec['cuda'].prefix]
nvccflags = ['-ccbin %s -Xcompiler "%s" -Xcompiler %s' %
(compiler.cxx, opt, compiler.pic_flag)]
(compiler.cxx, opt, compiler.cc_pic_flag)]
nvccflags = ' '.join(nvccflags)
makeopts += ['NVCCFLAGS=%s' % nvccflags]
else:

View File

@@ -48,7 +48,7 @@ def flag_handler(self, name, flags):
flags.append('-O2')
if '+pic' in self.spec:
flags.append(self.compiler.pic_flag)
flags.append(self.compiler.cc_pic_flag)
return (None, None, flags)

View File

@@ -56,7 +56,7 @@ def install(self, spec, prefix):
spec['ncurses'].prefix.lib),
'MYLIBS=-lncursesw',
'CC=%s -std=gnu99 %s' % (spack_cc,
self.compiler.pic_flag),
self.compiler.cc_pic_flag),
target)
make('INSTALL_TOP=%s' % prefix,
'install')

View File

@@ -40,6 +40,6 @@ def flag_handler(self, name, flags):
# Compile with PIC, if requested.
if name == 'cflags' and '+pic' in self.spec:
flags.append(self.compiler.pic_flag)
flags.append(self.compiler.cc_pic_flag)
return (flags, None, None)

View File

@@ -79,7 +79,7 @@ def install(self, spec, prefix):
# Process library spec and options
options = []
if '+shared' in spec:
options.append('COPTIONS={0}'.format(self.compiler.pic_flag))
options.append('COPTIONS={0}'.format(self.compiler.cc_pic_flag))
if spec.variants['build_type'].value == 'Debug':
options.append('OPTFLAGS=-g -O0')
make(*options)
@@ -107,7 +107,7 @@ def install(self, spec, prefix):
install(sharefile, prefix.share)
if '+shared' in spec:
shared_flags = [self.compiler.pic_flag, '-shared']
shared_flags = [self.compiler.cc_pic_flag, '-shared']
if sys.platform == 'darwin':
shared_suffix = 'dylib'
shared_flags.extend(['-Wl,-all_load', 'libmetis.a'])

View File

@@ -307,7 +307,9 @@ def find_optional_library(name, prefix):
if '~static' in spec:
options += ['STATIC=NO']
if '+shared' in spec:
options += ['SHARED=YES', 'PICFLAG=%s' % self.compiler.pic_flag]
options += [
'SHARED=YES', 'PICFLAG=%s' % self.compiler.cxx_pic_flag
]
if '+mpi' in spec:
options += ['MPICXX=%s' % spec['mpi'].mpicxx]

View File

@@ -125,7 +125,8 @@ def write_makefile_inc(self):
# when building shared libs need -fPIC, otherwise
# /usr/bin/ld: graph.o: relocation R_X86_64_32 against `.rodata.str1.1'
# can not be used when making a shared object; recompile with -fPIC
fpic = self.compiler.pic_flag if '+shared' in self.spec else ''
cpic = self.compiler.cc_pic_flag if '+shared' in self.spec else ''
fpic = self.compiler.fc_pic_flag if '+shared' in self.spec else ''
# TODO: test this part, it needs a full blas, scalapack and
# partitionning environment with 64bit integers
@@ -146,8 +147,8 @@ def write_makefile_inc(self):
])
makefile_conf.extend([
'OPTL = %s -O%s' % (fpic, opt_level),
'OPTC = %s -O%s -DINTSIZE64' % (fpic, opt_level)
'OPTL = %s -O%s' % (cpic, opt_level),
'OPTC = %s -O%s -DINTSIZE64' % (cpic, opt_level)
])
else:
if using_xlf:
@@ -157,8 +158,8 @@ def write_makefile_inc(self):
fpic, opt_level))
makefile_conf.extend([
'OPTL = %s -O%s' % (fpic, opt_level),
'OPTC = %s -O%s' % (fpic, opt_level)
'OPTL = %s -O%s' % (cpic, opt_level),
'OPTC = %s -O%s' % (cpic, opt_level)
])
if '+mpi' in self.spec:

View File

@@ -28,7 +28,7 @@ def url_for_version(self, version):
def configure_args(self):
return [
# ADIOS build with -fPIC, so we need it too (avoid linkage issue)
'CFLAGS={0}'.format(self.compiler.pic_flag),
'CFLAGS={0}'.format(self.compiler.cc_pic_flag),
# Default is non-shared, but avoid any future surprises
'--disable-shared',
]

View File

@@ -40,8 +40,10 @@ def setup_build_environment(self, env):
env.unset('TERMINFO')
def flag_handler(self, name, flags):
if name == 'cflags' or name == 'cxxflags':
flags.append(self.compiler.pic_flag)
if name == 'cflags':
flags.append(self.compiler.cc_pic_flag)
elif name == 'cxxflags':
flags.append(self.compiler.cxx_pic_flag)
return (flags, None, None)

View File

@@ -158,7 +158,7 @@ def configure_args(self):
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
cflags.append(self.compiler.pic_flag)
cflags.append(self.compiler.cc_pic_flag)
config_args += self.enable_or_disable('dap')
# config_args += self.enable_or_disable('cdmremote')

View File

@@ -44,7 +44,7 @@ class NetcdfCxx4(AutotoolsPackage):
def flag_handler(self, name, flags):
if name == 'cflags' and '+pic' in self.spec:
flags.append(self.compiler.pic_flag)
flags.append(self.compiler.cc_pic_flag)
elif name == 'cppflags':
flags.append('-I' + self.spec['netcdf-c'].prefix.include)

View File

@@ -64,12 +64,16 @@ class NetcdfFortran(AutotoolsPackage):
def flag_handler(self, name, flags):
config_flags = None
if name in ['cflags', 'fflags'] and '+pic' in self.spec:
if '+pic' in self.spec:
# Unlike NetCDF-C, we add PIC flag only when +pic. Adding the
# flags also when ~shared would make it impossible to build a
# static-only version of the library with NAG.
config_flags = [self.compiler.pic_flag]
elif name == 'cppflags':
if name == 'cflags':
config_flags = [self.compiler.cc_pic_flag]
elif name == 'fflags':
config_flags = [self.compiler.f77_pic_flag]
if name == 'cppflags':
config_flags = [self.spec['netcdf-c'].headers.cpp_flags]
elif name == 'ldflags':
# We need to specify LDFLAGS to get correct dependency_libs

View File

@@ -78,8 +78,8 @@ def cmake_args(self):
if '+pic' in spec:
options.extend([
"-DCMAKE_C_FLAGS=%s" % self.compiler.pic_flag,
"-DCMAKE_Fortran_FLAGS=%s" % self.compiler.pic_flag
"-DCMAKE_C_FLAGS=%s" % self.compiler.cc_pic_flag,
"-DCMAKE_Fortran_FLAGS=%s" % self.compiler.fc_pic_flag
])
return options

View File

@@ -123,7 +123,7 @@ def get_compiler_options(self, spec):
flags = '-O3 -qtune=qp -qarch=qp -q64 -qstrict -qnohot -g'
if self.spec.satisfies('%pgi'):
flags += ' ' + self.compiler.pic_flag
flags += ' ' + self.compiler.cc_pic_flag
return ['CFLAGS=%s' % flags,
'CXXFLAGS=%s' % flags]

View File

@@ -231,8 +231,8 @@ def make_defs(self):
if '~shared' in self.spec:
if '+pic' in self.spec:
make_defs.extend([
'CFLAGS={0}'.format(self.compiler.pic_flag),
'FFLAGS={0}'.format(self.compiler.pic_flag)
'CFLAGS={0}'.format(self.compiler.cc_pic_flag),
'FFLAGS={0}'.format(self.compiler.f77_pic_flag)
])
make_defs += ['NO_SHARED=1']
# fix missing _dggsvd_ and _sggsvd_

View File

@@ -31,7 +31,7 @@ def configure_args(self):
'CXX={0}'.format(spack_cxx),
'F77={0}'.format(spack_f77),
'FC={0}'.format(spack_fc),
'CFLAGS={0}'.format(self.compiler.pic_flag),
'CXXFLAGS={0}'.format(self.compiler.pic_flag),
'PYTHON_FOR_GENERATOR=:'
'CFLAGS={0}'.format(self.compiler.cc_pic_flag),
'CXXFLAGS={0}'.format(self.compiler.cxx_pic_flag),
'PYTHON_FOR_GENERATOR=:',
]

View File

@@ -96,8 +96,12 @@ def configure_args(self):
args += self.enable_or_disable('fortran')
if '+pic' in self.spec:
args.extend(['{0}FLAGS={1}'.format(lang, self.compiler.pic_flag)
for lang in ['C', 'CXX', 'F', 'FC']])
args.extend([
'CFLAGS=' + self.compiler.cc_pic_flag,
'CXXFLAGS=' + self.compiler.cxx_pic_flag,
'FFLAGS=' + self.compiler.f77_pic_flag,
'FCFLAGS=' + self.compiler.fc_pic_flag,
])
if self.version >= Version('1.8'):
args.append('--enable-relax-coord-bound')

View File

@@ -28,8 +28,8 @@ class Parmgridgen(Package):
def install(self, spec, prefix):
make_opts = [
'make=make',
'COPTIONS={0}'.format(self.compiler.pic_flag),
'LDOPTIONS={0}'.format(self.compiler.pic_flag),
'COPTIONS={0}'.format(self.compiler.cc_pic_flag),
'LDOPTIONS={0}'.format(self.compiler.cc_pic_flag),
'CC={0}'.format(self.compiler.cc),
'LD={0}'.format(self.compiler.cc),
'LIBDIR=-L../..',

View File

@@ -36,6 +36,9 @@ def cmake_args(self):
def flag_handler(self, name, flags):
flags = list(flags)
if '+pic' in self.spec and name in ('cflags', 'cxxflags'):
flags.append(self.compiler.pic_flag)
if '+pic' in self.spec:
if name == 'cflags':
flags.append(self.compiler.cc_pic_flag)
elif name == 'cxxflags':
flags.append(self.compiler.cxx_pic_flag)
return (None, None, flags)

View File

@@ -53,7 +53,7 @@ def configure(self, spec, prefix):
raise InstallError('Unknown/unsupported compiler family')
if '+pic' in spec:
options.append('-useropt=' + self.compiler.pic_flag)
options.append('-useropt=' + self.compiler.cxx_pic_flag)
configure(*options)

View File

@@ -131,7 +131,8 @@ def configure_args(self):
# https://github.com/spack/spack/pull/3081 and
# https://github.com/spack/spack/pull/4416
if spec.satisfies('%intel'):
config_args.append('-Accflags={0}'.format(self.compiler.pic_flag))
config_args.append('-Accflags={0}'.format(
self.compiler.cc_pic_flag))
if '+shared' in spec:
config_args.append('-Duseshrplib')

View File

@@ -33,4 +33,5 @@ class PyLlvmlite(PythonPackage):
def setup_build_environment(self, env):
# Need to set PIC flag since this is linking statically with LLVM
env.set('CXX_FLTO_FLAGS', '-flto {0}'.format(self.compiler.pic_flag))
env.set('CXX_FLTO_FLAGS', '-flto {0}'.format(
self.compiler.cxx_pic_flag))

View File

@@ -280,7 +280,7 @@ def configure_args(self):
config_args.append('--without-ensurepip')
if '+pic' in spec:
config_args.append('CFLAGS={0}'.format(self.compiler.pic_flag))
config_args.append('CFLAGS={0}'.format(self.compiler.cc_pic_flag))
if spec.satisfies('@3.7:'):
if '+ssl' in spec:

View File

@@ -163,7 +163,8 @@ def configure_args(self):
# Set FPICFLAGS for compilers except 'gcc'.
if self.compiler.name != 'gcc':
config_args.append('FPICFLAGS={0}'.format(self.compiler.pic_flag))
config_args.append('FPICFLAGS={0}'.format(
self.compiler.cc_pic_flag))
return config_args

View File

@@ -106,8 +106,8 @@ def configure_args(self):
config_args.append('--with-mpi=openmpi')
config_args.extend([
'CFLAGS={0}'.format(self.compiler.pic_flag),
'CXXFLAGS={0}'.format(self.compiler.pic_flag)
'CFLAGS={0}'.format(self.compiler.cc_pic_flag),
'CXXFLAGS={0}'.format(self.compiler.cxx_pic_flag)
])
if "+mpi" in spec:

View File

@@ -117,7 +117,7 @@ def configure(self):
makefile_inc.extend([
'LIB = .dylib',
'CLIBFLAGS = -dynamiclib {0}'.format(
self.compiler.pic_flag
self.compiler.cc_pic_flag
),
'RANLIB = echo',
'AR = $(CC)',
@@ -126,12 +126,13 @@ def configure(self):
else:
makefile_inc.extend([
'LIB = .so',
'CLIBFLAGS = -shared {0}'.format(self.compiler.pic_flag),
'CLIBFLAGS = -shared {0}'.format(
self.compiler.cc_pic_flag),
'RANLIB = echo',
'AR = $(CC)',
'ARFLAGS = -shared $(LDFLAGS) -o'
])
cflags.append(self.compiler.pic_flag)
cflags.append(self.compiler.cc_pic_flag)
else:
makefile_inc.extend([
'LIB = .a',

View File

@@ -31,7 +31,7 @@ def makeopts(self, spec, prefix):
return [
"F95={0}".format(self.compiler.fc),
("F95FLAGS={0} -O3 -std=f2003 -ffast-math".
format(self.compiler.pic_flag)),
format(self.compiler.fc_pic_flag)),
"OPENMPFLAGS={0}".format(self.compiler.openmp_flag),
"BLAS={0}".format(spec['blas'].libs),
"FFTW={0}".format(spec['fftw'].libs),

View File

@@ -45,9 +45,14 @@ def flag_handler(self, name, flags):
if spec['hdf5'].satisfies('~shared'):
flags.append('-ldl')
flags.append(spec['readline'].libs.search_flags)
elif name in ('cflags', 'cxxflags', 'fcflags'):
if '+pic' in spec:
flags.append(self.compiler.pic_flag)
if '+pic' in spec:
if name == 'cflags':
flags.append(self.compiler.cc_pic_flag)
elif name == 'cxxflags':
flags.append(self.compiler.cxx_pic_flag)
elif name == 'fcflags':
flags.append(self.compiler.fc_pic_flag)
return (flags, None, None)
@when('%clang@9:')

View File

@@ -236,7 +236,7 @@ def install(self, spec, prefix):
"CXX=%s" % spec['mpi'].mpicxx,
"PARALLEL=%s" % mpi_id,
"PQUAL=-%s" % mpi_id,
"OPTFLAGS=-O2 -DNDEBUG " + self.compiler.pic_flag)
"OPTFLAGS=-O2 -DNDEBUG " + self.compiler.cc_pic_flag)
libname = 'libSimPartitionWrapper-' + mpi_id + '.a'
wrapperlibpath = join_path(workdir, 'lib', libname)
install(wrapperlibpath, join_path(prefix.lib, self.oslib))

View File

@@ -37,8 +37,11 @@ def cmake_args(self):
def flag_handler(self, name, flags):
flags = list(flags)
if '+pic' in self.spec and name in ('cflags', 'cxxflags'):
flags.append(self.compiler.pic_flag)
if '+pic' in self.spec:
if name == 'cflags':
flags.append(self.compiler.cc_pic_flag)
elif name == 'cxxflags':
flags.append(self.compiler.cxx_pic_flag)
return (None, None, flags)
@run_after('install')

View File

@@ -122,6 +122,6 @@ def build_libsqlitefunctions(self):
if '+functions' in self.spec:
libraryname = 'libsqlitefunctions.' + dso_suffix
cc = Executable(spack_cc)
cc(self.compiler.pic_flag, '-lm', '-shared',
cc(self.compiler.cc_pic_flag, '-lm', '-shared',
'extension-functions.c', '-o', libraryname)
install(libraryname, self.prefix.lib)

View File

@@ -63,7 +63,8 @@ def install(self, spec, prefix):
# logic in it. Any kind of customization will need to go through
# filtering of that file
pic_flag = self.compiler.pic_flag if '+pic' in spec else ''
cc_pic_flag = self.compiler.cc_pic_flag if '+pic' in spec else ''
f77_pic_flag = self.compiler.f77_pic_flag if '+pic' in spec else ''
make_args = [
# By default, the Makefile uses the Intel compilers if
@@ -78,11 +79,11 @@ def install(self, spec, prefix):
'CUDA_PATH=%s' % (spec['cuda'].prefix if '+cuda' in spec else ''),
'CFOPENMP=%s' % (self.compiler.openmp_flag
if '+openmp' in spec else ''),
'CFLAGS=-O3 %s' % pic_flag,
'CFLAGS=-O3 %s' % cc_pic_flag,
# Both FFLAGS and F77FLAGS are used in SuiteSparse makefiles;
# FFLAGS is used in CHOLMOD, F77FLAGS is used in AMD and UMFPACK.
'FFLAGS=%s' % pic_flag,
'F77FLAGS=%s' % pic_flag,
'FFLAGS=%s' % f77_pic_flag,
'F77FLAGS=%s' % f77_pic_flag,
# use Spack's metis in CHOLMOD/Partition module,
# otherwise internal Metis will be compiled
'MY_METIS_LIB=%s' % spec['metis'].libs.ld_flags,

View File

@@ -211,7 +211,7 @@ def cmake_args(self):
def on_off(varstr):
return 'ON' if varstr in self.spec else 'OFF'
fortran_flag = self.compiler.pic_flag
fortran_flag = self.compiler.f77_pic_flag
if (spec.satisfies('%clang platform=darwin')) and ('+fcmix' in spec):
f77 = Executable(self.compiler.f77)
libgfortran = LibraryList(f77('--print-file-name',

View File

@@ -73,10 +73,10 @@ def install(self, spec, prefix):
if '+pic' in spec:
config.extend([
# Use these lines instead when pic_flag capability arrives
'CFLAGS = -O3 {0}'.format(self.compiler.pic_flag),
'NOOPTS = {0}'.format(self.compiler.pic_flag),
'FFLAGS = -O2 {0}'.format(self.compiler.pic_flag),
'LOADOPTS = {0}'.format(self.compiler.pic_flag)
'CFLAGS = -O3 {0}'.format(self.compiler.cc_pic_flag),
'NOOPTS = {0}'.format(self.compiler.cc_pic_flag),
'FFLAGS = -O2 {0}'.format(self.compiler.f77_pic_flag),
'LOADOPTS = {0}'.format(self.compiler.cc_pic_flag)
])
else:
config.extend([

View File

@@ -51,8 +51,8 @@ class Thrift(Package):
def setup_build_environment(self, env):
if '+pic' in self.spec:
env.append_flags('CFLAGS', self.compiler.pic_flag)
env.append_flags('CXXFLAGS', self.compiler.pic_flag)
env.append_flags('CFLAGS', self.compiler.cc_pic_flag)
env.append_flags('CXXFLAGS', self.compiler.cxx_pic_flag)
def install(self, spec, prefix):
env['PY_PREFIX'] = prefix

View File

@@ -26,6 +26,6 @@ class Unrar(MakefilePackage):
def edit(self, spec, prefix):
makefile = FileFilter("makefile")
makefile.filter(
"LIBFLAGS=-fPIC", "LIBFLAGS={0}".format(self.compiler.pic_flag)
"LIBFLAGS=-fPIC", "LIBFLAGS={0}".format(self.compiler.cc_pic_flag)
)
makefile.filter("DESTDIR=/usr", "DESTDIR={0}".format(self.prefix))

View File

@@ -72,8 +72,8 @@ def cmake_args(self):
'-DVISIT_VTK_DIR:PATH=' + spec['vtk'].prefix,
'-DVISIT_ZLIB_DIR:PATH=' + spec['zlib'].prefix,
'-DVISIT_USE_GLEW=OFF',
'-DCMAKE_CXX_FLAGS=' + self.compiler.pic_flag,
'-DCMAKE_C_FLAGS=' + self.compiler.pic_flag,
'-DCMAKE_CXX_FLAGS=' + self.compiler.cxx_pic_flag,
'-DCMAKE_C_FLAGS=' + self.compiler.cc_pic_flag,
]
if '+python' in spec:

View File

@@ -30,7 +30,7 @@ def edit(self, spec, prefix):
# CFLAGS=-Wall -ansi -pedantic -O3
cflags = ''
if '+pic' in spec:
cflags += self.compiler.pic_flag
cflags += self.compiler.cc_pic_flag
filter_file(r'CFLAGS=.*',
'CFLAGS={0}'.format(cflags),
'config.mk')

View File

@@ -40,7 +40,7 @@ def libs(self):
def setup_build_environment(self, env):
if '+pic' in self.spec:
env.append_flags('CFLAGS', self.compiler.pic_flag)
env.append_flags('CFLAGS', self.compiler.cc_pic_flag)
if '+optimize' in self.spec:
env.append_flags('CFLAGS', '-O2')

View File

@@ -95,7 +95,7 @@ def configure_args(self):
'RANLIB=echo',
'--with-ar=$(CXX) -shared $(LDFLAGS) -o'
])
config_cflags.append(self.compiler.pic_flag)
config_cflags.append(self.compiler.cc_pic_flag)
if spec.satisfies('%gcc'):
config_args.append('--with-libs=-lgfortran')
if spec.satisfies('%intel'):

View File

@@ -27,7 +27,7 @@ class Zstd(MakefilePackage):
def setup_build_environment(self, env):
if '+pic' in self.spec:
env.append_flags('CFLAGS', self.compiler.pic_flag)
env.append_flags('CFLAGS', self.compiler.cc_pic_flag)
def build(self, spec, prefix):
make('PREFIX={0}'.format(prefix))