Add pic variant to cflags in boost. (#9750)

* Add pic variant to cflags in boost.

* Improve description in pic variant of boost, see #9750.
This commit is contained in:
Alberto Chiusole 2018-11-13 17:55:01 +01:00 committed by Adam J. Stewart
parent 63535542a1
commit 7938ff9653

View File

@ -122,6 +122,9 @@ class Boost(Package):
description='Compile with clang libc++ instead of libstdc++') description='Compile with clang libc++ instead of libstdc++')
variant('numpy', default=False, variant('numpy', default=False,
description='Build the Boost NumPy library (requires +python)') description='Build the Boost NumPy library (requires +python)')
variant('pic', default=False,
description='Generate position-independent code (PIC), useful '
'for building static libraries')
depends_on('icu4c', when='+icu') depends_on('icu4c', when='+icu')
depends_on('python', when='+python') depends_on('python', when='+python')
@ -213,14 +216,12 @@ def determine_bootstrap_options(self, spec, with_libs, options):
spack_cxx)) spack_cxx))
if '+mpi' in spec: if '+mpi' in spec:
# Use the correct mpi compiler. If the compiler options are # Use the correct mpi compiler. If the compiler options are
# empty or undefined, Boost will attempt to figure out the # empty or undefined, Boost will attempt to figure out the
# correct options by running "${mpicxx} -show" or something # correct options by running "${mpicxx} -show" or something
# similar, but that doesn't work with the Cray compiler # similar, but that doesn't work with the Cray compiler
# wrappers. Since Boost doesn't use the MPI C++ bindings, # wrappers. Since Boost doesn't use the MPI C++ bindings,
# that can be used as a compiler option instead. # that can be used as a compiler option instead.
mpi_line = 'using mpi : %s' % spec['mpi'].mpicxx mpi_line = 'using mpi : %s' % spec['mpi'].mpicxx
if 'platform=cray' in spec: if 'platform=cray' in spec:
@ -313,6 +314,9 @@ def determine_b2_options(self, spec, options):
if flag: if flag:
cxxflags.append(flag) cxxflags.append(flag)
if '+pic' in self.spec:
cxxflags.append(self.compiler.pic_flag)
# clang is not officially supported for pre-compiled headers # clang is not officially supported for pre-compiled headers
# and at least in clang 3.9 still fails to build # and at least in clang 3.9 still fails to build
# http://www.boost.org/build/doc/html/bbv2/reference/precompiled_headers.html # http://www.boost.org/build/doc/html/bbv2/reference/precompiled_headers.html