about summary refs log tree commit diff
path: root/configure
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-10-29 23:21:13 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-10-29 23:21:13 +0000
commite95169503a160562d7381173e1060a97923dde7c (patch)
tree92319a48658dc96456a7f6c2913d27b3292aff79 /configure
parent59da6de26b12a4323b3d9725d5d1d68da4d5bd37 (diff)
downloads6-linux-init-e95169503a160562d7381173e1060a97923dde7c.tar.gz
s6-linux-init-e95169503a160562d7381173e1060a97923dde7c.tar.xz
s6-linux-init-e95169503a160562d7381173e1060a97923dde7c.zip
Support default pie
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure15
1 files changed, 15 insertions, 0 deletions
diff --git a/configure b/configure
index 70b6545..aa6f91f 100755
--- a/configure
+++ b/configure
@@ -292,6 +292,16 @@ if [ "x$target" != "x$(cat $sysdeps/target)" ] ; then
   exit 1
 fi
 
+defaultpie=false
+echo "Checking whether we're building PIE..."
+if $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST -dM -E - < /dev/null | grep -qF __PIE__ ; then
+  defaultpie=true
+  CFLAGS_AUTO="$CFLAGS_AUTO -fPIC"
+  echo "  ... yes"
+else
+  echo "  ... no"
+fi
+
 spawn_lib=$(cat $sysdeps/spawn.lib)
 socket_lib=$(cat $sysdeps/socket.lib)
 sysclock_lib=$(cat $sysdeps/sysclock.lib)
@@ -404,6 +414,11 @@ if $shared ; then
 else
   echo "DO_SHARED :="
 fi
+if $defaultpie ; then
+  echo "DEFAULT_PIE := 1"
+else
+  echo "DEFAULT_PIE :="
+fi
 
 exec 1>&3 3>&-
 echo "  ... done."