diff --git a/lib/spack/spack/compilers/clang.py b/lib/spack/spack/compilers/clang.py index da18adcecd21a3cdec0977922786de801bb4db88..b2095defe5945effe5a036d3f1e71016622bf04e 100644 --- a/lib/spack/spack/compilers/clang.py +++ b/lib/spack/spack/compilers/clang.py @@ -78,6 +78,10 @@ def cxx11_flag(self): else: return "-std=c++11" + @property + def pic_flag(self): + return "-fPIC" + @classmethod def default_version(cls, comp): """The '--version' option works for clang compilers. diff --git a/lib/spack/spack/compilers/gcc.py b/lib/spack/spack/compilers/gcc.py index 557b1c13a96ab5e5ec360ffc7dbba3db8f4c1ef6..80d24910c36cc4e7c0a8bc4082ed07c450b28db6 100644 --- a/lib/spack/spack/compilers/gcc.py +++ b/lib/spack/spack/compilers/gcc.py @@ -74,6 +74,10 @@ def cxx14_flag(self): else: return "-std=c++14" + @property + def pic_flag(self): + return "-fPIC" + @classmethod def fc_version(cls, fc): return get_compiler_version( diff --git a/lib/spack/spack/compilers/intel.py b/lib/spack/spack/compilers/intel.py index 14f4d2dc91d4830b71bd9ab85bb7913ded1f707c..4ff7185c846a85240290afc1d66225ee2f6c4b5d 100644 --- a/lib/spack/spack/compilers/intel.py +++ b/lib/spack/spack/compilers/intel.py @@ -65,6 +65,10 @@ def cxx11_flag(self): else: return "-std=c++11" + @property + def pic_flag(self): + return "-fPIC" + @classmethod def default_version(cls, comp): """The '--version' option seems to be the most consistent one diff --git a/lib/spack/spack/compilers/nag.py b/lib/spack/spack/compilers/nag.py index 5ba235adbbc3da2c79a30ab9e3ff74c0a0c1e6a8..c1da95a6c32948c3d3979854802cfa053aafbf24 100644 --- a/lib/spack/spack/compilers/nag.py +++ b/lib/spack/spack/compilers/nag.py @@ -56,6 +56,10 @@ def cxx11_flag(self): # However, it can be mixed with a compiler that does support it return "-std=c++11" + @property + def pic_flag(self): + return "-PIC" + # Unlike other compilers, the NAG compiler passes options to GCC, which # then passes them to the linker. Therefore, we need to doubly wrap the # options with '-Wl,-Wl,,' diff --git a/lib/spack/spack/compilers/pgi.py b/lib/spack/spack/compilers/pgi.py index 37ffe44028ae2e0b87df95ba2204afd4e0ac8998..146c153041811f5427eb0e180696a5af9d648320 100644 --- a/lib/spack/spack/compilers/pgi.py +++ b/lib/spack/spack/compilers/pgi.py @@ -55,6 +55,10 @@ def openmp_flag(self): def cxx11_flag(self): return "-std=c++11" + @property + def pic_flag(self): + return "-fpic" + @classmethod def default_version(cls, comp): """The '-V' option works for all the PGI compilers. diff --git a/lib/spack/spack/compilers/xl.py b/lib/spack/spack/compilers/xl.py index 5c83209781bf2825801eaf3b4ad26e8c9dfdde76..f4b7c4237dbfaa310d4d3de34324aa14ee53eb85 100644 --- a/lib/spack/spack/compilers/xl.py +++ b/lib/spack/spack/compilers/xl.py @@ -58,6 +58,10 @@ def cxx11_flag(self): else: return "-qlanglvl=extended0x" + @property + def pic_flag(self): + return "-qpic" + @classmethod def default_version(cls, comp): """The '-qversion' is the standard option fo XL compilers.