aboutsummaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-12-05 21:00:35 +0100
committerTristan Gingold <tgingold@free.fr>2016-12-06 20:05:50 +0100
commit0710ab894a5234cc68a6f43dfb9aac95c9c96010 (patch)
tree9c39cde922ed981d3c54983d3893b09ab365ac92 /configure
parentbe36587ed1a04b3a9712f837c5b0e82422bd5adf (diff)
downloadghdl-0710ab894a5234cc68a6f43dfb9aac95c9c96010.tar.gz
ghdl-0710ab894a5234cc68a6f43dfb9aac95c9c96010.tar.bz2
ghdl-0710ab894a5234cc68a6f43dfb9aac95c9c96010.zip
Use -fpic if gcc is configured with --enable-default-pie
Test in configure and set Default_Pie in default_pathes.ads Pass -fpic to ghdl1 if Default_Pie is set. Decode -fpic in ghdl1_llvm Fix #213
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure13
1 files changed, 11 insertions, 2 deletions
diff --git a/configure b/configure
index fed905e2e..1f072e2f7 100755
--- a/configure
+++ b/configure
@@ -25,7 +25,7 @@ PIC_FLAGS=-fPIC
show_help=no
progname=$0
-subst_vars="CC GNATMAKE CFLAGS LDFLAGS build srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir llvm_config llvm_be llvm_be_ver backtrace_lib build_mode EXEEXT SOEXT PIC_FLAGS"
+subst_vars="CC GNATMAKE CFLAGS LDFLAGS build srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir llvm_config llvm_be llvm_be_ver backtrace_lib build_mode EXEEXT SOEXT PIC_FLAGS default_pie"
# Find srcdir
srcdir=`dirname $progname`
@@ -163,7 +163,7 @@ if test $backend = llvm; then
fi
if check_version 3.5 $llvm_version; then
llvm_be=llvm
- elif check_version 3.6 $llvm_version ||
+ elif check_version 3.6 $llvm_version ||
check_version 3.7 $llvm_version ||
check_version 3.8 $llvm_version;
then
@@ -195,6 +195,14 @@ case "$build" in
*) SOEXT=".so"; EXEEXT=""; PIC_FLAGS="-fPIC";;
esac
+# Check if gcc was configured with --enable-default-pie. In that case -fPIC
+# should be added.
+if gcc --version 2>&1 | grep -q enable-default-pie; then
+ default_pie="yes"
+else
+ default_pie="no"
+fi
+
# Generate config.status
rm -f config.status
{
@@ -266,6 +274,7 @@ sed -e "s%@COMPILER_GCC@%ghdl1-gcc$EXEEXT%" \
-e "s%@INSTALL_PREFIX@%$prefix%" \
-e "s%@LIB_PREFIX@%$libdirsuffix%" \
-e "s%@SOEXT@%$SOEXT%" \
+ -e "s%@default_pie@%$default_pie%" \
< $srcdir/src/ghdldrv/default_pathes.ads.in > default_pathes.ads
exit 0