From 95ace82d4d984b6a9a654e6d8fb2e410b144d8b7 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 29 Oct 2017 23:21:22 +0000 Subject: Support default pie --- configure | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'configure') 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." -- cgit v1.2.3